sequence
stringlengths 1.27k
35.1k
| code
stringlengths 75
8.58k
|
---|---|
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'title_from_rdf'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'rdf'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '6', 'type': 'block', 'children': ['7', '9', '19', '24', '50', '63', '71']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'string', 'children': [], 'value': "'''\n Try to extract a distribution title from a property.\n As it's not a mandatory property,\n it fallback on building a title from the URL\n then the format and in last ressort a generic resource name.\n '''"}; {'id': '9', 'type': 'expression_statement', 'children': ['10']}; {'id': '10', 'type': 'assignment', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '12', 'type': 'call', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'rdf_value'}; {'id': '14', 'type': 'argument_list', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'rdf'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'DCT'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'return_statement', 'children': ['23']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'title'}; {'id': '24', 'type': 'if_statement', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '26', 'type': 'block', 'children': ['27', '39']}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'assignment', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'last_part'}; {'id': '30', 'type': 'subscript', 'children': ['31', '37']}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'url'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'string', 'children': [], 'value': "'/'"}; {'id': '37', 'type': 'unary_operator', 'children': ['38'], 'value': '-'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '47']}; {'id': '40', 'type': 'boolean_operator', 'children': ['41', '44'], 'value': 'and'}; {'id': '41', 'type': 'comparison_operator', 'children': ['42', '43'], 'value': 'in'}; {'id': '42', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'last_part'}; {'id': '44', 'type': 'comparison_operator', 'children': ['45', '46'], 'value': 'not'}; {'id': '45', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'last_part'}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'last_part'}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'fmt'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'rdf_value'}; {'id': '55', 'type': 'argument_list', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'rdf'}; {'id': '57', 'type': 'call', 'children': ['58', '61']}; {'id': '58', 'type': 'attribute', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'DCT'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'term'}; {'id': '61', 'type': 'argument_list', 'children': ['62']}; {'id': '62', 'type': 'string', 'children': [], 'value': "'format'"}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '66', 'type': 'subscript', 'children': ['67', '70']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'current_app'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'config'}; {'id': '70', 'type': 'string', 'children': [], 'value': "'DEFAULT_LANGUAGE'"}; {'id': '71', 'type': 'with_statement', 'children': ['72', '80']}; {'id': '72', 'type': 'with_clause', 'children': ['73']}; {'id': '73', 'type': 'with_item', 'children': ['74']}; {'id': '74', 'type': 'call', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'i18n'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'language'}; {'id': '78', 'type': 'argument_list', 'children': ['79']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'lang'}; {'id': '80', 'type': 'block', 'children': ['81']}; {'id': '81', 'type': 'if_statement', 'children': ['82', '83', '102']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'fmt'}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'return_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '94']}; {'id': '86', 'type': 'attribute', 'children': ['87', '93']}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'i18n'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '91', 'type': 'argument_list', 'children': ['92']}; {'id': '92', 'type': 'string', 'children': [], 'value': "'{format} resource'"}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '94', 'type': 'argument_list', 'children': ['95']}; {'id': '95', 'type': 'keyword_argument', 'children': ['96', '97']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '97', 'type': 'call', 'children': ['98', '101']}; {'id': '98', 'type': 'attribute', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'fmt'}; {'id': '100', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '101', 'type': 'argument_list', 'children': []}; {'id': '102', 'type': 'else_clause', 'children': ['103']}; {'id': '103', 'type': 'block', 'children': ['104']}; {'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': 'i18n'}; {'id': '108', 'type': 'identifier', 'children': [], 'value': '_'}; {'id': '109', 'type': 'argument_list', 'children': ['110']}; {'id': '110', 'type': 'string', 'children': [], 'value': "'Nameless resource'"} | def title_from_rdf(rdf, url):
'''
Try to extract a distribution title from a property.
As it's not a mandatory property,
it fallback on building a title from the URL
then the format and in last ressort a generic resource name.
'''
title = rdf_value(rdf, DCT.title)
if title:
return title
if url:
last_part = url.split('/')[-1]
if '.' in last_part and '?' not in last_part:
return last_part
fmt = rdf_value(rdf, DCT.term('format'))
lang = current_app.config['DEFAULT_LANGUAGE']
with i18n.language(lang):
if fmt:
return i18n._('{format} resource').format(format=fmt.lower())
else:
return i18n._('Nameless resource') |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sort'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'by'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '8', 'type': 'False', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10', '31', '47']}; {'id': '10', 'type': 'if_statement', 'children': ['11', '15', '20']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'callable'}; {'id': '13', 'type': 'argument_list', 'children': ['14']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'by'}; {'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': 'key'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'by'}; {'id': '20', 'type': 'else_clause', 'children': ['21']}; {'id': '21', 'type': 'block', 'children': ['22']}; {'id': '22', 'type': 'function_definition', 'children': ['23', '24', '26']}; {'id': '23', 'type': 'function_name', 'children': [], 'value': 'key'}; {'id': '24', 'type': 'parameters', 'children': ['25']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'feature'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'feature'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'by'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'sorted_features'}; {'id': '34', 'type': 'call', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '41', '44']}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'desc'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '47', 'type': 'return_statement', 'children': ['48']}; {'id': '48', 'type': 'call', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': '__class__'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'sorted_features'} | def sort(self, by, desc=False):
if callable(by):
key = by
else:
def key(feature):
return feature[by]
sorted_features = sorted(list(self), reverse=desc, key=key)
return self.__class__(sorted_features) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '7']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shellc'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'lenvals'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '7', 'type': 'block', 'children': ['8', '23', '32', '41', '55']}; {'id': '8', 'type': 'expression_statement', 'children': ['9']}; {'id': '9', 'type': 'assignment', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '11', 'type': 'call', 'children': ['12', '15']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'listToCharArray'}; {'id': '15', 'type': 'argument_list', 'children': ['16', '17', '20']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '17', 'type': 'keyword_argument', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'xLen'}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'lenvals'}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'yLen'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '23', 'type': 'expression_statement', 'children': ['24']}; {'id': '24', 'type': 'assignment', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '26', 'type': 'call', 'children': ['27', '30']}; {'id': '27', 'type': 'attribute', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'c_int'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '32', 'type': 'expression_statement', 'children': ['33']}; {'id': '33', 'type': 'assignment', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'lenvals'}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'c_int'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'lenvals'}; {'id': '41', 'type': 'expression_statement', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '46']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'libspice'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'shellc_c'}; {'id': '46', 'type': 'argument_list', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'lenvals'}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'byref'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'cVectorToPython'}; {'id': '60', 'type': 'argument_list', 'children': ['61']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'array'} | def shellc(ndim, lenvals, array):
array = stypes.listToCharArray(array, xLen=lenvals, yLen=ndim)
ndim = ctypes.c_int(ndim)
lenvals = ctypes.c_int(lenvals)
libspice.shellc_c(ndim, lenvals, ctypes.byref(array))
return stypes.cVectorToPython(array) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shelld'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '25', '46']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'toDoubleVector'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'c_int'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'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': 'libspice'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'shelld_c'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'cast'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'POINTER'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'c_double'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'cVectorToPython'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'array'} | def shelld(ndim, array):
array = stypes.toDoubleVector(array)
ndim = ctypes.c_int(ndim)
libspice.shelld_c(ndim, ctypes.cast(array, ctypes.POINTER(ctypes.c_double)))
return stypes.cVectorToPython(array) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'shelli'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '6', 'type': 'block', 'children': ['7', '16', '25', '46']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '10', 'type': 'call', 'children': ['11', '14']}; {'id': '11', 'type': 'attribute', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'toIntVector'}; {'id': '14', 'type': 'argument_list', 'children': ['15']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '16', 'type': 'expression_statement', 'children': ['17']}; {'id': '17', 'type': 'assignment', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '19', 'type': 'call', 'children': ['20', '23']}; {'id': '20', 'type': 'attribute', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'c_int'}; {'id': '23', 'type': 'argument_list', 'children': ['24']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'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': 'libspice'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'shelli_c'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'ndim'}; {'id': '32', 'type': 'call', 'children': ['33', '36']}; {'id': '33', 'type': 'attribute', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'cast'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'POINTER'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'attribute', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'ctypes'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'c_int'}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'call', 'children': ['48', '51']}; {'id': '48', 'type': 'attribute', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'stypes'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'cVectorToPython'}; {'id': '51', 'type': 'argument_list', 'children': ['52']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'array'} | def shelli(ndim, array):
array = stypes.toIntVector(array)
ndim = ctypes.c_int(ndim)
libspice.shelli_c(ndim, ctypes.cast(array, ctypes.POINTER(ctypes.c_int)))
return stypes.cVectorToPython(array) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '16']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'make_retrieveParameters'}; {'id': '3', 'type': 'parameters', 'children': ['4', '7', '10', '13']}; {'id': '4', 'type': 'default_parameter', 'children': ['5', '6']}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '6', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '7', 'type': 'default_parameter', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '9', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '10', 'type': 'default_parameter', 'children': ['11', '12']}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '12', 'type': 'string', 'children': [], 'value': "'RS'"}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '15', 'type': 'string', 'children': [], 'value': "'D'"}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'return_statement', 'children': ['18']}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': '_OrderedDict'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'list', 'children': ['22', '25', '28'], 'value': "[\n ('firstRecord', offset),\n ('count', count),\n ('sortField', _OrderedDict([('name', name), ('sort', sort)]))\n ]"}; {'id': '22', 'type': 'tuple', 'children': ['23', '24']}; {'id': '23', 'type': 'string', 'children': [], 'value': "'firstRecord'"}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '25', 'type': 'tuple', 'children': ['26', '27']}; {'id': '26', 'type': 'string', 'children': [], 'value': "'count'"}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '28', 'type': 'tuple', 'children': ['29', '30']}; {'id': '29', 'type': 'string', 'children': [], 'value': "'sortField'"}; {'id': '30', 'type': 'call', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_OrderedDict'}; {'id': '32', 'type': 'argument_list', 'children': ['33']}; {'id': '33', 'type': 'list', 'children': ['34', '37'], 'value': "[('name', name), ('sort', sort)]"}; {'id': '34', 'type': 'tuple', 'children': ['35', '36']}; {'id': '35', 'type': 'string', 'children': [], 'value': "'name'"}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '37', 'type': 'tuple', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': "'sort'"}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sort'} | def make_retrieveParameters(offset=1, count=100, name='RS', sort='D'):
return _OrderedDict([
('firstRecord', offset),
('count', count),
('sortField', _OrderedDict([('name', name), ('sort', sort)]))
]) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sorted_names'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '17', '33', '40', '50']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'list'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'have_default'}; {'id': '16', 'type': 'False', 'children': []}; {'id': '17', 'type': 'if_statement', 'children': ['18', '21']}; {'id': '18', 'type': 'comparison_operator', 'children': ['19', '20'], 'value': 'in'}; {'id': '19', 'type': 'string', 'children': [], 'value': "'default'"}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '21', 'type': 'block', 'children': ['22', '29']}; {'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': 'names'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'default'"}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'have_default'}; {'id': '32', 'type': 'True', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'sorted_names'}; {'id': '36', 'type': 'call', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'names'}; {'id': '40', 'type': 'if_statement', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'have_default'}; {'id': '42', 'type': 'block', 'children': ['43']}; {'id': '43', 'type': 'expression_statement', 'children': ['44']}; {'id': '44', 'type': 'assignment', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'sorted_names'}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '49'], 'value': '+'}; {'id': '47', 'type': 'list', 'children': ['48'], 'value': "['default']"}; {'id': '48', 'type': 'string', 'children': [], 'value': "'default'"}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'sorted_names'}; {'id': '50', 'type': 'return_statement', 'children': ['51']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sorted_names'} | def sorted_names(names):
names = list(names)
have_default = False
if 'default' in names:
names.remove('default')
have_default = True
sorted_names = sorted(names)
if have_default:
sorted_names = ['default'] + sorted_names
return sorted_names |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '22']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getArticles'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'page'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'sortBy'}; {'id': '13', 'type': 'string', 'children': [], 'value': '"rel"'}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sortByAsc'}; {'id': '16', 'type': 'False', 'children': []}; {'id': '17', 'type': 'default_parameter', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'returnInfo'}; {'id': '19', 'type': 'call', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'ReturnInfo'}; {'id': '21', 'type': 'argument_list', 'children': []}; {'id': '22', 'type': 'block', 'children': ['23', '27', '31', '70', '82']}; {'id': '23', 'type': 'assert_statement', 'children': ['24']}; {'id': '24', 'type': 'comparison_operator', 'children': ['25', '26'], 'value': '>='}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'page'}; {'id': '26', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '27', 'type': 'assert_statement', 'children': ['28']}; {'id': '28', 'type': 'comparison_operator', 'children': ['29', '30'], 'value': '<='}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '34', 'type': 'dictionary', 'children': ['35', '38', '41', '48', '51', '54', '57', '60']}; {'id': '35', 'type': 'pair', 'children': ['36', '37']}; {'id': '36', 'type': 'string', 'children': [], 'value': '"action"'}; {'id': '37', 'type': 'string', 'children': [], 'value': '"getArticlesForTopicPage"'}; {'id': '38', 'type': 'pair', 'children': ['39', '40']}; {'id': '39', 'type': 'string', 'children': [], 'value': '"resultType"'}; {'id': '40', 'type': 'string', 'children': [], 'value': '"articles"'}; {'id': '41', 'type': 'pair', 'children': ['42', '43']}; {'id': '42', 'type': 'string', 'children': [], 'value': '"dataType"'}; {'id': '43', 'type': 'subscript', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'topicPage'}; {'id': '47', 'type': 'string', 'children': [], 'value': '"dataType"'}; {'id': '48', 'type': 'pair', 'children': ['49', '50']}; {'id': '49', 'type': 'string', 'children': [], 'value': '"articlesCount"'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '51', 'type': 'pair', 'children': ['52', '53']}; {'id': '52', 'type': 'string', 'children': [], 'value': '"articlesSortBy"'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'sortBy'}; {'id': '54', 'type': 'pair', 'children': ['55', '56']}; {'id': '55', 'type': 'string', 'children': [], 'value': '"articlesSortByAsc"'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'sortByAsc'}; {'id': '57', 'type': 'pair', 'children': ['58', '59']}; {'id': '58', 'type': 'string', 'children': [], 'value': '"page"'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'page'}; {'id': '60', 'type': 'pair', 'children': ['61', '62']}; {'id': '61', 'type': 'string', 'children': [], 'value': '"topicPage"'}; {'id': '62', 'type': 'call', 'children': ['63', '66']}; {'id': '63', 'type': 'attribute', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'dumps'}; {'id': '66', 'type': 'argument_list', 'children': ['67']}; {'id': '67', 'type': 'attribute', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'topicPage'}; {'id': '70', 'type': 'expression_statement', 'children': ['71']}; {'id': '71', 'type': 'call', 'children': ['72', '75']}; {'id': '72', 'type': 'attribute', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '75', 'type': 'argument_list', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '80']}; {'id': '77', 'type': 'attribute', 'children': ['78', '79']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'returnInfo'}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'getParams'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'string', 'children': [], 'value': '"articles"'}; {'id': '82', 'type': 'return_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': 'self'}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'eventRegistry'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'jsonRequest'}; {'id': '89', 'type': 'argument_list', 'children': ['90', '91']}; {'id': '90', 'type': 'string', 'children': [], 'value': '"/json/article"'}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'params'} | def getArticles(self,
page=1,
count=100,
sortBy = "rel",
sortByAsc = False,
returnInfo=ReturnInfo()):
assert page >= 1
assert count <= 100
params = {
"action": "getArticlesForTopicPage",
"resultType": "articles",
"dataType": self.topicPage["dataType"],
"articlesCount": count,
"articlesSortBy": sortBy,
"articlesSortByAsc": sortByAsc,
"page": page,
"topicPage": json.dumps(self.topicPage)
}
params.update(returnInfo.getParams("articles"))
return self.eventRegistry.jsonRequest("/json/article", params) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'pprint'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '18', '21', '24', '27', '30']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '17', 'type': 'keyword_separator', 'children': []}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'compact'}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '30', 'type': 'default_parameter', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '33', 'type': 'block', 'children': ['34', '63', '75', '81']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'sdocs'}; {'id': '37', 'type': 'call', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'python_to_sdocs'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '41', 'type': 'dictionary_splat', 'children': ['42']}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '_merge_defaults'}; {'id': '44', 'type': 'argument_list', 'children': ['45', '48', '51', '54', '57', '60']}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '66', 'type': '()', 'children': ['67']}; {'id': '67', 'type': 'conditional_expression', 'children': ['68', '71', '74'], 'value': 'if'}; {'id': '68', 'type': 'attribute', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '71', 'type': 'comparison_operator', 'children': ['72', '73'], 'value': 'is'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'call', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'default_render_to_stream'}; {'id': '78', 'type': 'argument_list', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'sdocs'}; {'id': '81', 'type': 'if_statement', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '83', 'type': 'block', 'children': ['84']}; {'id': '84', 'type': 'expression_statement', 'children': ['85']}; {'id': '85', 'type': 'call', 'children': ['86', '89']}; {'id': '86', 'type': 'attribute', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '89', 'type': 'argument_list', 'children': ['90']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'end'} | def pprint(
object,
stream=_UNSET_SENTINEL,
indent=_UNSET_SENTINEL,
width=_UNSET_SENTINEL,
depth=_UNSET_SENTINEL,
*,
compact=False,
ribbon_width=_UNSET_SENTINEL,
max_seq_len=_UNSET_SENTINEL,
sort_dict_keys=_UNSET_SENTINEL,
end='\n'
):
sdocs = python_to_sdocs(
object,
**_merge_defaults(
indent=indent,
width=width,
depth=depth,
ribbon_width=ribbon_width,
max_seq_len=max_seq_len,
sort_dict_keys=sort_dict_keys,
)
)
stream = (
sys.stdout
if stream is _UNSET_SENTINEL
else stream
)
default_render_to_stream(stream, sdocs)
if end:
stream.write(end) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '36']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'cpprint'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '14', '17', '18', '21', '24', '27', '30', '33']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '10', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '14', 'type': 'default_parameter', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '17', 'type': 'keyword_separator', 'children': []}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'compact'}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '30', 'type': 'default_parameter', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'style'}; {'id': '32', 'type': 'None', 'children': []}; {'id': '33', 'type': 'default_parameter', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'\\n'"}; {'id': '36', 'type': 'block', 'children': ['37', '66', '78', '87']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sdocs'}; {'id': '40', 'type': 'call', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'python_to_sdocs'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'object'}; {'id': '44', 'type': 'dictionary_splat', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': '_merge_defaults'}; {'id': '47', 'type': 'argument_list', 'children': ['48', '51', '54', '57', '60', '63']}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'indent'}; {'id': '51', 'type': 'keyword_argument', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'width'}; {'id': '54', 'type': 'keyword_argument', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'depth'}; {'id': '57', 'type': 'keyword_argument', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'ribbon_width'}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'max_seq_len'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'sort_dict_keys'}; {'id': '66', 'type': 'expression_statement', 'children': ['67']}; {'id': '67', 'type': 'assignment', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '69', 'type': '()', 'children': ['70']}; {'id': '70', 'type': 'conditional_expression', 'children': ['71', '74', '77'], 'value': 'if'}; {'id': '71', 'type': 'attribute', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'sys'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'stdout'}; {'id': '74', 'type': 'comparison_operator', 'children': ['75', '76'], 'value': 'is'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': '_UNSET_SENTINEL'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'call', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'colored_render_to_stream'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '83', '84']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'sdocs'}; {'id': '84', 'type': 'keyword_argument', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'style'}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'style'}; {'id': '87', 'type': 'if_statement', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '89', 'type': 'block', 'children': ['90']}; {'id': '90', 'type': 'expression_statement', 'children': ['91']}; {'id': '91', 'type': 'call', 'children': ['92', '95']}; {'id': '92', 'type': 'attribute', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'stream'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'write'}; {'id': '95', 'type': 'argument_list', 'children': ['96']}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'end'} | def cpprint(
object,
stream=_UNSET_SENTINEL,
indent=_UNSET_SENTINEL,
width=_UNSET_SENTINEL,
depth=_UNSET_SENTINEL,
*,
compact=False,
ribbon_width=_UNSET_SENTINEL,
max_seq_len=_UNSET_SENTINEL,
sort_dict_keys=_UNSET_SENTINEL,
style=None,
end='\n'
):
sdocs = python_to_sdocs(
object,
**_merge_defaults(
indent=indent,
width=width,
depth=depth,
ribbon_width=ribbon_width,
max_seq_len=max_seq_len,
sort_dict_keys=sort_dict_keys,
)
)
stream = (
sys.stdout
if stream is _UNSET_SENTINEL
else stream
)
colored_render_to_stream(stream, sdocs, style=style)
if end:
stream.write(end) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_encrypted_data_keys_hash'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'hasher'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'encrypted_data_keys'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '48']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'hashed_keys'}; {'id': '10', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '11', 'type': 'for_statement', 'children': ['12', '13', '14']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'edk'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'encrypted_data_keys'}; {'id': '14', 'type': 'block', 'children': ['15', '22', '30', '37']}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'serialized_edk'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'serialize_encrypted_data_key'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'edk'}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': '_hasher'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'hasher'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'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': '_hasher'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'update'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'serialized_edk'}; {'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': 'hashed_keys'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '42', 'type': 'argument_list', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': '_hasher'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'finalize'}; {'id': '47', 'type': 'argument_list', 'children': []}; {'id': '48', 'type': 'return_statement', 'children': ['49']}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'string', 'children': [], 'value': 'b""'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '53', 'type': 'argument_list', 'children': ['54']}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'hashed_keys'} | def _encrypted_data_keys_hash(hasher, encrypted_data_keys):
hashed_keys = []
for edk in encrypted_data_keys:
serialized_edk = serialize_encrypted_data_key(edk)
_hasher = hasher.copy()
_hasher.update(serialized_edk)
hashed_keys.append(_hasher.finalize())
return b"".join(sorted(hashed_keys)) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getOverlaySortOrder'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'ulOverlayHandle'}; {'id': '6', 'type': 'block', 'children': ['7', '15', '21', '32']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'fn'}; {'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': 'function_table'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'getOverlaySortOrder'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'punSortOrder'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'c_uint32'}; {'id': '20', 'type': 'argument_list', 'children': []}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'fn'}; {'id': '26', 'type': 'argument_list', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'ulOverlayHandle'}; {'id': '28', 'type': 'call', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'byref'}; {'id': '30', 'type': 'argument_list', 'children': ['31']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'punSortOrder'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'expression_list', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'punSortOrder'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'value'} | def getOverlaySortOrder(self, ulOverlayHandle):
fn = self.function_table.getOverlaySortOrder
punSortOrder = c_uint32()
result = fn(ulOverlayHandle, byref(punSortOrder))
return result, punSortOrder.value |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'naturalize_string'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '5', 'type': 'block', 'children': ['6']}; {'id': '6', 'type': 'return_statement', 'children': ['7']}; {'id': '7', 'type': 'list_comprehension', 'children': ['8', '23']}; {'id': '8', 'type': 'conditional_expression', 'children': ['9', '13', '18'], 'value': 'if'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '13', 'type': 'call', 'children': ['14', '17']}; {'id': '14', 'type': 'attribute', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'isdigit'}; {'id': '17', 'type': 'argument_list', 'children': []}; {'id': '18', 'type': 'call', 'children': ['19', '22']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'for_in_clause', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '29', 'type': 'argument_list', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'numregex'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'key'} | def naturalize_string(key):
return [int(text) if text.isdigit() else text.lower()
for text in re.split(numregex, key)] |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_get_rows'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '6', 'type': 'block', 'children': ['7', '45', '104', '123']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11', '32']}; {'id': '8', 'type': 'subscript', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '10', 'type': 'string', 'children': [], 'value': '"oldsortslice"'}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'deepcopy'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'subscript', 'children': ['21', '24']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': '_rows'}; {'id': '24', 'type': 'slice', 'children': ['25', '28', '29']}; {'id': '25', 'type': 'subscript', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '27', 'type': 'string', 'children': [], 'value': '"start"'}; {'id': '28', 'type': 'colon', 'children': []}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '31', 'type': 'string', 'children': [], 'value': '"end"'}; {'id': '32', 'type': 'else_clause', 'children': ['33']}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'expression_statement', 'children': ['35']}; {'id': '35', 'type': 'assignment', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '37', 'type': 'call', 'children': ['38', '41']}; {'id': '38', 'type': 'attribute', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'copy'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'deepcopy'}; {'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': '_rows'}; {'id': '45', 'type': 'if_statement', 'children': ['46', '49']}; {'id': '46', 'type': 'subscript', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '48', 'type': 'string', 'children': [], 'value': '"sortby"'}; {'id': '49', 'type': 'block', 'children': ['50', '63', '76', '92']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'assignment', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'sortindex'}; {'id': '53', 'type': 'call', 'children': ['54', '59']}; {'id': '54', 'type': 'attribute', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': '_field_names'}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'index'}; {'id': '59', 'type': 'argument_list', 'children': ['60']}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '62', 'type': 'string', 'children': [], 'value': '"sortby"'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '66', 'type': 'list_comprehension', 'children': ['67', '73']}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '72'], 'value': '+'}; {'id': '68', 'type': 'list', 'children': ['69'], 'value': '[row[sortindex]]'}; {'id': '69', 'type': 'subscript', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'sortindex'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '73', 'type': 'for_in_clause', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '76', 'type': 'expression_statement', 'children': ['77']}; {'id': '77', 'type': 'call', 'children': ['78', '81']}; {'id': '78', 'type': 'attribute', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '81', 'type': 'argument_list', 'children': ['82', '87']}; {'id': '82', 'type': 'keyword_argument', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '84', 'type': 'subscript', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '86', 'type': 'string', 'children': [], 'value': '"reversesort"'}; {'id': '87', 'type': 'keyword_argument', 'children': ['88', '89']}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '89', 'type': 'subscript', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '91', 'type': 'string', 'children': [], 'value': '"sort_key"'}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '95', 'type': 'list_comprehension', 'children': ['96', '101']}; {'id': '96', 'type': 'subscript', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '98', 'type': 'slice', 'children': ['99', '100']}; {'id': '99', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '100', 'type': 'colon', 'children': []}; {'id': '101', 'type': 'for_in_clause', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'row'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '104', 'type': 'if_statement', 'children': ['105', '109']}; {'id': '105', 'type': 'not_operator', 'children': ['106']}; {'id': '106', 'type': 'subscript', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '108', 'type': 'string', 'children': [], 'value': '"oldsortslice"'}; {'id': '109', 'type': 'block', 'children': ['110']}; {'id': '110', 'type': 'expression_statement', 'children': ['111']}; {'id': '111', 'type': 'assignment', 'children': ['112', '113']}; {'id': '112', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '113', 'type': 'subscript', 'children': ['114', '115']}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'rows'}; {'id': '115', 'type': 'slice', 'children': ['116', '119', '120']}; {'id': '116', 'type': 'subscript', 'children': ['117', '118']}; {'id': '117', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '118', 'type': 'string', 'children': [], 'value': '"start"'}; {'id': '119', 'type': 'colon', 'children': []}; {'id': '120', 'type': 'subscript', 'children': ['121', '122']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '122', 'type': 'string', 'children': [], 'value': '"end"'}; {'id': '123', 'type': 'return_statement', 'children': ['124']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'rows'} | def _get_rows(self, options):
if options["oldsortslice"]:
rows = copy.deepcopy(self._rows[options["start"]:options["end"]])
else:
rows = copy.deepcopy(self._rows)
if options["sortby"]:
sortindex = self._field_names.index(options["sortby"])
rows = [[row[sortindex]] + row for row in rows]
rows.sort(reverse=options["reversesort"], key=options["sort_key"])
rows = [row[1:] for row in rows]
if not options["oldsortslice"]:
rows = rows[options["start"]:options["end"]]
return rows |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_resolve_sort_by'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'flag_radius_query'}; {'id': '6', 'type': 'block', 'children': ['7', '79']}; {'id': '7', 'type': 'if_statement', 'children': ['8', '11', '19', '71']}; {'id': '8', 'type': 'comparison_operator', 'children': ['9', '10'], 'value': 'is'}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'flag_radius_query'}; {'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': 'sort_by'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'SORT_BY_DIST'}; {'id': '19', 'type': 'elif_clause', 'children': ['20', '25']}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '22', 'type': 'argument_list', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'string_types'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'if_statement', 'children': ['27', '34', '53']}; {'id': '27', 'type': 'comparison_operator', 'children': ['28', '33'], 'value': '=='}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'lower'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'SORT_BY_DIST'}; {'id': '34', 'type': 'block', 'children': ['35', '49']}; {'id': '35', 'type': 'if_statement', 'children': ['36', '39']}; {'id': '36', 'type': 'comparison_operator', 'children': ['37', '38'], 'value': 'is'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'flag_radius_query'}; {'id': '38', 'type': 'False', 'children': []}; {'id': '39', 'type': 'block', 'children': ['40', '44']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'assignment', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '43', 'type': 'string', 'children': [], 'value': '"`sort_by` arg can be \'dist\' only under distance based query!"'}; {'id': '44', 'type': 'raise_statement', 'children': ['45']}; {'id': '45', 'type': 'call', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'SORT_BY_DIST'}; {'id': '53', 'type': 'elif_clause', 'children': ['54', '61']}; {'id': '54', 'type': 'comparison_operator', 'children': ['55', '56'], 'value': 'not'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'SimpleZipcode'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': '__table__'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'columns'}; {'id': '61', 'type': 'block', 'children': ['62', '66']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'assignment', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'msg'}; {'id': '65', 'type': 'string', 'children': [], 'value': '"`sort_by` arg has to be one of the Zipcode attribute or \'dist\'!"'}; {'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': 'identifier', 'children': [], 'value': 'msg'}; {'id': '71', 'type': 'else_clause', 'children': ['72']}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '76', 'type': 'attribute', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'sort_by'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'name'}; {'id': '79', 'type': 'return_statement', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'sort_by'} | def _resolve_sort_by(sort_by, flag_radius_query):
if sort_by is None:
if flag_radius_query:
sort_by = SORT_BY_DIST
elif isinstance(sort_by, string_types):
if sort_by.lower() == SORT_BY_DIST:
if flag_radius_query is False:
msg = "`sort_by` arg can be 'dist' only under distance based query!"
raise ValueError(msg)
sort_by = SORT_BY_DIST
elif sort_by not in SimpleZipcode.__table__.columns:
msg = "`sort_by` arg has to be one of the Zipcode attribute or 'dist'!"
raise ValueError(msg)
else:
sort_by = sort_by.name
return sort_by |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'getOPOrUserServices'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'openid_services'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '25']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'op_services'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'arrangeByType'}; {'id': '11', 'type': 'argument_list', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'openid_services'}; {'id': '13', 'type': 'list', 'children': ['14'], 'value': '[OPENID_IDP_2_0_TYPE]'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'OPENID_IDP_2_0_TYPE'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'openid_services'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'arrangeByType'}; {'id': '20', 'type': 'argument_list', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'openid_services'}; {'id': '22', 'type': 'attribute', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'OpenIDServiceEndpoint'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'openid_type_uris'}; {'id': '25', 'type': 'return_statement', 'children': ['26']}; {'id': '26', 'type': 'boolean_operator', 'children': ['27', '28'], 'value': 'or'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'op_services'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'openid_services'} | def getOPOrUserServices(openid_services):
op_services = arrangeByType(openid_services, [OPENID_IDP_2_0_TYPE])
openid_services = arrangeByType(openid_services,
OpenIDServiceEndpoint.openid_type_uris)
return op_services or openid_services |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '9']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'AdvSearch'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'search'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'bs'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '3'}; {'id': '9', 'type': 'block', 'children': ['10', '12', '21', '25', '29', '173']}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'string', 'children': [], 'value': "'''Return set of all regex matches\n This is an advanced version of python-docx.search() that takes into\n account blocks of <bs> elements at a time.\n What it does:\n It searches the entire document body for text blocks.\n Since the text to search could be spawned across multiple text blocks,\n we need to adopt some sort of algorithm to handle this situation.\n The smaller matching group of blocks (up to bs) is then adopted.\n If the matching group has more than one block, blocks other than first\n are cleared and all the replacement text is put on first block.\n Examples:\n original text blocks : [ 'Hel', 'lo,', ' world!' ]\n search : 'Hello,'\n output blocks : [ 'Hello,' ]\n original text blocks : [ 'Hel', 'lo', ' __', 'name', '__!' ]\n search : '(__[a-z]+__)'\n output blocks : [ '__name__' ]\n @param instance document: The original document\n @param str search: The text to search for (regexp)\n append, or a list of etree elements\n @param int bs: See above\n @return set All occurences of search string\n '''"}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'searchre'}; {'id': '15', 'type': 'call', 'children': ['16', '19']}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 're'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'compile'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'search'}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'matches'}; {'id': '24', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '25', 'type': 'expression_statement', 'children': ['26']}; {'id': '26', 'type': 'assignment', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '28', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '29', 'type': 'for_statement', 'children': ['30', '31', '36']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '31', 'type': 'call', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'document'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'iter'}; {'id': '35', 'type': 'argument_list', 'children': []}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'if_statement', 'children': ['38', '47']}; {'id': '38', 'type': 'comparison_operator', 'children': ['39', '42'], 'value': '=='}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'tag'}; {'id': '42', 'type': 'binary_operator', 'children': ['43', '44'], 'value': '%'}; {'id': '43', 'type': 'string', 'children': [], 'value': "'{%s}t'"}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'nsprefixes'}; {'id': '46', 'type': 'string', 'children': [], 'value': "'w'"}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'if_statement', 'children': ['49', '52']}; {'id': '49', 'type': 'attribute', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '52', 'type': 'block', 'children': ['53', '60', '75', '79']}; {'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': 'searchels'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'element'}; {'id': '60', 'type': 'if_statement', 'children': ['61', '67']}; {'id': '61', 'type': 'comparison_operator', 'children': ['62', '66'], 'value': '>'}; {'id': '62', 'type': 'call', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '64', 'type': 'argument_list', 'children': ['65']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'bs'}; {'id': '67', 'type': 'block', 'children': ['68']}; {'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': 'searchels'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'pop'}; {'id': '73', 'type': 'argument_list', 'children': ['74']}; {'id': '74', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '75', 'type': 'expression_statement', 'children': ['76']}; {'id': '76', 'type': 'assignment', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '78', 'type': 'False', 'children': []}; {'id': '79', 'type': 'for_statement', 'children': ['80', '81', '91']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '81', 'type': 'call', 'children': ['82', '83']}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '83', 'type': 'argument_list', 'children': ['84', '85']}; {'id': '84', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '85', 'type': 'binary_operator', 'children': ['86', '90'], 'value': '+'}; {'id': '86', 'type': 'call', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '88', 'type': 'argument_list', 'children': ['89']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '90', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '91', 'type': 'block', 'children': ['92', '96']}; {'id': '92', 'type': 'if_statement', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '94', 'type': 'block', 'children': ['95']}; {'id': '95', 'type': 'break_statement', 'children': []}; {'id': '96', 'type': 'for_statement', 'children': ['97', '98', '105']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '98', 'type': 'call', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'call', 'children': ['102', '103']}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '103', 'type': 'argument_list', 'children': ['104']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '105', 'type': 'block', 'children': ['106', '110']}; {'id': '106', 'type': 'if_statement', 'children': ['107', '108']}; {'id': '107', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '108', 'type': 'block', 'children': ['109']}; {'id': '109', 'type': 'break_statement', 'children': []}; {'id': '110', 'type': 'if_statement', 'children': ['111', '119']}; {'id': '111', 'type': 'comparison_operator', 'children': ['112', '115'], 'value': '<='}; {'id': '112', 'type': 'binary_operator', 'children': ['113', '114'], 'value': '+'}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '115', 'type': 'call', 'children': ['116', '117']}; {'id': '116', 'type': 'identifier', 'children': [], 'value': 'len'}; {'id': '117', 'type': 'argument_list', 'children': ['118']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '119', 'type': 'block', 'children': ['120', '130', '134', '146', '155']}; {'id': '120', 'type': 'expression_statement', 'children': ['121']}; {'id': '121', 'type': 'assignment', 'children': ['122', '123']}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '123', 'type': 'call', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'range'}; {'id': '125', 'type': 'argument_list', 'children': ['126', '127']}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '127', 'type': 'binary_operator', 'children': ['128', '129'], 'value': '+'}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 's'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'l'}; {'id': '130', 'type': 'expression_statement', 'children': ['131']}; {'id': '131', 'type': 'assignment', 'children': ['132', '133']}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'txtsearch'}; {'id': '133', 'type': 'string', 'children': [], 'value': "''"}; {'id': '134', 'type': 'for_statement', 'children': ['135', '136', '137']}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'e'}; {'id': '137', 'type': 'block', 'children': ['138']}; {'id': '138', 'type': 'expression_statement', 'children': ['139']}; {'id': '139', 'type': 'augmented_assignment', 'children': ['140', '141'], 'value': '+='}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'txtsearch'}; {'id': '141', 'type': 'attribute', 'children': ['142', '145']}; {'id': '142', 'type': 'subscript', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'searchels'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'text'}; {'id': '146', 'type': 'expression_statement', 'children': ['147']}; {'id': '147', 'type': 'assignment', 'children': ['148', '149']}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '149', 'type': 'call', 'children': ['150', '153']}; {'id': '150', 'type': 'attribute', 'children': ['151', '152']}; {'id': '151', 'type': 'identifier', 'children': [], 'value': 'searchre'}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'search'}; {'id': '153', 'type': 'argument_list', 'children': ['154']}; {'id': '154', 'type': 'identifier', 'children': [], 'value': 'txtsearch'}; {'id': '155', 'type': 'if_statement', 'children': ['156', '157']}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '157', 'type': 'block', 'children': ['158', '169']}; {'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': 'matches'}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '163', 'type': 'argument_list', 'children': ['164']}; {'id': '164', 'type': 'call', 'children': ['165', '168']}; {'id': '165', 'type': 'attribute', 'children': ['166', '167']}; {'id': '166', 'type': 'identifier', 'children': [], 'value': 'match'}; {'id': '167', 'type': 'identifier', 'children': [], 'value': 'group'}; {'id': '168', 'type': 'argument_list', 'children': []}; {'id': '169', 'type': 'expression_statement', 'children': ['170']}; {'id': '170', 'type': 'assignment', 'children': ['171', '172']}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'found'}; {'id': '172', 'type': 'True', 'children': []}; {'id': '173', 'type': 'return_statement', 'children': ['174']}; {'id': '174', 'type': 'call', 'children': ['175', '176']}; {'id': '175', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '176', 'type': 'argument_list', 'children': ['177']}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'matches'} | def AdvSearch(document, search, bs=3):
'''Return set of all regex matches
This is an advanced version of python-docx.search() that takes into
account blocks of <bs> elements at a time.
What it does:
It searches the entire document body for text blocks.
Since the text to search could be spawned across multiple text blocks,
we need to adopt some sort of algorithm to handle this situation.
The smaller matching group of blocks (up to bs) is then adopted.
If the matching group has more than one block, blocks other than first
are cleared and all the replacement text is put on first block.
Examples:
original text blocks : [ 'Hel', 'lo,', ' world!' ]
search : 'Hello,'
output blocks : [ 'Hello,' ]
original text blocks : [ 'Hel', 'lo', ' __', 'name', '__!' ]
search : '(__[a-z]+__)'
output blocks : [ '__name__' ]
@param instance document: The original document
@param str search: The text to search for (regexp)
append, or a list of etree elements
@param int bs: See above
@return set All occurences of search string
'''
searchre = re.compile(search)
matches = []
searchels = []
for element in document.iter():
if element.tag == '{%s}t' % nsprefixes['w']:
if element.text:
searchels.append(element)
if len(searchels) > bs:
searchels.pop(0)
found = False
for l in range(1, len(searchels)+1):
if found:
break
for s in range(len(searchels)):
if found:
break
if s+l <= len(searchels):
e = range(s, s+l)
txtsearch = ''
for k in e:
txtsearch += searchels[k].text
match = searchre.search(txtsearch)
if match:
matches.append(match.group())
found = True
return set(matches) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '4']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_project_files'}; {'id': '3', 'type': 'parameters', 'children': []}; {'id': '4', 'type': 'block', 'children': ['5', '14', '18', '77']}; {'id': '5', 'type': 'if_statement', 'children': ['6', '9']}; {'id': '6', 'type': 'call', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'is_git_project'}; {'id': '8', 'type': 'argument_list', 'children': []}; {'id': '9', 'type': 'block', 'children': ['10']}; {'id': '10', 'type': 'return_statement', 'children': ['11']}; {'id': '11', 'type': 'call', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'get_git_project_files'}; {'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': 'project_files'}; {'id': '17', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '18', 'type': 'for_statement', 'children': ['19', '23', '29']}; {'id': '19', 'type': 'pattern_list', 'children': ['20', '21', '22']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'subdirs'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'files'}; {'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': 'walk'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '29', 'type': 'block', 'children': ['30', '49']}; {'id': '30', 'type': 'for_statement', 'children': ['31', '32', '33']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'subdir'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'subdirs'}; {'id': '33', 'type': 'block', 'children': ['34']}; {'id': '34', 'type': 'if_statement', 'children': ['35', '41']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'subdir'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '39', 'type': 'argument_list', 'children': ['40']}; {'id': '40', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '41', 'type': 'block', 'children': ['42']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'call', 'children': ['44', '47']}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'subdirs'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'remove'}; {'id': '47', 'type': 'argument_list', 'children': ['48']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'subdir'}; {'id': '49', 'type': 'for_statement', 'children': ['50', '51', '52']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'files'}; {'id': '52', 'type': 'block', 'children': ['53', '62']}; {'id': '53', 'type': 'if_statement', 'children': ['54', '60']}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'string', 'children': [], 'value': "'.'"}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'continue_statement', 'children': []}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'call', 'children': ['64', '67']}; {'id': '64', 'type': 'attribute', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'project_files'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'append'}; {'id': '67', 'type': 'argument_list', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '74']}; {'id': '69', 'type': 'attribute', 'children': ['70', '73']}; {'id': '70', 'type': 'attribute', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '74', 'type': 'argument_list', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'top'}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'f'}; {'id': '77', 'type': 'return_statement', 'children': ['78']}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'project_files'} | def get_project_files():
if is_git_project():
return get_git_project_files()
project_files = []
for top, subdirs, files in os.walk('.'):
for subdir in subdirs:
if subdir.startswith('.'):
subdirs.remove(subdir)
for f in files:
if f.startswith('.'):
continue
project_files.append(os.path.join(top, f))
return project_files |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '_validate_path'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '5', 'type': 'block', 'children': ['6', '13', '31', '45']}; {'id': '6', 'type': 'if_statement', 'children': ['7', '10']}; {'id': '7', 'type': 'comparison_operator', 'children': ['8', '9'], 'value': 'is'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '9', 'type': 'None', 'children': []}; {'id': '10', 'type': 'block', 'children': ['11']}; {'id': '11', 'type': 'return_statement', 'children': ['12']}; {'id': '12', 'type': 'None', 'children': []}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'assignment', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'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': 'array'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'call', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '28']}; {'id': '24', 'type': 'call', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'set'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '28', 'type': 'keyword_argument', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'reverse'}; {'id': '30', 'type': 'True', 'children': []}; {'id': '31', 'type': 'if_statement', 'children': ['32', '39']}; {'id': '32', 'type': 'comparison_operator', 'children': ['33', '36'], 'value': '!='}; {'id': '33', 'type': 'subscript', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'new_path'}; {'id': '35', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '36', 'type': 'subscript', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '38', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'expression_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '43', 'type': 'argument_list', 'children': ['44']}; {'id': '44', 'type': 'string', 'children': [], 'value': '"Warning: Path must be sorted largest to smallest."'}; {'id': '45', 'type': 'return_statement', 'children': ['46']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'new_path'} | def _validate_path(path):
if path is None:
return None
new_path = np.array(sorted(set(path), reverse=True))
if new_path[0] != path[0]:
print("Warning: Path must be sorted largest to smallest.")
return new_path |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'count'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '15', '24', '30', '55']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'id': '9', 'type': 'call', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '11', 'type': 'argument_list', 'children': ['12']}; {'id': '12', 'type': 'attribute', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'id': '15', 'type': 'expression_statement', 'children': ['16']}; {'id': '16', 'type': 'assignment', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'request_url'}; {'id': '18', 'type': 'call', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '20', 'type': 'argument_list', 'children': ['21']}; {'id': '21', 'type': 'attribute', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'request_url'}; {'id': '24', 'type': 'expression_statement', 'children': ['25']}; {'id': '25', 'type': 'assignment', 'children': ['26', '29']}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'rows'"}; {'id': '29', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '30', 'type': 'expression_statement', 'children': ['31']}; {'id': '31', 'type': 'assignment', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '33', 'type': 'call', 'children': ['34', '54']}; {'id': '34', 'type': 'attribute', 'children': ['35', '53']}; {'id': '35', 'type': 'call', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'do_http_request'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42', '45']}; {'id': '40', 'type': 'string', 'children': [], 'value': "'get'"}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'request_url'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'custom_header'}; {'id': '47', 'type': 'call', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '49', 'type': 'argument_list', 'children': ['50']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'etiquette'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'json'}; {'id': '54', 'type': 'argument_list', 'children': []}; {'id': '55', 'type': 'return_statement', 'children': ['56']}; {'id': '56', 'type': 'call', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'subscript', 'children': ['60', '63']}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'result'}; {'id': '62', 'type': 'string', 'children': [], 'value': "'message'"}; {'id': '63', 'type': 'string', 'children': [], 'value': "'total-results'"} | def count(self):
request_params = dict(self.request_params)
request_url = str(self.request_url)
request_params['rows'] = 0
result = self.do_http_request(
'get',
request_url,
data=request_params,
custom_header=str(self.etiquette)
).json()
return int(result['message']['total-results']) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'url'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'block', 'children': ['6', '14', '33', '52']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'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': '_escaped_pagging'}; {'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': 'sorted_request_params'}; {'id': '17', 'type': 'call', 'children': ['18', '19']}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '19', 'type': 'argument_list', 'children': ['20']}; {'id': '20', 'type': 'list_comprehension', 'children': ['21', '24']}; {'id': '21', 'type': 'tuple', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '24', 'type': 'for_in_clause', 'children': ['25', '28']}; {'id': '25', 'type': 'pattern_list', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'k'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'v'}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'request_params'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'items'}; {'id': '32', 'type': 'argument_list', 'children': []}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '36', 'type': 'call', 'children': ['37', '51']}; {'id': '37', 'type': 'attribute', 'children': ['38', '50']}; {'id': '38', 'type': 'call', 'children': ['39', '42']}; {'id': '39', 'type': 'attribute', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'requests'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'Request'}; {'id': '42', 'type': 'argument_list', 'children': ['43', '44', '47']}; {'id': '43', 'type': 'string', 'children': [], 'value': "'get'"}; {'id': '44', 'type': 'attribute', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'request_url'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'sorted_request_params'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'prepare'}; {'id': '51', 'type': 'argument_list', 'children': []}; {'id': '52', 'type': 'return_statement', 'children': ['53']}; {'id': '53', 'type': 'attribute', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'req'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'url'} | def url(self):
request_params = self._escaped_pagging()
sorted_request_params = sorted([(k, v) for k, v in request_params.items()])
req = requests.Request(
'get', self.request_url, params=sorted_request_params).prepare()
return req.url |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sortByNamespacePrefix'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'urisList'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'nsList'}; {'id': '6', 'type': 'block', 'children': ['7', '11', '18', '53', '67']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'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': 'urisList'}; {'id': '14', 'type': 'call', 'children': ['15', '16']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'sort_uri_list_by_name'}; {'id': '16', 'type': 'argument_list', 'children': ['17']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'urisList'}; {'id': '18', 'type': 'for_statement', 'children': ['19', '20', '21']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'ns'}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'nsList'}; {'id': '21', 'type': 'block', 'children': ['22', '26', '49']}; {'id': '22', 'type': 'expression_statement', 'children': ['23']}; {'id': '23', 'type': 'assignment', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'innerexit'}; {'id': '25', 'type': 'list', 'children': [], 'value': '[]'}; {'id': '26', 'type': 'for_statement', 'children': ['27', '28', '29']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'urisList'}; {'id': '29', 'type': 'block', 'children': ['30']}; {'id': '30', 'type': 'if_statement', 'children': ['31', '43']}; {'id': '31', 'type': 'call', 'children': ['32', '38']}; {'id': '32', 'type': 'attribute', 'children': ['33', '37']}; {'id': '33', 'type': 'call', 'children': ['34', '35']}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '35', 'type': 'argument_list', 'children': ['36']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'startswith'}; {'id': '38', 'type': 'argument_list', 'children': ['39']}; {'id': '39', 'type': 'call', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '41', 'type': 'argument_list', 'children': ['42']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'ns'}; {'id': '43', 'type': 'block', 'children': ['44']}; {'id': '44', 'type': 'expression_statement', 'children': ['45']}; {'id': '45', 'type': 'augmented_assignment', 'children': ['46', '47'], 'value': '+='}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'innerexit'}; {'id': '47', 'type': 'list', 'children': ['48'], 'value': '[uri]'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'augmented_assignment', 'children': ['51', '52'], 'value': '+='}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'innerexit'}; {'id': '53', 'type': 'for_statement', 'children': ['54', '55', '56']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'urisList'}; {'id': '56', 'type': 'block', 'children': ['57']}; {'id': '57', 'type': 'if_statement', 'children': ['58', '61']}; {'id': '58', 'type': 'comparison_operator', 'children': ['59', '60'], 'value': 'not'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '61', 'type': 'block', 'children': ['62']}; {'id': '62', 'type': 'expression_statement', 'children': ['63']}; {'id': '63', 'type': 'augmented_assignment', 'children': ['64', '65'], 'value': '+='}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'exit'}; {'id': '65', 'type': 'list', 'children': ['66'], 'value': '[uri]'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '67', 'type': 'return_statement', 'children': ['68']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'exit'} | def sortByNamespacePrefix(urisList, nsList):
exit = []
urisList = sort_uri_list_by_name(urisList)
for ns in nsList:
innerexit = []
for uri in urisList:
if str(uri).startswith(str(ns)):
innerexit += [uri]
exit += innerexit
for uri in urisList:
if uri not in exit:
exit += [uri]
return exit |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'sort_uri_list_by_name'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'uri_list'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'bypassNamespace'}; {'id': '7', 'type': 'False', 'children': []}; {'id': '8', 'type': 'block', 'children': ['9', '35']}; {'id': '9', 'type': 'function_definition', 'children': ['10', '11', '13', '34']}; {'id': '10', 'type': 'function_name', 'children': [], 'value': 'get_last_bit'}; {'id': '11', 'type': 'parameters', 'children': ['12']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'uri_string'}; {'id': '13', 'type': 'ERROR', 'children': ['14', '33']}; {'id': '14', 'type': 'ERROR', 'children': ['15', '16', '19', '20', '31', '32']}; {'id': '15', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '16', 'type': 'attribute', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'uri_string'}; {'id': '18', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '19', 'type': 'ERROR', 'children': []}; {'id': '20', 'type': 'keyword_argument', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '22', 'type': 'subscript', 'children': ['23', '29']}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'uri_string'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'split'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'string', 'children': [], 'value': '"/"'}; {'id': '29', 'type': 'unary_operator', 'children': ['30'], 'value': '-'}; {'id': '30', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'return'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '33', 'type': 'block', 'children': [], 'value': ''}; {'id': '34', 'type': 'block', 'children': [], 'value': ''}; {'id': '35', 'type': 'try_statement', 'children': ['36', '65']}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'if_statement', 'children': ['38', '39', '58']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'bypassNamespace'}; {'id': '39', 'type': 'block', 'children': ['40']}; {'id': '40', 'type': 'return_statement', 'children': ['41']}; {'id': '41', 'type': 'call', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'uri_list'}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'key'}; {'id': '47', 'type': 'lambda', 'children': ['48', '50']}; {'id': '48', 'type': 'lambda_parameters', 'children': ['49']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'get_last_bit'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'call', 'children': ['54', '57']}; {'id': '54', 'type': 'attribute', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'x'}; {'id': '56', 'type': 'identifier', 'children': [], 'value': '__str__'}; {'id': '57', 'type': 'argument_list', 'children': []}; {'id': '58', 'type': 'else_clause', 'children': ['59']}; {'id': '59', 'type': 'block', 'children': ['60']}; {'id': '60', 'type': 'return_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'sorted'}; {'id': '63', 'type': 'argument_list', 'children': ['64']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'uri_list'}; {'id': '65', 'type': 'except_clause', 'children': ['66']}; {'id': '66', 'type': 'block', 'children': ['67', '72']}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'string', 'children': [], 'value': '"Error in <sort_uri_list_by_name>: possibly a UnicodeEncodeError"'}; {'id': '72', 'type': 'return_statement', 'children': ['73']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'uri_list'} | def sort_uri_list_by_name(uri_list, bypassNamespace=False):
def get_last_bit(uri_string):
try:
x = uri_string.split("
except:
x = uri_string.split("/")[-1]
return x
try:
if bypassNamespace:
return sorted(uri_list, key=lambda x: get_last_bit(x.__str__()))
else:
return sorted(uri_list)
except:
print(
"Error in <sort_uri_list_by_name>: possibly a UnicodeEncodeError")
return uri_list |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '6']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'try_sort_fmt_opts'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'rdf_format_opts_list'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '6', 'type': 'block', 'children': ['7', '20']}; {'id': '7', 'type': 'expression_statement', 'children': ['8']}; {'id': '8', 'type': 'assignment', 'children': ['9', '12']}; {'id': '9', 'type': 'pattern_list', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'filename'}; {'id': '11', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'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': 'splitext'}; {'id': '18', 'type': 'argument_list', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '20', 'type': 'if_statement', 'children': ['21', '28', '37', '54', '71', '88', '101']}; {'id': '21', 'type': 'boolean_operator', 'children': ['22', '25'], 'value': 'or'}; {'id': '22', 'type': 'comparison_operator', 'children': ['23', '24'], 'value': '=='}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '24', 'type': 'string', 'children': [], 'value': '".ttl"'}; {'id': '25', 'type': 'comparison_operator', 'children': ['26', '27'], 'value': '=='}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '27', 'type': 'string', 'children': [], 'value': '".turtle"'}; {'id': '28', 'type': 'block', 'children': ['29']}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'list', 'children': ['31', '32', '33', '34', '35', '36'], 'value': "['turtle', 'n3', 'nt', 'json-ld', 'rdfa', 'xml']"}; {'id': '31', 'type': 'string', 'children': [], 'value': "'turtle'"}; {'id': '32', 'type': 'string', 'children': [], 'value': "'n3'"}; {'id': '33', 'type': 'string', 'children': [], 'value': "'nt'"}; {'id': '34', 'type': 'string', 'children': [], 'value': "'json-ld'"}; {'id': '35', 'type': 'string', 'children': [], 'value': "'rdfa'"}; {'id': '36', 'type': 'string', 'children': [], 'value': "'xml'"}; {'id': '37', 'type': 'elif_clause', 'children': ['38', '45']}; {'id': '38', 'type': 'boolean_operator', 'children': ['39', '42'], 'value': 'or'}; {'id': '39', 'type': 'comparison_operator', 'children': ['40', '41'], 'value': '=='}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '41', 'type': 'string', 'children': [], 'value': '".xml"'}; {'id': '42', 'type': 'comparison_operator', 'children': ['43', '44'], 'value': '=='}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '44', 'type': 'string', 'children': [], 'value': '".rdf"'}; {'id': '45', 'type': 'block', 'children': ['46']}; {'id': '46', 'type': 'return_statement', 'children': ['47']}; {'id': '47', 'type': 'list', 'children': ['48', '49', '50', '51', '52', '53'], 'value': "['xml', 'turtle', 'n3', 'nt', 'json-ld', 'rdfa']"}; {'id': '48', 'type': 'string', 'children': [], 'value': "'xml'"}; {'id': '49', 'type': 'string', 'children': [], 'value': "'turtle'"}; {'id': '50', 'type': 'string', 'children': [], 'value': "'n3'"}; {'id': '51', 'type': 'string', 'children': [], 'value': "'nt'"}; {'id': '52', 'type': 'string', 'children': [], 'value': "'json-ld'"}; {'id': '53', 'type': 'string', 'children': [], 'value': "'rdfa'"}; {'id': '54', 'type': 'elif_clause', 'children': ['55', '62']}; {'id': '55', 'type': 'boolean_operator', 'children': ['56', '59'], 'value': 'or'}; {'id': '56', 'type': 'comparison_operator', 'children': ['57', '58'], 'value': '=='}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '58', 'type': 'string', 'children': [], 'value': '".nt"'}; {'id': '59', 'type': 'comparison_operator', 'children': ['60', '61'], 'value': '=='}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '61', 'type': 'string', 'children': [], 'value': '".n3"'}; {'id': '62', 'type': 'block', 'children': ['63']}; {'id': '63', 'type': 'return_statement', 'children': ['64']}; {'id': '64', 'type': 'list', 'children': ['65', '66', '67', '68', '69', '70'], 'value': "['n3', 'nt', 'turtle', 'xml', 'json-ld', 'rdfa']"}; {'id': '65', 'type': 'string', 'children': [], 'value': "'n3'"}; {'id': '66', 'type': 'string', 'children': [], 'value': "'nt'"}; {'id': '67', 'type': 'string', 'children': [], 'value': "'turtle'"}; {'id': '68', 'type': 'string', 'children': [], 'value': "'xml'"}; {'id': '69', 'type': 'string', 'children': [], 'value': "'json-ld'"}; {'id': '70', 'type': 'string', 'children': [], 'value': "'rdfa'"}; {'id': '71', 'type': 'elif_clause', 'children': ['72', '79']}; {'id': '72', 'type': 'boolean_operator', 'children': ['73', '76'], 'value': 'or'}; {'id': '73', 'type': 'comparison_operator', 'children': ['74', '75'], 'value': '=='}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '75', 'type': 'string', 'children': [], 'value': '".json"'}; {'id': '76', 'type': 'comparison_operator', 'children': ['77', '78'], 'value': '=='}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '78', 'type': 'string', 'children': [], 'value': '".jsonld"'}; {'id': '79', 'type': 'block', 'children': ['80']}; {'id': '80', 'type': 'return_statement', 'children': ['81']}; {'id': '81', 'type': 'list', 'children': ['82', '83', '84', '85', '86', '87'], 'value': "[\n 'json-ld',\n 'rdfa',\n 'n3',\n 'nt',\n 'turtle',\n 'xml',\n ]"}; {'id': '82', 'type': 'string', 'children': [], 'value': "'json-ld'"}; {'id': '83', 'type': 'string', 'children': [], 'value': "'rdfa'"}; {'id': '84', 'type': 'string', 'children': [], 'value': "'n3'"}; {'id': '85', 'type': 'string', 'children': [], 'value': "'nt'"}; {'id': '86', 'type': 'string', 'children': [], 'value': "'turtle'"}; {'id': '87', 'type': 'string', 'children': [], 'value': "'xml'"}; {'id': '88', 'type': 'elif_clause', 'children': ['89', '92']}; {'id': '89', 'type': 'comparison_operator', 'children': ['90', '91'], 'value': '=='}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'file_extension'}; {'id': '91', 'type': 'string', 'children': [], 'value': '".rdfa"'}; {'id': '92', 'type': 'block', 'children': ['93']}; {'id': '93', 'type': 'return_statement', 'children': ['94']}; {'id': '94', 'type': 'list', 'children': ['95', '96', '97', '98', '99', '100'], 'value': "[\n 'rdfa',\n 'json-ld',\n 'n3',\n 'nt',\n 'turtle',\n 'xml',\n ]"}; {'id': '95', 'type': 'string', 'children': [], 'value': "'rdfa'"}; {'id': '96', 'type': 'string', 'children': [], 'value': "'json-ld'"}; {'id': '97', 'type': 'string', 'children': [], 'value': "'n3'"}; {'id': '98', 'type': 'string', 'children': [], 'value': "'nt'"}; {'id': '99', 'type': 'string', 'children': [], 'value': "'turtle'"}; {'id': '100', 'type': 'string', 'children': [], 'value': "'xml'"}; {'id': '101', 'type': 'else_clause', 'children': ['102']}; {'id': '102', 'type': 'block', 'children': ['103']}; {'id': '103', 'type': 'return_statement', 'children': ['104']}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'rdf_format_opts_list'} | def try_sort_fmt_opts(rdf_format_opts_list, uri):
filename, file_extension = os.path.splitext(uri)
if file_extension == ".ttl" or file_extension == ".turtle":
return ['turtle', 'n3', 'nt', 'json-ld', 'rdfa', 'xml']
elif file_extension == ".xml" or file_extension == ".rdf":
return ['xml', 'turtle', 'n3', 'nt', 'json-ld', 'rdfa']
elif file_extension == ".nt" or file_extension == ".n3":
return ['n3', 'nt', 'turtle', 'xml', 'json-ld', 'rdfa']
elif file_extension == ".json" or file_extension == ".jsonld":
return [
'json-ld',
'rdfa',
'n3',
'nt',
'turtle',
'xml',
]
elif file_extension == ".rdfa":
return [
'rdfa',
'json-ld',
'n3',
'nt',
'turtle',
'xml',
]
else:
return rdf_format_opts_list |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '5']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'collect_results'}; {'id': '3', 'type': 'parameters', 'children': ['4']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'working_folder'}; {'id': '5', 'type': 'block', 'children': ['6', '10', '17', '23', '102']}; {'id': '6', 'type': 'expression_statement', 'children': ['7']}; {'id': '7', 'type': 'assignment', 'children': ['8', '9']}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '9', 'type': 'dictionary', 'children': []}; {'id': '10', 'type': 'expression_statement', 'children': ['11']}; {'id': '11', 'type': 'assignment', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'working_folder'}; {'id': '13', 'type': 'call', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'Path'}; {'id': '15', 'type': 'argument_list', 'children': ['16']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'working_folder'}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'output_folders'}; {'id': '20', 'type': 'binary_operator', 'children': ['21', '22'], 'value': '/'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'working_folder'}; {'id': '22', 'type': 'string', 'children': [], 'value': "'output_folders'"}; {'id': '23', 'type': 'for_statement', 'children': ['24', '25', '31']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '25', 'type': 'call', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'listdir'}; {'id': '29', 'type': 'argument_list', 'children': ['30']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'output_folders'}; {'id': '31', 'type': 'block', 'children': ['32', '46', '52']}; {'id': '32', 'type': 'if_statement', 'children': ['33', '44']}; {'id': '33', 'type': 'not_operator', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'isdir'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'binary_operator', 'children': ['42', '43'], 'value': '/'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'output_folders'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '44', 'type': 'block', 'children': ['45']}; {'id': '45', 'type': 'continue_statement', 'children': []}; {'id': '46', 'type': 'expression_statement', 'children': ['47']}; {'id': '47', 'type': 'assignment', 'children': ['48', '51']}; {'id': '48', 'type': 'subscript', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '51', 'type': 'dictionary', 'children': []}; {'id': '52', 'type': 'for_statement', 'children': ['53', '54', '62']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'sorter_name'}; {'id': '54', 'type': 'call', 'children': ['55', '58']}; {'id': '55', 'type': 'attribute', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'listdir'}; {'id': '58', 'type': 'argument_list', 'children': ['59']}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '61'], 'value': '/'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'output_folders'}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '62', 'type': 'block', 'children': ['63', '71', '83', '89']}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '66', 'type': 'binary_operator', 'children': ['67', '70'], 'value': '/'}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '69'], 'value': '/'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'output_folders'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'sorter_name'}; {'id': '71', 'type': 'if_statement', 'children': ['72', '81']}; {'id': '72', 'type': 'not_operator', 'children': ['73']}; {'id': '73', 'type': 'call', 'children': ['74', '79']}; {'id': '74', 'type': 'attribute', 'children': ['75', '78']}; {'id': '75', 'type': 'attribute', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'os'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'isdir'}; {'id': '79', 'type': 'argument_list', 'children': ['80']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '81', 'type': 'block', 'children': ['82']}; {'id': '82', 'type': 'continue_statement', 'children': []}; {'id': '83', 'type': 'expression_statement', 'children': ['84']}; {'id': '84', 'type': 'assignment', 'children': ['85', '86']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'SorterClass'}; {'id': '86', 'type': 'subscript', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'sorter_dict'}; {'id': '88', 'type': 'identifier', 'children': [], 'value': 'sorter_name'}; {'id': '89', 'type': 'expression_statement', 'children': ['90']}; {'id': '90', 'type': 'assignment', 'children': ['91', '96']}; {'id': '91', 'type': 'subscript', 'children': ['92', '95']}; {'id': '92', 'type': 'subscript', 'children': ['93', '94']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'results'}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'rec_name'}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'sorter_name'}; {'id': '96', 'type': 'call', 'children': ['97', '100']}; {'id': '97', 'type': 'attribute', 'children': ['98', '99']}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'SorterClass'}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'get_result_from_folder'}; {'id': '100', 'type': 'argument_list', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '102', 'type': 'return_statement', 'children': ['103']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'results'} | def collect_results(working_folder):
results = {}
working_folder = Path(working_folder)
output_folders = working_folder/'output_folders'
for rec_name in os.listdir(output_folders):
if not os.path.isdir(output_folders / rec_name):
continue
results[rec_name] = {}
for sorter_name in os.listdir(output_folders / rec_name):
output_folder = output_folders / rec_name / sorter_name
if not os.path.isdir(output_folder):
continue
SorterClass = sorter_dict[sorter_name]
results[rec_name][sorter_name] = SorterClass.get_result_from_folder(output_folder)
return results |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '23']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'run_sorter'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '12', '15', '18', '21']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'sorter_name_or_class'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'recording'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '8', 'type': 'None', 'children': []}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'delete_output_folder'}; {'id': '11', 'type': 'False', 'children': []}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'grouping_property'}; {'id': '14', 'type': 'None', 'children': []}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'parallel'}; {'id': '17', 'type': 'False', 'children': []}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '20', 'type': 'False', 'children': []}; {'id': '21', 'type': 'dictionary_splat_pattern', 'children': ['22']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '23', 'type': 'block', 'children': ['24', '54', '78', '86', '92', '100']}; {'id': '24', 'type': 'if_statement', 'children': ['25', '30', '37', '46']}; {'id': '25', 'type': 'call', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'isinstance'}; {'id': '27', 'type': 'argument_list', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sorter_name_or_class'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '30', 'type': 'block', 'children': ['31']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'SorterClass'}; {'id': '34', 'type': 'subscript', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'sorter_dict'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'sorter_name_or_class'}; {'id': '37', 'type': 'elif_clause', 'children': ['38', '41']}; {'id': '38', 'type': 'comparison_operator', 'children': ['39', '40'], 'value': 'in'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'sorter_name_or_class'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'sorter_full_list'}; {'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': 'SorterClass'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'sorter_name_or_class'}; {'id': '46', 'type': 'else_clause', 'children': ['47']}; {'id': '47', 'type': 'block', 'children': ['48']}; {'id': '48', 'type': 'raise_statement', 'children': ['49']}; {'id': '49', 'type': '()', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'ValueError'}; {'id': '52', 'type': 'argument_list', 'children': ['53']}; {'id': '53', 'type': 'string', 'children': [], 'value': "'Unknown sorter'"}; {'id': '54', 'type': 'expression_statement', 'children': ['55']}; {'id': '55', 'type': 'assignment', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'sorter'}; {'id': '57', 'type': 'call', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'SorterClass'}; {'id': '59', 'type': 'argument_list', 'children': ['60', '63', '66', '69', '72', '75']}; {'id': '60', 'type': 'keyword_argument', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'recording'}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'recording'}; {'id': '63', 'type': 'keyword_argument', 'children': ['64', '65']}; {'id': '64', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'output_folder'}; {'id': '66', 'type': 'keyword_argument', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'grouping_property'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'grouping_property'}; {'id': '69', 'type': 'keyword_argument', 'children': ['70', '71']}; {'id': '70', 'type': 'identifier', 'children': [], 'value': 'parallel'}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'parallel'}; {'id': '72', 'type': 'keyword_argument', 'children': ['73', '74']}; {'id': '73', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'debug'}; {'id': '75', 'type': 'keyword_argument', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'delete_output_folder'}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'delete_output_folder'}; {'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': 'sorter'}; {'id': '82', 'type': 'identifier', 'children': [], 'value': 'set_params'}; {'id': '83', 'type': 'argument_list', 'children': ['84']}; {'id': '84', 'type': 'dictionary_splat', 'children': ['85']}; {'id': '85', 'type': 'identifier', 'children': [], 'value': 'params'}; {'id': '86', 'type': 'expression_statement', 'children': ['87']}; {'id': '87', 'type': 'call', 'children': ['88', '91']}; {'id': '88', 'type': 'attribute', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'sorter'}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'run'}; {'id': '91', 'type': 'argument_list', 'children': []}; {'id': '92', 'type': 'expression_statement', 'children': ['93']}; {'id': '93', 'type': 'assignment', 'children': ['94', '95']}; {'id': '94', 'type': 'identifier', 'children': [], 'value': 'sortingextractor'}; {'id': '95', 'type': 'call', 'children': ['96', '99']}; {'id': '96', 'type': 'attribute', 'children': ['97', '98']}; {'id': '97', 'type': 'identifier', 'children': [], 'value': 'sorter'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'get_result'}; {'id': '99', 'type': 'argument_list', 'children': []}; {'id': '100', 'type': 'return_statement', 'children': ['101']}; {'id': '101', 'type': 'identifier', 'children': [], 'value': 'sortingextractor'} | def run_sorter(sorter_name_or_class, recording, output_folder=None, delete_output_folder=False,
grouping_property=None, parallel=False, debug=False, **params):
if isinstance(sorter_name_or_class, str):
SorterClass = sorter_dict[sorter_name_or_class]
elif sorter_name_or_class in sorter_full_list:
SorterClass = sorter_name_or_class
else:
raise(ValueError('Unknown sorter'))
sorter = SorterClass(recording=recording, output_folder=output_folder, grouping_property=grouping_property,
parallel=parallel, debug=debug, delete_output_folder=delete_output_folder)
sorter.set_params(**params)
sorter.run()
sortingextractor = sorter.get_result()
return sortingextractor |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'compute_performance'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'SC'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '7', 'type': 'True', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '10', 'type': 'string', 'children': [], 'value': "'dict'"}; {'id': '11', 'type': 'block', 'children': ['12', '18', '33', '48', '63', '78', '93', '106', '117', '128', '139', '150', '184', '202']}; {'id': '12', 'type': 'expression_statement', 'children': ['13']}; {'id': '13', 'type': 'assignment', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'SC'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': '_counts'}; {'id': '18', 'type': 'expression_statement', 'children': ['19']}; {'id': '19', 'type': 'assignment', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '21', 'type': 'binary_operator', 'children': ['22', '32'], 'value': '*'}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '29'], 'value': '/'}; {'id': '23', 'type': 'call', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '25', 'type': 'argument_list', 'children': ['26']}; {'id': '26', 'type': 'subscript', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '28', 'type': 'string', 'children': [], 'value': "'TP'"}; {'id': '29', 'type': 'subscript', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '31', 'type': 'string', 'children': [], 'value': "'TOT_ST1'"}; {'id': '32', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '33', 'type': 'expression_statement', 'children': ['34']}; {'id': '34', 'type': 'assignment', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'cl_rate'}; {'id': '36', 'type': 'binary_operator', 'children': ['37', '47'], 'value': '*'}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '44'], 'value': '/'}; {'id': '38', 'type': 'call', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '40', 'type': 'argument_list', 'children': ['41']}; {'id': '41', 'type': 'subscript', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '43', 'type': 'string', 'children': [], 'value': "'CL'"}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '46', 'type': 'string', 'children': [], 'value': "'TOT_ST1'"}; {'id': '47', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '48', 'type': 'expression_statement', 'children': ['49']}; {'id': '49', 'type': 'assignment', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '51', 'type': 'binary_operator', 'children': ['52', '62'], 'value': '*'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '59'], 'value': '/'}; {'id': '53', 'type': 'call', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '55', 'type': 'argument_list', 'children': ['56']}; {'id': '56', 'type': 'subscript', 'children': ['57', '58']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '58', 'type': 'string', 'children': [], 'value': "'FN'"}; {'id': '59', 'type': 'subscript', 'children': ['60', '61']}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '61', 'type': 'string', 'children': [], 'value': "'TOT_ST1'"}; {'id': '62', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '63', 'type': 'expression_statement', 'children': ['64']}; {'id': '64', 'type': 'assignment', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '66', 'type': 'binary_operator', 'children': ['67', '77'], 'value': '*'}; {'id': '67', 'type': 'binary_operator', 'children': ['68', '74'], 'value': '/'}; {'id': '68', 'type': 'call', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '70', 'type': 'argument_list', 'children': ['71']}; {'id': '71', 'type': 'subscript', 'children': ['72', '73']}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '73', 'type': 'string', 'children': [], 'value': "'FP'"}; {'id': '74', 'type': 'subscript', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '76', 'type': 'string', 'children': [], 'value': "'TOT_ST1'"}; {'id': '77', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'fp_st2'}; {'id': '81', 'type': 'binary_operator', 'children': ['82', '92'], 'value': '*'}; {'id': '82', 'type': 'binary_operator', 'children': ['83', '89'], 'value': '/'}; {'id': '83', 'type': 'call', 'children': ['84', '85']}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'float'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'subscript', 'children': ['87', '88']}; {'id': '87', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '88', 'type': 'string', 'children': [], 'value': "'FP'"}; {'id': '89', 'type': 'subscript', 'children': ['90', '91']}; {'id': '90', 'type': 'identifier', 'children': [], 'value': 'counts'}; {'id': '91', 'type': 'string', 'children': [], 'value': "'TOT_ST2'"}; {'id': '92', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '93', 'type': 'expression_statement', 'children': ['94']}; {'id': '94', 'type': 'assignment', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'accuracy'}; {'id': '96', 'type': 'binary_operator', 'children': ['97', '105'], 'value': '*'}; {'id': '97', 'type': 'binary_operator', 'children': ['98', '99'], 'value': '/'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '99', 'type': '()', 'children': ['100']}; {'id': '100', 'type': 'binary_operator', 'children': ['101', '104'], 'value': '+'}; {'id': '101', 'type': 'binary_operator', 'children': ['102', '103'], 'value': '+'}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '104', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '105', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'sensitivity'}; {'id': '109', 'type': 'binary_operator', 'children': ['110', '116'], 'value': '*'}; {'id': '110', 'type': 'binary_operator', 'children': ['111', '112'], 'value': '/'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '112', 'type': '()', 'children': ['113']}; {'id': '113', 'type': 'binary_operator', 'children': ['114', '115'], 'value': '+'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '116', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '117', 'type': 'expression_statement', 'children': ['118']}; {'id': '118', 'type': 'assignment', 'children': ['119', '120']}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'miss_rate'}; {'id': '120', 'type': 'binary_operator', 'children': ['121', '127'], 'value': '*'}; {'id': '121', 'type': 'binary_operator', 'children': ['122', '123'], 'value': '/'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '123', 'type': '()', 'children': ['124']}; {'id': '124', 'type': 'binary_operator', 'children': ['125', '126'], 'value': '+'}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '127', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '128', 'type': 'expression_statement', 'children': ['129']}; {'id': '129', 'type': 'assignment', 'children': ['130', '131']}; {'id': '130', 'type': 'identifier', 'children': [], 'value': 'precision'}; {'id': '131', 'type': 'binary_operator', 'children': ['132', '138'], 'value': '*'}; {'id': '132', 'type': 'binary_operator', 'children': ['133', '134'], 'value': '/'}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '134', 'type': '()', 'children': ['135']}; {'id': '135', 'type': 'binary_operator', 'children': ['136', '137'], 'value': '+'}; {'id': '136', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '138', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '139', 'type': 'expression_statement', 'children': ['140']}; {'id': '140', 'type': 'assignment', 'children': ['141', '142']}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'false_discovery_rate'}; {'id': '142', 'type': 'binary_operator', 'children': ['143', '149'], 'value': '*'}; {'id': '143', 'type': 'binary_operator', 'children': ['144', '145'], 'value': '/'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '145', 'type': '()', 'children': ['146']}; {'id': '146', 'type': 'binary_operator', 'children': ['147', '148'], 'value': '+'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '149', 'type': 'integer', 'children': [], 'value': '100'}; {'id': '150', 'type': 'expression_statement', 'children': ['151']}; {'id': '151', 'type': 'assignment', 'children': ['152', '153']}; {'id': '152', 'type': 'identifier', 'children': [], 'value': 'performance'}; {'id': '153', 'type': 'dictionary', 'children': ['154', '157', '160', '163', '166', '169', '172', '175', '178', '181']}; {'id': '154', 'type': 'pair', 'children': ['155', '156']}; {'id': '155', 'type': 'string', 'children': [], 'value': "'tp'"}; {'id': '156', 'type': 'identifier', 'children': [], 'value': 'tp_rate'}; {'id': '157', 'type': 'pair', 'children': ['158', '159']}; {'id': '158', 'type': 'string', 'children': [], 'value': "'cl'"}; {'id': '159', 'type': 'identifier', 'children': [], 'value': 'cl_rate'}; {'id': '160', 'type': 'pair', 'children': ['161', '162']}; {'id': '161', 'type': 'string', 'children': [], 'value': "'fn'"}; {'id': '162', 'type': 'identifier', 'children': [], 'value': 'fn_rate'}; {'id': '163', 'type': 'pair', 'children': ['164', '165']}; {'id': '164', 'type': 'string', 'children': [], 'value': "'fp_st1'"}; {'id': '165', 'type': 'identifier', 'children': [], 'value': 'fp_st1'}; {'id': '166', 'type': 'pair', 'children': ['167', '168']}; {'id': '167', 'type': 'string', 'children': [], 'value': "'fp_st2'"}; {'id': '168', 'type': 'identifier', 'children': [], 'value': 'fp_st2'}; {'id': '169', 'type': 'pair', 'children': ['170', '171']}; {'id': '170', 'type': 'string', 'children': [], 'value': "'accuracy'"}; {'id': '171', 'type': 'identifier', 'children': [], 'value': 'accuracy'}; {'id': '172', 'type': 'pair', 'children': ['173', '174']}; {'id': '173', 'type': 'string', 'children': [], 'value': "'sensitivity'"}; {'id': '174', 'type': 'identifier', 'children': [], 'value': 'sensitivity'}; {'id': '175', 'type': 'pair', 'children': ['176', '177']}; {'id': '176', 'type': 'string', 'children': [], 'value': "'precision'"}; {'id': '177', 'type': 'identifier', 'children': [], 'value': 'precision'}; {'id': '178', 'type': 'pair', 'children': ['179', '180']}; {'id': '179', 'type': 'string', 'children': [], 'value': "'miss_rate'"}; {'id': '180', 'type': 'identifier', 'children': [], 'value': 'miss_rate'}; {'id': '181', 'type': 'pair', 'children': ['182', '183']}; {'id': '182', 'type': 'string', 'children': [], 'value': "'false_disc_rate'"}; {'id': '183', 'type': 'identifier', 'children': [], 'value': 'false_discovery_rate'}; {'id': '184', 'type': 'if_statement', 'children': ['185', '186']}; {'id': '185', 'type': 'identifier', 'children': [], 'value': 'verbose'}; {'id': '186', 'type': 'block', 'children': ['187', '197']}; {'id': '187', 'type': 'expression_statement', 'children': ['188']}; {'id': '188', 'type': 'assignment', 'children': ['189', '190']}; {'id': '189', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '190', 'type': 'call', 'children': ['191', '194']}; {'id': '191', 'type': 'attribute', 'children': ['192', '193']}; {'id': '192', 'type': 'identifier', 'children': [], 'value': '_txt_performance'}; {'id': '193', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '194', 'type': 'argument_list', 'children': ['195']}; {'id': '195', 'type': 'dictionary_splat', 'children': ['196']}; {'id': '196', 'type': 'identifier', 'children': [], 'value': 'performance'}; {'id': '197', 'type': 'expression_statement', 'children': ['198']}; {'id': '198', 'type': 'call', 'children': ['199', '200']}; {'id': '199', 'type': 'identifier', 'children': [], 'value': 'print'}; {'id': '200', 'type': 'argument_list', 'children': ['201']}; {'id': '201', 'type': 'identifier', 'children': [], 'value': 'txt'}; {'id': '202', 'type': 'if_statement', 'children': ['203', '206', '209']}; {'id': '203', 'type': 'comparison_operator', 'children': ['204', '205'], 'value': '=='}; {'id': '204', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '205', 'type': 'string', 'children': [], 'value': "'dict'"}; {'id': '206', 'type': 'block', 'children': ['207']}; {'id': '207', 'type': 'return_statement', 'children': ['208']}; {'id': '208', 'type': 'identifier', 'children': [], 'value': 'performance'}; {'id': '209', 'type': 'elif_clause', 'children': ['210', '213']}; {'id': '210', 'type': 'comparison_operator', 'children': ['211', '212'], 'value': '=='}; {'id': '211', 'type': 'identifier', 'children': [], 'value': 'output'}; {'id': '212', 'type': 'string', 'children': [], 'value': "'pandas'"}; {'id': '213', 'type': 'block', 'children': ['214']}; {'id': '214', 'type': 'return_statement', 'children': ['215']}; {'id': '215', 'type': 'call', 'children': ['216', '219']}; {'id': '216', 'type': 'attribute', 'children': ['217', '218']}; {'id': '217', 'type': 'identifier', 'children': [], 'value': 'pd'}; {'id': '218', 'type': 'identifier', 'children': [], 'value': 'Series'}; {'id': '219', 'type': 'argument_list', 'children': ['220']}; {'id': '220', 'type': 'identifier', 'children': [], 'value': 'performance'} | def compute_performance(SC, verbose=True, output='dict'):
counts = SC._counts
tp_rate = float(counts['TP']) / counts['TOT_ST1'] * 100
cl_rate = float(counts['CL']) / counts['TOT_ST1'] * 100
fn_rate = float(counts['FN']) / counts['TOT_ST1'] * 100
fp_st1 = float(counts['FP']) / counts['TOT_ST1'] * 100
fp_st2 = float(counts['FP']) / counts['TOT_ST2'] * 100
accuracy = tp_rate / (tp_rate + fn_rate + fp_st1) * 100
sensitivity = tp_rate / (tp_rate + fn_rate) * 100
miss_rate = fn_rate / (tp_rate + fn_rate) * 100
precision = tp_rate / (tp_rate + fp_st1) * 100
false_discovery_rate = fp_st1 / (tp_rate + fp_st1) * 100
performance = {'tp': tp_rate, 'cl': cl_rate, 'fn': fn_rate, 'fp_st1': fp_st1, 'fp_st2': fp_st2,
'accuracy': accuracy, 'sensitivity': sensitivity, 'precision': precision, 'miss_rate': miss_rate,
'false_disc_rate': false_discovery_rate}
if verbose:
txt = _txt_performance.format(**performance)
print(txt)
if output == 'dict':
return performance
elif output == 'pandas':
return pd.Series(performance) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '12']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'add_color_stop_rgba'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7', '8', '9']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'red'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'green'}; {'id': '8', 'type': 'identifier', 'children': [], 'value': 'blue'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'block', 'children': ['13', '27']}; {'id': '13', 'type': 'expression_statement', 'children': ['14']}; {'id': '14', 'type': 'call', 'children': ['15', '18']}; {'id': '15', 'type': 'attribute', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'cairo'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'cairo_pattern_add_color_stop_rgba'}; {'id': '18', 'type': 'argument_list', 'children': ['19', '22', '23', '24', '25', '26']}; {'id': '19', 'type': 'attribute', 'children': ['20', '21']}; {'id': '20', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '21', 'type': 'identifier', 'children': [], 'value': '_pointer'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'offset'}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'red'}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'green'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'blue'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'alpha'}; {'id': '27', 'type': 'expression_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '32']}; {'id': '29', 'type': 'attribute', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '31', 'type': 'identifier', 'children': [], 'value': '_check_status'}; {'id': '32', 'type': 'argument_list', 'children': []} | def add_color_stop_rgba(self, offset, red, green, blue, alpha=1):
cairo.cairo_pattern_add_color_stop_rgba(
self._pointer, offset, red, green, blue, alpha)
self._check_status() |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_all'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18', '21', '24']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'block', 'children': ['28']}; {'id': '28', 'type': 'return_statement', 'children': ['29']}; {'id': '29', 'type': 'call', 'children': ['30', '35']}; {'id': '30', 'type': 'attribute', 'children': ['31', '34']}; {'id': '31', 'type': 'attribute', 'children': ['32', '33']}; {'id': '32', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '35', 'type': 'argument_list', 'children': ['36', '37', '38', '41', '44', '47', '50']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '38', 'type': 'keyword_argument', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'view'} | def get_all(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_appliances'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18', '21', '24']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'block', 'children': ['28', '36']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '35'], 'value': '+'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'URI'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'/image-streamer-appliances'"}; {'id': '36', 'type': 'return_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': '_client'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '43', 'type': 'argument_list', 'children': ['44', '45', '46', '49', '52', '55', '58', '61']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '46', 'type': 'keyword_argument', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '49', 'type': 'keyword_argument', 'children': ['50', '51']}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '52', 'type': 'keyword_argument', 'children': ['53', '54']}; {'id': '53', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '55', 'type': 'keyword_argument', 'children': ['56', '57']}; {'id': '56', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '58', 'type': 'keyword_argument', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '61', 'type': 'keyword_argument', 'children': ['62', '63']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'uri'} | def get_appliances(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
uri = self.URI + '/image-streamer-appliances'
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view,
uri=uri) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '15']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_all'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'block', 'children': ['16']}; {'id': '16', 'type': 'return_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': '_helper'}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '23', 'type': 'argument_list', 'children': ['24', '25', '26']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '26', 'type': 'keyword_argument', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'sort'} | def get_all(self, start=0, count=-1, sort=''):
return self._helper.get_all(start, count, sort=sort) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_endpoints'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'block', 'children': ['19', '32']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '22', 'type': 'call', 'children': ['23', '26']}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'string', 'children': [], 'value': '"{}/endpoints/"'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '26', 'type': 'argument_list', 'children': ['27']}; {'id': '27', 'type': 'subscript', 'children': ['28', '31']}; {'id': '28', 'type': 'attribute', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'data'}; {'id': '31', 'type': 'string', 'children': [], 'value': '"uri"'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '39']}; {'id': '34', 'type': 'attribute', 'children': ['35', '38']}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': '_helper'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '39', 'type': 'argument_list', 'children': ['40', '41', '42', '45', '48']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '48', 'type': 'keyword_argument', 'children': ['49', '50']}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '50', 'type': 'identifier', 'children': [], 'value': 'uri'} | def get_endpoints(self, start=0, count=-1, filter='', sort=''):
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.get_all(start, count, filter=filter, sort=sort, uri=uri) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '8']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': '__findFirstMissing'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '7']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '8', 'type': 'block', 'children': ['9', '19', '29', '41', '60']}; {'id': '9', 'type': 'if_statement', 'children': ['10', '14']}; {'id': '10', 'type': '()', 'children': ['11']}; {'id': '11', 'type': 'comparison_operator', 'children': ['12', '13'], 'value': '>'}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '14', 'type': 'block', 'children': ['15']}; {'id': '15', 'type': 'return_statement', 'children': ['16']}; {'id': '16', 'type': 'binary_operator', 'children': ['17', '18'], 'value': '+'}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '18', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '19', 'type': 'if_statement', 'children': ['20', '26']}; {'id': '20', 'type': '()', 'children': ['21']}; {'id': '21', 'type': 'comparison_operator', 'children': ['22', '23'], 'value': '!='}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '23', 'type': 'subscript', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '26', 'type': 'block', 'children': ['27']}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '29', 'type': 'expression_statement', 'children': ['30']}; {'id': '30', 'type': 'assignment', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'mid'}; {'id': '32', 'type': 'call', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'int'}; {'id': '34', 'type': 'argument_list', 'children': ['35']}; {'id': '35', 'type': 'binary_operator', 'children': ['36', '40'], 'value': '/'}; {'id': '36', 'type': '()', 'children': ['37']}; {'id': '37', 'type': 'binary_operator', 'children': ['38', '39'], 'value': '+'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '40', 'type': 'integer', 'children': [], 'value': '2'}; {'id': '41', 'type': 'if_statement', 'children': ['42', '48']}; {'id': '42', 'type': '()', 'children': ['43']}; {'id': '43', 'type': 'comparison_operator', 'children': ['44', '47'], 'value': '=='}; {'id': '44', 'type': 'subscript', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'mid'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'mid'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'return_statement', 'children': ['50']}; {'id': '50', 'type': 'call', 'children': ['51', '54']}; {'id': '51', 'type': 'attribute', 'children': ['52', '53']}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '53', 'type': 'identifier', 'children': [], 'value': '__findFirstMissing'}; {'id': '54', 'type': 'argument_list', 'children': ['55', '56', '59']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '56', 'type': 'binary_operator', 'children': ['57', '58'], 'value': '+'}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'mid'}; {'id': '58', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'end'}; {'id': '60', 'type': 'return_statement', 'children': ['61']}; {'id': '61', 'type': 'call', 'children': ['62', '65']}; {'id': '62', 'type': 'attribute', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '64', 'type': 'identifier', 'children': [], 'value': '__findFirstMissing'}; {'id': '65', 'type': 'argument_list', 'children': ['66', '67', '68']}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'array'}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'mid'} | def __findFirstMissing(self, array, start, end):
if (start > end):
return end + 1
if (start != array[start]):
return start
mid = int((start + end) / 2)
if (array[mid] == mid):
return self.__findFirstMissing(array, mid + 1, end)
return self.__findFirstMissing(array, start, mid) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '30']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_reachable_storage_pools'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18', '21', '24', '27']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'networks'}; {'id': '23', 'type': 'None', 'children': []}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'scope_exclusions'}; {'id': '26', 'type': 'None', 'children': []}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '29', 'type': 'string', 'children': [], 'value': "''"}; {'id': '30', 'type': 'block', 'children': ['31', '39', '75', '109']}; {'id': '31', 'type': 'expression_statement', 'children': ['32']}; {'id': '32', 'type': 'assignment', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '34', 'type': 'binary_operator', 'children': ['35', '38'], 'value': '+'}; {'id': '35', 'type': 'attribute', 'children': ['36', '37']}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'URI'}; {'id': '38', 'type': 'string', 'children': [], 'value': '"/reachable-storage-pools"'}; {'id': '39', 'type': 'if_statement', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'networks'}; {'id': '41', 'type': 'block', 'children': ['42', '46', '56', '67']}; {'id': '42', 'type': 'expression_statement', 'children': ['43']}; {'id': '43', 'type': 'assignment', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '45', 'type': 'string', 'children': [], 'value': '"\\\'"'}; {'id': '46', 'type': 'for_statement', 'children': ['47', '48', '49']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'networks'}; {'id': '49', 'type': 'block', 'children': ['50']}; {'id': '50', 'type': 'expression_statement', 'children': ['51']}; {'id': '51', 'type': 'augmented_assignment', 'children': ['52', '53'], 'value': '+='}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '53', 'type': 'binary_operator', 'children': ['54', '55'], 'value': '+'}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'n'}; {'id': '55', 'type': 'string', 'children': [], 'value': "','"}; {'id': '56', 'type': 'expression_statement', 'children': ['57']}; {'id': '57', 'type': 'assignment', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '59', 'type': 'binary_operator', 'children': ['60', '66'], 'value': '+'}; {'id': '60', 'type': 'subscript', 'children': ['61', '62']}; {'id': '61', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '62', 'type': 'slice', 'children': ['63', '64']}; {'id': '63', 'type': 'colon', 'children': []}; {'id': '64', 'type': 'unary_operator', 'children': ['65'], 'value': '-'}; {'id': '65', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '66', 'type': 'string', 'children': [], 'value': '"\\\'"'}; {'id': '67', 'type': 'expression_statement', 'children': ['68']}; {'id': '68', 'type': 'assignment', 'children': ['69', '70']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '70', 'type': 'binary_operator', 'children': ['71', '74'], 'value': '+'}; {'id': '71', 'type': 'binary_operator', 'children': ['72', '73'], 'value': '+'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '73', 'type': 'string', 'children': [], 'value': '"?networks="'}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'elements'}; {'id': '75', 'type': 'if_statement', 'children': ['76', '77']}; {'id': '76', 'type': 'identifier', 'children': [], 'value': 'scope_exclusions'}; {'id': '77', 'type': 'block', 'children': ['78', '87', '100']}; {'id': '78', 'type': 'expression_statement', 'children': ['79']}; {'id': '79', 'type': 'assignment', 'children': ['80', '81']}; {'id': '80', 'type': 'identifier', 'children': [], 'value': 'storage_pools_uris'}; {'id': '81', 'type': 'call', 'children': ['82', '85']}; {'id': '82', 'type': 'attribute', 'children': ['83', '84']}; {'id': '83', 'type': 'string', 'children': [], 'value': '","'}; {'id': '84', 'type': 'identifier', 'children': [], 'value': 'join'}; {'id': '85', 'type': 'argument_list', 'children': ['86']}; {'id': '86', 'type': 'identifier', 'children': [], 'value': 'scope_exclusions'}; {'id': '87', 'type': 'expression_statement', 'children': ['88']}; {'id': '88', 'type': 'assignment', 'children': ['89', '90']}; {'id': '89', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '90', 'type': 'conditional_expression', 'children': ['91', '94', '97'], 'value': 'if'}; {'id': '91', 'type': 'binary_operator', 'children': ['92', '93'], 'value': '+'}; {'id': '92', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '93', 'type': 'string', 'children': [], 'value': '"?"'}; {'id': '94', 'type': 'comparison_operator', 'children': ['95', '96'], 'value': 'not'}; {'id': '95', 'type': 'string', 'children': [], 'value': '"?"'}; {'id': '96', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '97', 'type': 'binary_operator', 'children': ['98', '99'], 'value': '+'}; {'id': '98', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '99', 'type': 'string', 'children': [], 'value': '"&"'}; {'id': '100', 'type': 'expression_statement', 'children': ['101']}; {'id': '101', 'type': 'augmented_assignment', 'children': ['102', '103'], 'value': '+='}; {'id': '102', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '103', 'type': 'call', 'children': ['104', '107']}; {'id': '104', 'type': 'attribute', 'children': ['105', '106']}; {'id': '105', 'type': 'string', 'children': [], 'value': '"scopeExclusions={}"'}; {'id': '106', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '107', 'type': 'argument_list', 'children': ['108']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'storage_pools_uris'}; {'id': '109', 'type': 'return_statement', 'children': ['110']}; {'id': '110', 'type': 'call', 'children': ['111', '116']}; {'id': '111', 'type': 'attribute', 'children': ['112', '115']}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '115', 'type': 'identifier', 'children': [], 'value': 'get'}; {'id': '116', 'type': 'argument_list', 'children': ['117']}; {'id': '117', 'type': 'call', 'children': ['118', '123']}; {'id': '118', 'type': 'attribute', 'children': ['119', '122']}; {'id': '119', 'type': 'attribute', 'children': ['120', '121']}; {'id': '120', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '121', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '122', 'type': 'identifier', 'children': [], 'value': 'build_query_uri'}; {'id': '123', 'type': 'argument_list', 'children': ['124', '127', '130', '133', '136', '139', '142']}; {'id': '124', 'type': 'keyword_argument', 'children': ['125', '126']}; {'id': '125', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '126', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '127', 'type': 'keyword_argument', 'children': ['128', '129']}; {'id': '128', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '130', 'type': 'keyword_argument', 'children': ['131', '132']}; {'id': '131', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '132', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '133', 'type': 'keyword_argument', 'children': ['134', '135']}; {'id': '134', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '135', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '136', 'type': 'keyword_argument', 'children': ['137', '138']}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '138', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '139', 'type': 'keyword_argument', 'children': ['140', '141']}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '142', 'type': 'keyword_argument', 'children': ['143', '144']}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'scope_uris'} | def get_reachable_storage_pools(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_exclusions=None, scope_uris=''):
uri = self.URI + "/reachable-storage-pools"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
if scope_exclusions:
storage_pools_uris = ",".join(scope_exclusions)
uri = uri + "?" if "?" not in uri else uri + "&"
uri += "scopeExclusions={}".format(storage_pools_uris)
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri, scope_uris=scope_uris)) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '19']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_snapshots'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '6', '9', '13', '16']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'identifier', 'children': [], 'value': 'volume_id_or_uri'}; {'id': '6', 'type': 'default_parameter', 'children': ['7', '8']}; {'id': '7', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '8', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '9', 'type': 'default_parameter', 'children': ['10', '11']}; {'id': '10', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '11', 'type': 'unary_operator', 'children': ['12'], 'value': '-'}; {'id': '12', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '13', 'type': 'default_parameter', 'children': ['14', '15']}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '15', 'type': 'string', 'children': [], 'value': "''"}; {'id': '16', 'type': 'default_parameter', 'children': ['17', '18']}; {'id': '17', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '18', 'type': 'string', 'children': [], 'value': "''"}; {'id': '19', 'type': 'block', 'children': ['20', '29']}; {'id': '20', 'type': 'expression_statement', 'children': ['21']}; {'id': '21', 'type': 'assignment', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '23', 'type': 'call', 'children': ['24', '27']}; {'id': '24', 'type': 'attribute', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '26', 'type': 'identifier', 'children': [], 'value': '__build_volume_snapshot_uri'}; {'id': '27', 'type': 'argument_list', 'children': ['28']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'volume_id_or_uri'}; {'id': '29', 'type': 'return_statement', 'children': ['30']}; {'id': '30', 'type': 'call', 'children': ['31', '36']}; {'id': '31', 'type': 'attribute', 'children': ['32', '35']}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '36', 'type': 'argument_list', 'children': ['37', '38', '39', '42', '45']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '42', 'type': 'keyword_argument', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '45', 'type': 'keyword_argument', 'children': ['46', '47']}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'uri'} | def get_snapshots(self, volume_id_or_uri, start=0, count=-1, filter='', sort=''):
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_extra_managed_storage_volume_paths'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'block', 'children': ['19', '27']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '22', 'type': 'binary_operator', 'children': ['23', '26'], 'value': '+'}; {'id': '23', 'type': 'attribute', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'URI'}; {'id': '26', 'type': 'string', 'children': [], 'value': "'/repair?alertFixType=ExtraManagedStorageVolumePaths'"}; {'id': '27', 'type': 'return_statement', 'children': ['28']}; {'id': '28', 'type': 'call', 'children': ['29', '34']}; {'id': '29', 'type': 'attribute', 'children': ['30', '33']}; {'id': '30', 'type': 'attribute', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '32', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36', '37', '40', '43']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '43', 'type': 'keyword_argument', 'children': ['44', '45']}; {'id': '44', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'uri'} | def get_extra_managed_storage_volume_paths(self, start=0, count=-1, filter='', sort=''):
uri = self.URI + '/repair?alertFixType=ExtraManagedStorageVolumePaths'
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '27']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_attachable_volumes'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18', '21', '24']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'connections'}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'block', 'children': ['28', '36', '54']}; {'id': '28', 'type': 'expression_statement', 'children': ['29']}; {'id': '29', 'type': 'assignment', 'children': ['30', '31']}; {'id': '30', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '31', 'type': 'binary_operator', 'children': ['32', '35'], 'value': '+'}; {'id': '32', 'type': 'attribute', 'children': ['33', '34']}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '34', 'type': 'identifier', 'children': [], 'value': 'URI'}; {'id': '35', 'type': 'string', 'children': [], 'value': "'/attachable-volumes'"}; {'id': '36', 'type': 'if_statement', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'connections'}; {'id': '38', 'type': 'block', 'children': ['39']}; {'id': '39', 'type': 'expression_statement', 'children': ['40']}; {'id': '40', 'type': 'augmented_assignment', 'children': ['41', '42'], 'value': '+='}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '42', 'type': 'call', 'children': ['43', '44']}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'str'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'binary_operator', 'children': ['46', '49'], 'value': '+'}; {'id': '46', 'type': 'binary_operator', 'children': ['47', '48'], 'value': '+'}; {'id': '47', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '48', 'type': 'string', 'children': [], 'value': "'connections='"}; {'id': '49', 'type': 'call', 'children': ['50', '53']}; {'id': '50', 'type': 'attribute', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'connections'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': '__str__'}; {'id': '53', 'type': 'argument_list', 'children': []}; {'id': '54', 'type': 'return_statement', 'children': ['55']}; {'id': '55', 'type': 'call', 'children': ['56', '61']}; {'id': '56', 'type': 'attribute', 'children': ['57', '60']}; {'id': '57', 'type': 'attribute', 'children': ['58', '59']}; {'id': '58', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '59', 'type': 'identifier', 'children': [], 'value': '_client'}; {'id': '60', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '61', 'type': 'argument_list', 'children': ['62', '63', '64', '67', '70', '73', '76']}; {'id': '62', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '64', 'type': 'keyword_argument', 'children': ['65', '66']}; {'id': '65', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '66', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '67', 'type': 'keyword_argument', 'children': ['68', '69']}; {'id': '68', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '70', 'type': 'keyword_argument', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '72', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '73', 'type': 'keyword_argument', 'children': ['74', '75']}; {'id': '74', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '76', 'type': 'keyword_argument', 'children': ['77', '78']}; {'id': '77', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '78', 'type': 'identifier', 'children': [], 'value': 'scope_uris'} | def get_attachable_volumes(self, start=0, count=-1, filter='', query='', sort='', scope_uris='', connections=''):
uri = self.URI + '/attachable-volumes'
if connections:
uri += str('?' + 'connections=' + connections.__str__())
return self._client.get_all(start, count, filter=filter, query=query, sort=sort, uri=uri, scope_uris=scope_uris) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '20']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_available_storage_systems'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'dictionary_splat_pattern', 'children': ['19']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '20', 'type': 'block', 'children': ['21', '33']}; {'id': '21', 'type': 'expression_statement', 'children': ['22']}; {'id': '22', 'type': 'assignment', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '24', 'type': 'call', 'children': ['25', '30']}; {'id': '25', 'type': 'attribute', 'children': ['26', '29']}; {'id': '26', 'type': 'attribute', 'children': ['27', '28']}; {'id': '27', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '28', 'type': 'identifier', 'children': [], 'value': '_helper'}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'build_uri_with_query_string'}; {'id': '30', 'type': 'argument_list', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'kwargs'}; {'id': '32', 'type': 'string', 'children': [], 'value': "'/available-storage-systems'"}; {'id': '33', 'type': 'return_statement', 'children': ['34']}; {'id': '34', 'type': 'call', 'children': ['35', '40']}; {'id': '35', 'type': 'attribute', 'children': ['36', '39']}; {'id': '36', 'type': 'attribute', 'children': ['37', '38']}; {'id': '37', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '38', 'type': 'identifier', 'children': [], 'value': '_helper'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '40', 'type': 'argument_list', 'children': ['41', '44', '47', '50', '53']}; {'id': '41', 'type': 'keyword_argument', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '44', 'type': 'keyword_argument', 'children': ['45', '46']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '46', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '47', 'type': 'keyword_argument', 'children': ['48', '49']}; {'id': '48', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '49', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '50', 'type': 'keyword_argument', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '52', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '53', 'type': 'keyword_argument', 'children': ['54', '55']}; {'id': '54', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'uri'} | def get_available_storage_systems(self, start=0, count=-1, filter='', sort='', **kwargs):
uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-systems')
return self._helper.get_all(start=start, count=count, filter=filter, sort=sort, uri=uri) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_query_uri'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '11', '15', '18', '21', '24', '27', '30']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '10', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '11', 'type': 'default_parameter', 'children': ['12', '13']}; {'id': '12', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '13', 'type': 'unary_operator', 'children': ['14'], 'value': '-'}; {'id': '14', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '29', 'type': 'string', 'children': [], 'value': "''"}; {'id': '30', 'type': 'default_parameter', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '32', 'type': 'string', 'children': [], 'value': "''"}; {'id': '33', 'type': 'block', 'children': ['34', '46', '58', '70', '82', '94', '106', '115', '122', '131', '149']}; {'id': '34', 'type': 'if_statement', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': 'make_query_filter'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '54'], 'value': '+'}; {'id': '53', 'type': 'string', 'children': [], 'value': '"&query="'}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '58', 'type': 'if_statement', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '64', 'type': 'binary_operator', 'children': ['65', '66'], 'value': '+'}; {'id': '65', 'type': 'string', 'children': [], 'value': '"&sort="'}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '70', 'type': 'if_statement', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '+'}; {'id': '77', 'type': 'string', 'children': [], 'value': '"&view="'}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '82', 'type': 'if_statement', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'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': 'fields'}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '90'], 'value': '+'}; {'id': '89', 'type': 'string', 'children': [], 'value': '"&fields="'}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '94', 'type': 'if_statement', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '96', 'type': 'block', 'children': ['97']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '100', 'type': 'binary_operator', 'children': ['101', '102'], 'value': '+'}; {'id': '101', 'type': 'string', 'children': [], 'value': '"&scopeUris="'}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '109', 'type': 'conditional_expression', 'children': ['110', '111', '112'], 'value': 'if'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': '_base_uri'}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'call', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': 'validate_resource_uri'}; {'id': '120', 'type': 'argument_list', 'children': ['121']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'symbol'}; {'id': '125', 'type': 'conditional_expression', 'children': ['126', '127', '130'], 'value': 'if'}; {'id': '126', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '127', 'type': 'comparison_operator', 'children': ['128', '129'], 'value': 'not'}; {'id': '128', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '130', 'type': 'string', 'children': [], 'value': "'&'"}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'assignment', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '134', 'type': 'call', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'string', 'children': [], 'value': '"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}"'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '138', 'type': 'argument_list', 'children': ['139', '140', '141', '142', '143', '144', '145', '146', '147', '148']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'symbol'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '149', 'type': 'return_statement', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'uri'} | def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''):
if filter:
filter = self.make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._base_uri
self.validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '33']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'build_query_uri'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15', '18', '21', '24', '27', '30']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'default_parameter', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '20', 'type': 'string', 'children': [], 'value': "''"}; {'id': '21', 'type': 'default_parameter', 'children': ['22', '23']}; {'id': '22', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '23', 'type': 'string', 'children': [], 'value': "''"}; {'id': '24', 'type': 'default_parameter', 'children': ['25', '26']}; {'id': '25', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '26', 'type': 'string', 'children': [], 'value': "''"}; {'id': '27', 'type': 'default_parameter', 'children': ['28', '29']}; {'id': '28', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '29', 'type': 'None', 'children': []}; {'id': '30', 'type': 'default_parameter', 'children': ['31', '32']}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '32', 'type': 'string', 'children': [], 'value': "''"}; {'id': '33', 'type': 'block', 'children': ['34', '46', '58', '70', '82', '94', '106', '115', '122', '131', '149']}; {'id': '34', 'type': 'if_statement', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '36', 'type': 'block', 'children': ['37']}; {'id': '37', 'type': 'expression_statement', 'children': ['38']}; {'id': '38', 'type': 'assignment', 'children': ['39', '40']}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '40', 'type': 'call', 'children': ['41', '44']}; {'id': '41', 'type': 'attribute', 'children': ['42', '43']}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '43', 'type': 'identifier', 'children': [], 'value': '__make_query_filter'}; {'id': '44', 'type': 'argument_list', 'children': ['45']}; {'id': '45', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '46', 'type': 'if_statement', 'children': ['47', '48']}; {'id': '47', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '48', 'type': 'block', 'children': ['49']}; {'id': '49', 'type': 'expression_statement', 'children': ['50']}; {'id': '50', 'type': 'assignment', 'children': ['51', '52']}; {'id': '51', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '52', 'type': 'binary_operator', 'children': ['53', '54'], 'value': '+'}; {'id': '53', 'type': 'string', 'children': [], 'value': '"&query="'}; {'id': '54', 'type': 'call', 'children': ['55', '56']}; {'id': '55', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '56', 'type': 'argument_list', 'children': ['57']}; {'id': '57', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '58', 'type': 'if_statement', 'children': ['59', '60']}; {'id': '59', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '60', 'type': 'block', 'children': ['61']}; {'id': '61', 'type': 'expression_statement', 'children': ['62']}; {'id': '62', 'type': 'assignment', 'children': ['63', '64']}; {'id': '63', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '64', 'type': 'binary_operator', 'children': ['65', '66'], 'value': '+'}; {'id': '65', 'type': 'string', 'children': [], 'value': '"&sort="'}; {'id': '66', 'type': 'call', 'children': ['67', '68']}; {'id': '67', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '68', 'type': 'argument_list', 'children': ['69']}; {'id': '69', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '70', 'type': 'if_statement', 'children': ['71', '72']}; {'id': '71', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '72', 'type': 'block', 'children': ['73']}; {'id': '73', 'type': 'expression_statement', 'children': ['74']}; {'id': '74', 'type': 'assignment', 'children': ['75', '76']}; {'id': '75', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '76', 'type': 'binary_operator', 'children': ['77', '78'], 'value': '+'}; {'id': '77', 'type': 'string', 'children': [], 'value': '"&view="'}; {'id': '78', 'type': 'call', 'children': ['79', '80']}; {'id': '79', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '80', 'type': 'argument_list', 'children': ['81']}; {'id': '81', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '82', 'type': 'if_statement', 'children': ['83', '84']}; {'id': '83', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'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': 'fields'}; {'id': '88', 'type': 'binary_operator', 'children': ['89', '90'], 'value': '+'}; {'id': '89', 'type': 'string', 'children': [], 'value': '"&fields="'}; {'id': '90', 'type': 'call', 'children': ['91', '92']}; {'id': '91', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '92', 'type': 'argument_list', 'children': ['93']}; {'id': '93', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '94', 'type': 'if_statement', 'children': ['95', '96']}; {'id': '95', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '96', 'type': 'block', 'children': ['97']}; {'id': '97', 'type': 'expression_statement', 'children': ['98']}; {'id': '98', 'type': 'assignment', 'children': ['99', '100']}; {'id': '99', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '100', 'type': 'binary_operator', 'children': ['101', '102'], 'value': '+'}; {'id': '101', 'type': 'string', 'children': [], 'value': '"&scopeUris="'}; {'id': '102', 'type': 'call', 'children': ['103', '104']}; {'id': '103', 'type': 'identifier', 'children': [], 'value': 'quote'}; {'id': '104', 'type': 'argument_list', 'children': ['105']}; {'id': '105', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '106', 'type': 'expression_statement', 'children': ['107']}; {'id': '107', 'type': 'assignment', 'children': ['108', '109']}; {'id': '108', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '109', 'type': 'conditional_expression', 'children': ['110', '111', '112'], 'value': 'if'}; {'id': '110', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '111', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '112', 'type': 'attribute', 'children': ['113', '114']}; {'id': '113', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '114', 'type': 'identifier', 'children': [], 'value': '_uri'}; {'id': '115', 'type': 'expression_statement', 'children': ['116']}; {'id': '116', 'type': 'call', 'children': ['117', '120']}; {'id': '117', 'type': 'attribute', 'children': ['118', '119']}; {'id': '118', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '119', 'type': 'identifier', 'children': [], 'value': '__validate_resource_uri'}; {'id': '120', 'type': 'argument_list', 'children': ['121']}; {'id': '121', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '122', 'type': 'expression_statement', 'children': ['123']}; {'id': '123', 'type': 'assignment', 'children': ['124', '125']}; {'id': '124', 'type': 'identifier', 'children': [], 'value': 'symbol'}; {'id': '125', 'type': 'conditional_expression', 'children': ['126', '127', '130'], 'value': 'if'}; {'id': '126', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '127', 'type': 'comparison_operator', 'children': ['128', '129'], 'value': 'not'}; {'id': '128', 'type': 'string', 'children': [], 'value': "'?'"}; {'id': '129', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '130', 'type': 'string', 'children': [], 'value': "'&'"}; {'id': '131', 'type': 'expression_statement', 'children': ['132']}; {'id': '132', 'type': 'assignment', 'children': ['133', '134']}; {'id': '133', 'type': 'identifier', 'children': [], 'value': 'uri'}; {'id': '134', 'type': 'call', 'children': ['135', '138']}; {'id': '135', 'type': 'attribute', 'children': ['136', '137']}; {'id': '136', 'type': 'string', 'children': [], 'value': '"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}"'}; {'id': '137', 'type': 'identifier', 'children': [], 'value': 'format'}; {'id': '138', 'type': 'argument_list', 'children': ['139', '140', '141', '142', '143', '144', '145', '146', '147', '148']}; {'id': '139', 'type': 'identifier', 'children': [], 'value': 'path'}; {'id': '140', 'type': 'identifier', 'children': [], 'value': 'symbol'}; {'id': '141', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '142', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '143', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '144', 'type': 'identifier', 'children': [], 'value': 'query'}; {'id': '145', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '146', 'type': 'identifier', 'children': [], 'value': 'view'}; {'id': '147', 'type': 'identifier', 'children': [], 'value': 'fields'}; {'id': '148', 'type': 'identifier', 'children': [], 'value': 'scope_uris'}; {'id': '149', 'type': 'return_statement', 'children': ['150']}; {'id': '150', 'type': 'identifier', 'children': [], 'value': 'uri'} | def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
if filter:
filter = self.__make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._uri
self.__validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '18']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'get_all_without_ethernet'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8', '12', '15']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '7', 'type': 'integer', 'children': [], 'value': '0'}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '10', 'type': 'unary_operator', 'children': ['11'], 'value': '-'}; {'id': '11', 'type': 'integer', 'children': [], 'value': '1'}; {'id': '12', 'type': 'default_parameter', 'children': ['13', '14']}; {'id': '13', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '14', 'type': 'string', 'children': [], 'value': "''"}; {'id': '15', 'type': 'default_parameter', 'children': ['16', '17']}; {'id': '16', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '17', 'type': 'string', 'children': [], 'value': "''"}; {'id': '18', 'type': 'block', 'children': ['19', '29']}; {'id': '19', 'type': 'expression_statement', 'children': ['20']}; {'id': '20', 'type': 'assignment', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'without_ethernet_client'}; {'id': '22', 'type': 'call', 'children': ['23', '24']}; {'id': '23', 'type': 'identifier', 'children': [], 'value': 'ResourceClient'}; {'id': '24', 'type': 'argument_list', 'children': ['25', '28']}; {'id': '25', 'type': 'attribute', 'children': ['26', '27']}; {'id': '26', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '27', 'type': 'identifier', 'children': [], 'value': '_connection'}; {'id': '28', 'type': 'string', 'children': [], 'value': '"/rest/logical-downlinks/withoutEthernet"'}; {'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': 'without_ethernet_client'}; {'id': '33', 'type': 'identifier', 'children': [], 'value': 'get_all'}; {'id': '34', 'type': 'argument_list', 'children': ['35', '36', '37', '40']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'start'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'count'}; {'id': '37', 'type': 'keyword_argument', 'children': ['38', '39']}; {'id': '38', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '39', 'type': 'identifier', 'children': [], 'value': 'filter'}; {'id': '40', 'type': 'keyword_argument', 'children': ['41', '42']}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'sort'}; {'id': '42', 'type': 'identifier', 'children': [], 'value': 'sort'} | def get_all_without_ethernet(self, start=0, count=-1, filter='', sort=''):
without_ethernet_client = ResourceClient(
self._connection, "/rest/logical-downlinks/withoutEthernet")
return without_ethernet_client.get_all(start, count, filter=filter, sort=sort) |
{'id': '0', 'type': 'module', 'children': ['1']}; {'id': '1', 'type': 'function_definition', 'children': ['2', '3', '11']}; {'id': '2', 'type': 'function_name', 'children': [], 'value': 'reduce_sort'}; {'id': '3', 'type': 'parameters', 'children': ['4', '5', '8']}; {'id': '4', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '5', 'type': 'default_parameter', 'children': ['6', '7']}; {'id': '6', 'type': 'identifier', 'children': [], 'value': 'js_cmp'}; {'id': '7', 'type': 'None', 'children': []}; {'id': '8', 'type': 'default_parameter', 'children': ['9', '10']}; {'id': '9', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '10', 'type': 'None', 'children': []}; {'id': '11', 'type': 'block', 'children': ['12', '23', '32']}; {'id': '12', 'type': 'if_statement', 'children': ['13', '16']}; {'id': '13', 'type': 'comparison_operator', 'children': ['14', '15'], 'value': 'is'}; {'id': '14', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '15', 'type': 'None', 'children': []}; {'id': '16', 'type': 'block', 'children': ['17']}; {'id': '17', 'type': 'expression_statement', 'children': ['18']}; {'id': '18', 'type': 'assignment', 'children': ['19', '20']}; {'id': '19', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '20', 'type': 'call', 'children': ['21', '22']}; {'id': '21', 'type': 'identifier', 'children': [], 'value': 'dict'}; {'id': '22', 'type': 'argument_list', 'children': []}; {'id': '23', 'type': 'if_statement', 'children': ['24', '25']}; {'id': '24', 'type': 'identifier', 'children': [], 'value': 'js_cmp'}; {'id': '25', 'type': 'block', 'children': ['26']}; {'id': '26', 'type': 'expression_statement', 'children': ['27']}; {'id': '27', 'type': 'assignment', 'children': ['28', '31']}; {'id': '28', 'type': 'subscript', 'children': ['29', '30']}; {'id': '29', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '30', 'type': 'string', 'children': [], 'value': "'arg'"}; {'id': '31', 'type': 'identifier', 'children': [], 'value': 'js_cmp'}; {'id': '32', 'type': 'return_statement', 'children': ['33']}; {'id': '33', 'type': 'call', 'children': ['34', '37']}; {'id': '34', 'type': 'attribute', 'children': ['35', '36']}; {'id': '35', 'type': 'identifier', 'children': [], 'value': 'self'}; {'id': '36', 'type': 'identifier', 'children': [], 'value': 'reduce'}; {'id': '37', 'type': 'argument_list', 'children': ['38', '39']}; {'id': '38', 'type': 'string', 'children': [], 'value': '"Riak.reduceSort"'}; {'id': '39', 'type': 'keyword_argument', 'children': ['40', '41']}; {'id': '40', 'type': 'identifier', 'children': [], 'value': 'options'}; {'id': '41', 'type': 'identifier', 'children': [], 'value': 'options'} | def reduce_sort(self, js_cmp=None, options=None):
if options is None:
options = dict()
if js_cmp:
options['arg'] = js_cmp
return self.reduce("Riak.reduceSort", options=options) |
Subsets and Splits