sequence
stringlengths 492
15.9k
| code
stringlengths 75
8.58k
|
---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:title_from_rdf; 3, parameters; 3, 4; 3, 5; 4, identifier:rdf; 5, identifier:url; 6, block; 6, 7; 6, 9; 6, 19; 6, 24; 6, 50; 6, 63; 6, 71; 7, expression_statement; 7, 8; 8, string:'''
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.
'''; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:title; 12, call; 12, 13; 12, 14; 13, identifier:rdf_value; 14, argument_list; 14, 15; 14, 16; 15, identifier:rdf; 16, attribute; 16, 17; 16, 18; 17, identifier:DCT; 18, identifier:title; 19, if_statement; 19, 20; 19, 21; 20, identifier:title; 21, block; 21, 22; 22, return_statement; 22, 23; 23, identifier:title; 24, if_statement; 24, 25; 24, 26; 25, identifier:url; 26, block; 26, 27; 26, 39; 27, expression_statement; 27, 28; 28, assignment; 28, 29; 28, 30; 29, identifier:last_part; 30, subscript; 30, 31; 30, 37; 31, call; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:url; 34, identifier:split; 35, argument_list; 35, 36; 36, string:'/'; 37, unary_operator:-; 37, 38; 38, integer:1; 39, if_statement; 39, 40; 39, 47; 40, boolean_operator:and; 40, 41; 40, 44; 41, comparison_operator:in; 41, 42; 41, 43; 42, string:'.'; 43, identifier:last_part; 44, comparison_operator:not; 44, 45; 44, 46; 45, string:'?'; 46, identifier:last_part; 47, block; 47, 48; 48, return_statement; 48, 49; 49, identifier:last_part; 50, expression_statement; 50, 51; 51, assignment; 51, 52; 51, 53; 52, identifier:fmt; 53, call; 53, 54; 53, 55; 54, identifier:rdf_value; 55, argument_list; 55, 56; 55, 57; 56, identifier:rdf; 57, call; 57, 58; 57, 61; 58, attribute; 58, 59; 58, 60; 59, identifier:DCT; 60, identifier:term; 61, argument_list; 61, 62; 62, string:'format'; 63, expression_statement; 63, 64; 64, assignment; 64, 65; 64, 66; 65, identifier:lang; 66, subscript; 66, 67; 66, 70; 67, attribute; 67, 68; 67, 69; 68, identifier:current_app; 69, identifier:config; 70, string:'DEFAULT_LANGUAGE'; 71, with_statement; 71, 72; 71, 80; 72, with_clause; 72, 73; 73, with_item; 73, 74; 74, call; 74, 75; 74, 78; 75, attribute; 75, 76; 75, 77; 76, identifier:i18n; 77, identifier:language; 78, argument_list; 78, 79; 79, identifier:lang; 80, block; 80, 81; 81, if_statement; 81, 82; 81, 83; 81, 102; 82, identifier:fmt; 83, block; 83, 84; 84, return_statement; 84, 85; 85, call; 85, 86; 85, 94; 86, attribute; 86, 87; 86, 93; 87, call; 87, 88; 87, 91; 88, attribute; 88, 89; 88, 90; 89, identifier:i18n; 90, identifier:_; 91, argument_list; 91, 92; 92, string:'{format} resource'; 93, identifier:format; 94, argument_list; 94, 95; 95, keyword_argument; 95, 96; 95, 97; 96, identifier:format; 97, call; 97, 98; 97, 101; 98, attribute; 98, 99; 98, 100; 99, identifier:fmt; 100, identifier:lower; 101, argument_list; 102, else_clause; 102, 103; 103, block; 103, 104; 104, return_statement; 104, 105; 105, call; 105, 106; 105, 109; 106, attribute; 106, 107; 106, 108; 107, identifier:i18n; 108, identifier:_; 109, argument_list; 109, 110; 110, string:'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') |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:by; 6, default_parameter; 6, 7; 6, 8; 7, identifier:desc; 8, False; 9, block; 9, 10; 9, 31; 9, 47; 10, if_statement; 10, 11; 10, 15; 10, 20; 11, call; 11, 12; 11, 13; 12, identifier:callable; 13, argument_list; 13, 14; 14, identifier:by; 15, block; 15, 16; 16, expression_statement; 16, 17; 17, assignment; 17, 18; 17, 19; 18, identifier:key; 19, identifier:by; 20, else_clause; 20, 21; 21, block; 21, 22; 22, function_definition; 22, 23; 22, 24; 22, 26; 23, function_name:key; 24, parameters; 24, 25; 25, identifier:feature; 26, block; 26, 27; 27, return_statement; 27, 28; 28, subscript; 28, 29; 28, 30; 29, identifier:feature; 30, identifier:by; 31, expression_statement; 31, 32; 32, assignment; 32, 33; 32, 34; 33, identifier:sorted_features; 34, call; 34, 35; 34, 36; 35, identifier:sorted; 36, argument_list; 36, 37; 36, 41; 36, 44; 37, call; 37, 38; 37, 39; 38, identifier:list; 39, argument_list; 39, 40; 40, identifier:self; 41, keyword_argument; 41, 42; 41, 43; 42, identifier:reverse; 43, identifier:desc; 44, keyword_argument; 44, 45; 44, 46; 45, identifier:key; 46, identifier:key; 47, return_statement; 47, 48; 48, call; 48, 49; 48, 52; 49, attribute; 49, 50; 49, 51; 50, identifier:self; 51, identifier:__class__; 52, argument_list; 52, 53; 53, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:shellc; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:ndim; 5, identifier:lenvals; 6, identifier:array; 7, block; 7, 8; 7, 23; 7, 32; 7, 41; 7, 55; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:array; 11, call; 11, 12; 11, 15; 12, attribute; 12, 13; 12, 14; 13, identifier:stypes; 14, identifier:listToCharArray; 15, argument_list; 15, 16; 15, 17; 15, 20; 16, identifier:array; 17, keyword_argument; 17, 18; 17, 19; 18, identifier:xLen; 19, identifier:lenvals; 20, keyword_argument; 20, 21; 20, 22; 21, identifier:yLen; 22, identifier:ndim; 23, expression_statement; 23, 24; 24, assignment; 24, 25; 24, 26; 25, identifier:ndim; 26, call; 26, 27; 26, 30; 27, attribute; 27, 28; 27, 29; 28, identifier:ctypes; 29, identifier:c_int; 30, argument_list; 30, 31; 31, identifier:ndim; 32, expression_statement; 32, 33; 33, assignment; 33, 34; 33, 35; 34, identifier:lenvals; 35, call; 35, 36; 35, 39; 36, attribute; 36, 37; 36, 38; 37, identifier:ctypes; 38, identifier:c_int; 39, argument_list; 39, 40; 40, identifier:lenvals; 41, expression_statement; 41, 42; 42, call; 42, 43; 42, 46; 43, attribute; 43, 44; 43, 45; 44, identifier:libspice; 45, identifier:shellc_c; 46, argument_list; 46, 47; 46, 48; 46, 49; 47, identifier:ndim; 48, identifier:lenvals; 49, call; 49, 50; 49, 53; 50, attribute; 50, 51; 50, 52; 51, identifier:ctypes; 52, identifier:byref; 53, argument_list; 53, 54; 54, identifier:array; 55, return_statement; 55, 56; 56, call; 56, 57; 56, 60; 57, attribute; 57, 58; 57, 59; 58, identifier:stypes; 59, identifier:cVectorToPython; 60, argument_list; 60, 61; 61, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:shelld; 3, parameters; 3, 4; 3, 5; 4, identifier:ndim; 5, identifier:array; 6, block; 6, 7; 6, 16; 6, 25; 6, 46; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:array; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifier:stypes; 13, identifier:toDoubleVector; 14, argument_list; 14, 15; 15, identifier:array; 16, expression_statement; 16, 17; 17, assignment; 17, 18; 17, 19; 18, identifier:ndim; 19, call; 19, 20; 19, 23; 20, attribute; 20, 21; 20, 22; 21, identifier:ctypes; 22, identifier:c_int; 23, argument_list; 23, 24; 24, identifier:ndim; 25, expression_statement; 25, 26; 26, call; 26, 27; 26, 30; 27, attribute; 27, 28; 27, 29; 28, identifier:libspice; 29, identifier:shelld_c; 30, argument_list; 30, 31; 30, 32; 31, identifier:ndim; 32, call; 32, 33; 32, 36; 33, attribute; 33, 34; 33, 35; 34, identifier:ctypes; 35, identifier:cast; 36, argument_list; 36, 37; 36, 38; 37, identifier:array; 38, call; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:ctypes; 41, identifier:POINTER; 42, argument_list; 42, 43; 43, attribute; 43, 44; 43, 45; 44, identifier:ctypes; 45, identifier:c_double; 46, return_statement; 46, 47; 47, call; 47, 48; 47, 51; 48, attribute; 48, 49; 48, 50; 49, identifier:stypes; 50, identifier:cVectorToPython; 51, argument_list; 51, 52; 52, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:shelli; 3, parameters; 3, 4; 3, 5; 4, identifier:ndim; 5, identifier:array; 6, block; 6, 7; 6, 16; 6, 25; 6, 46; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:array; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifier:stypes; 13, identifier:toIntVector; 14, argument_list; 14, 15; 15, identifier:array; 16, expression_statement; 16, 17; 17, assignment; 17, 18; 17, 19; 18, identifier:ndim; 19, call; 19, 20; 19, 23; 20, attribute; 20, 21; 20, 22; 21, identifier:ctypes; 22, identifier:c_int; 23, argument_list; 23, 24; 24, identifier:ndim; 25, expression_statement; 25, 26; 26, call; 26, 27; 26, 30; 27, attribute; 27, 28; 27, 29; 28, identifier:libspice; 29, identifier:shelli_c; 30, argument_list; 30, 31; 30, 32; 31, identifier:ndim; 32, call; 32, 33; 32, 36; 33, attribute; 33, 34; 33, 35; 34, identifier:ctypes; 35, identifier:cast; 36, argument_list; 36, 37; 36, 38; 37, identifier:array; 38, call; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:ctypes; 41, identifier:POINTER; 42, argument_list; 42, 43; 43, attribute; 43, 44; 43, 45; 44, identifier:ctypes; 45, identifier:c_int; 46, return_statement; 46, 47; 47, call; 47, 48; 47, 51; 48, attribute; 48, 49; 48, 50; 49, identifier:stypes; 50, identifier:cVectorToPython; 51, argument_list; 51, 52; 52, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:make_retrieveParameters; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:offset; 6, integer:1; 7, default_parameter; 7, 8; 7, 9; 8, identifier:count; 9, integer:100; 10, default_parameter; 10, 11; 10, 12; 11, identifier:name; 12, string:'RS'; 13, default_parameter; 13, 14; 13, 15; 14, identifier:sort; 15, string:'D'; 16, block; 16, 17; 17, return_statement; 17, 18; 18, call; 18, 19; 18, 20; 19, identifier:_OrderedDict; 20, argument_list; 20, 21; 21, list:[
('firstRecord', offset),
('count', count),
('sortField', _OrderedDict([('name', name), ('sort', sort)]))
]; 21, 22; 21, 25; 21, 28; 22, tuple; 22, 23; 22, 24; 23, string:'firstRecord'; 24, identifier:offset; 25, tuple; 25, 26; 25, 27; 26, string:'count'; 27, identifier:count; 28, tuple; 28, 29; 28, 30; 29, string:'sortField'; 30, call; 30, 31; 30, 32; 31, identifier:_OrderedDict; 32, argument_list; 32, 33; 33, list:[('name', name), ('sort', sort)]; 33, 34; 33, 37; 34, tuple; 34, 35; 34, 36; 35, string:'name'; 36, identifier:name; 37, tuple; 37, 38; 37, 39; 38, string:'sort'; 39, identifier:sort | def make_retrieveParameters(offset=1, count=100, name='RS', sort='D'):
return _OrderedDict([
('firstRecord', offset),
('count', count),
('sortField', _OrderedDict([('name', name), ('sort', sort)]))
]) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sorted_names; 3, parameters; 3, 4; 4, identifier:names; 5, block; 5, 6; 5, 13; 5, 17; 5, 33; 5, 40; 5, 50; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:names; 9, call; 9, 10; 9, 11; 10, identifier:list; 11, argument_list; 11, 12; 12, identifier:names; 13, expression_statement; 13, 14; 14, assignment; 14, 15; 14, 16; 15, identifier:have_default; 16, False; 17, if_statement; 17, 18; 17, 21; 18, comparison_operator:in; 18, 19; 18, 20; 19, string:'default'; 20, identifier:names; 21, block; 21, 22; 21, 29; 22, expression_statement; 22, 23; 23, call; 23, 24; 23, 27; 24, attribute; 24, 25; 24, 26; 25, identifier:names; 26, identifier:remove; 27, argument_list; 27, 28; 28, string:'default'; 29, expression_statement; 29, 30; 30, assignment; 30, 31; 30, 32; 31, identifier:have_default; 32, True; 33, expression_statement; 33, 34; 34, assignment; 34, 35; 34, 36; 35, identifier:sorted_names; 36, call; 36, 37; 36, 38; 37, identifier:sorted; 38, argument_list; 38, 39; 39, identifier:names; 40, if_statement; 40, 41; 40, 42; 41, identifier:have_default; 42, block; 42, 43; 43, expression_statement; 43, 44; 44, assignment; 44, 45; 44, 46; 45, identifier:sorted_names; 46, binary_operator:+; 46, 47; 46, 49; 47, list:['default']; 47, 48; 48, string:'default'; 49, identifier:sorted_names; 50, return_statement; 50, 51; 51, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:getArticles; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:page; 7, integer:1; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, integer:100; 11, default_parameter; 11, 12; 11, 13; 12, identifier:sortBy; 13, string:"rel"; 14, default_parameter; 14, 15; 14, 16; 15, identifier:sortByAsc; 16, False; 17, default_parameter; 17, 18; 17, 19; 18, identifier:returnInfo; 19, call; 19, 20; 19, 21; 20, identifier:ReturnInfo; 21, argument_list; 22, block; 22, 23; 22, 27; 22, 31; 22, 70; 22, 82; 23, assert_statement; 23, 24; 24, comparison_operator:>=; 24, 25; 24, 26; 25, identifier:page; 26, integer:1; 27, assert_statement; 27, 28; 28, comparison_operator:<=; 28, 29; 28, 30; 29, identifier:count; 30, integer:100; 31, expression_statement; 31, 32; 32, assignment; 32, 33; 32, 34; 33, identifier:params; 34, dictionary; 34, 35; 34, 38; 34, 41; 34, 48; 34, 51; 34, 54; 34, 57; 34, 60; 35, pair; 35, 36; 35, 37; 36, string:"action"; 37, string:"getArticlesForTopicPage"; 38, pair; 38, 39; 38, 40; 39, string:"resultType"; 40, string:"articles"; 41, pair; 41, 42; 41, 43; 42, string:"dataType"; 43, subscript; 43, 44; 43, 47; 44, attribute; 44, 45; 44, 46; 45, identifier:self; 46, identifier:topicPage; 47, string:"dataType"; 48, pair; 48, 49; 48, 50; 49, string:"articlesCount"; 50, identifier:count; 51, pair; 51, 52; 51, 53; 52, string:"articlesSortBy"; 53, identifier:sortBy; 54, pair; 54, 55; 54, 56; 55, string:"articlesSortByAsc"; 56, identifier:sortByAsc; 57, pair; 57, 58; 57, 59; 58, string:"page"; 59, identifier:page; 60, pair; 60, 61; 60, 62; 61, string:"topicPage"; 62, call; 62, 63; 62, 66; 63, attribute; 63, 64; 63, 65; 64, identifier:json; 65, identifier:dumps; 66, argument_list; 66, 67; 67, attribute; 67, 68; 67, 69; 68, identifier:self; 69, identifier:topicPage; 70, expression_statement; 70, 71; 71, call; 71, 72; 71, 75; 72, attribute; 72, 73; 72, 74; 73, identifier:params; 74, identifier:update; 75, argument_list; 75, 76; 76, call; 76, 77; 76, 80; 77, attribute; 77, 78; 77, 79; 78, identifier:returnInfo; 79, identifier:getParams; 80, argument_list; 80, 81; 81, string:"articles"; 82, return_statement; 82, 83; 83, call; 83, 84; 83, 89; 84, attribute; 84, 85; 84, 88; 85, attribute; 85, 86; 85, 87; 86, identifier:self; 87, identifier:eventRegistry; 88, identifier:jsonRequest; 89, argument_list; 89, 90; 89, 91; 90, string:"/json/article"; 91, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 33; 2, function_name:pprint; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 4, identifier:object; 5, default_parameter; 5, 6; 5, 7; 6, identifier:stream; 7, identifier:_UNSET_SENTINEL; 8, default_parameter; 8, 9; 8, 10; 9, identifier:indent; 10, identifier:_UNSET_SENTINEL; 11, default_parameter; 11, 12; 11, 13; 12, identifier:width; 13, identifier:_UNSET_SENTINEL; 14, default_parameter; 14, 15; 14, 16; 15, identifier:depth; 16, identifier:_UNSET_SENTINEL; 17, keyword_separator; 18, default_parameter; 18, 19; 18, 20; 19, identifier:compact; 20, False; 21, default_parameter; 21, 22; 21, 23; 22, identifier:ribbon_width; 23, identifier:_UNSET_SENTINEL; 24, default_parameter; 24, 25; 24, 26; 25, identifier:max_seq_len; 26, identifier:_UNSET_SENTINEL; 27, default_parameter; 27, 28; 27, 29; 28, identifier:sort_dict_keys; 29, identifier:_UNSET_SENTINEL; 30, default_parameter; 30, 31; 30, 32; 31, identifier:end; 32, string:'\n'; 33, block; 33, 34; 33, 63; 33, 75; 33, 81; 34, expression_statement; 34, 35; 35, assignment; 35, 36; 35, 37; 36, identifier:sdocs; 37, call; 37, 38; 37, 39; 38, identifier:python_to_sdocs; 39, argument_list; 39, 40; 39, 41; 40, identifier:object; 41, dictionary_splat; 41, 42; 42, call; 42, 43; 42, 44; 43, identifier:_merge_defaults; 44, argument_list; 44, 45; 44, 48; 44, 51; 44, 54; 44, 57; 44, 60; 45, keyword_argument; 45, 46; 45, 47; 46, identifier:indent; 47, identifier:indent; 48, keyword_argument; 48, 49; 48, 50; 49, identifier:width; 50, identifier:width; 51, keyword_argument; 51, 52; 51, 53; 52, identifier:depth; 53, identifier:depth; 54, keyword_argument; 54, 55; 54, 56; 55, identifier:ribbon_width; 56, identifier:ribbon_width; 57, keyword_argument; 57, 58; 57, 59; 58, identifier:max_seq_len; 59, identifier:max_seq_len; 60, keyword_argument; 60, 61; 60, 62; 61, identifier:sort_dict_keys; 62, identifier:sort_dict_keys; 63, expression_statement; 63, 64; 64, assignment; 64, 65; 64, 66; 65, identifier:stream; 66, parenthesized_expression; 66, 67; 67, conditional_expression:if; 67, 68; 67, 71; 67, 74; 68, attribute; 68, 69; 68, 70; 69, identifier:sys; 70, identifier:stdout; 71, comparison_operator:is; 71, 72; 71, 73; 72, identifier:stream; 73, identifier:_UNSET_SENTINEL; 74, identifier:stream; 75, expression_statement; 75, 76; 76, call; 76, 77; 76, 78; 77, identifier:default_render_to_stream; 78, argument_list; 78, 79; 78, 80; 79, identifier:stream; 80, identifier:sdocs; 81, if_statement; 81, 82; 81, 83; 82, identifier:end; 83, block; 83, 84; 84, expression_statement; 84, 85; 85, call; 85, 86; 85, 89; 86, attribute; 86, 87; 86, 88; 87, identifier:stream; 88, identifier:write; 89, argument_list; 89, 90; 90, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 36; 2, function_name:cpprint; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 4, identifier:object; 5, default_parameter; 5, 6; 5, 7; 6, identifier:stream; 7, identifier:_UNSET_SENTINEL; 8, default_parameter; 8, 9; 8, 10; 9, identifier:indent; 10, identifier:_UNSET_SENTINEL; 11, default_parameter; 11, 12; 11, 13; 12, identifier:width; 13, identifier:_UNSET_SENTINEL; 14, default_parameter; 14, 15; 14, 16; 15, identifier:depth; 16, identifier:_UNSET_SENTINEL; 17, keyword_separator; 18, default_parameter; 18, 19; 18, 20; 19, identifier:compact; 20, False; 21, default_parameter; 21, 22; 21, 23; 22, identifier:ribbon_width; 23, identifier:_UNSET_SENTINEL; 24, default_parameter; 24, 25; 24, 26; 25, identifier:max_seq_len; 26, identifier:_UNSET_SENTINEL; 27, default_parameter; 27, 28; 27, 29; 28, identifier:sort_dict_keys; 29, identifier:_UNSET_SENTINEL; 30, default_parameter; 30, 31; 30, 32; 31, identifier:style; 32, None; 33, default_parameter; 33, 34; 33, 35; 34, identifier:end; 35, string:'\n'; 36, block; 36, 37; 36, 66; 36, 78; 36, 87; 37, expression_statement; 37, 38; 38, assignment; 38, 39; 38, 40; 39, identifier:sdocs; 40, call; 40, 41; 40, 42; 41, identifier:python_to_sdocs; 42, argument_list; 42, 43; 42, 44; 43, identifier:object; 44, dictionary_splat; 44, 45; 45, call; 45, 46; 45, 47; 46, identifier:_merge_defaults; 47, argument_list; 47, 48; 47, 51; 47, 54; 47, 57; 47, 60; 47, 63; 48, keyword_argument; 48, 49; 48, 50; 49, identifier:indent; 50, identifier:indent; 51, keyword_argument; 51, 52; 51, 53; 52, identifier:width; 53, identifier:width; 54, keyword_argument; 54, 55; 54, 56; 55, identifier:depth; 56, identifier:depth; 57, keyword_argument; 57, 58; 57, 59; 58, identifier:ribbon_width; 59, identifier:ribbon_width; 60, keyword_argument; 60, 61; 60, 62; 61, identifier:max_seq_len; 62, identifier:max_seq_len; 63, keyword_argument; 63, 64; 63, 65; 64, identifier:sort_dict_keys; 65, identifier:sort_dict_keys; 66, expression_statement; 66, 67; 67, assignment; 67, 68; 67, 69; 68, identifier:stream; 69, parenthesized_expression; 69, 70; 70, conditional_expression:if; 70, 71; 70, 74; 70, 77; 71, attribute; 71, 72; 71, 73; 72, identifier:sys; 73, identifier:stdout; 74, comparison_operator:is; 74, 75; 74, 76; 75, identifier:stream; 76, identifier:_UNSET_SENTINEL; 77, identifier:stream; 78, expression_statement; 78, 79; 79, call; 79, 80; 79, 81; 80, identifier:colored_render_to_stream; 81, argument_list; 81, 82; 81, 83; 81, 84; 82, identifier:stream; 83, identifier:sdocs; 84, keyword_argument; 84, 85; 84, 86; 85, identifier:style; 86, identifier:style; 87, if_statement; 87, 88; 87, 89; 88, identifier:end; 89, block; 89, 90; 90, expression_statement; 90, 91; 91, call; 91, 92; 91, 95; 92, attribute; 92, 93; 92, 94; 93, identifier:stream; 94, identifier:write; 95, argument_list; 95, 96; 96, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_encrypted_data_keys_hash; 3, parameters; 3, 4; 3, 5; 4, identifier:hasher; 5, identifier:encrypted_data_keys; 6, block; 6, 7; 6, 11; 6, 48; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:hashed_keys; 10, list:[]; 11, for_statement; 11, 12; 11, 13; 11, 14; 12, identifier:edk; 13, identifier:encrypted_data_keys; 14, block; 14, 15; 14, 22; 14, 30; 14, 37; 15, expression_statement; 15, 16; 16, assignment; 16, 17; 16, 18; 17, identifier:serialized_edk; 18, call; 18, 19; 18, 20; 19, identifier:serialize_encrypted_data_key; 20, argument_list; 20, 21; 21, identifier:edk; 22, expression_statement; 22, 23; 23, assignment; 23, 24; 23, 25; 24, identifier:_hasher; 25, call; 25, 26; 25, 29; 26, attribute; 26, 27; 26, 28; 27, identifier:hasher; 28, identifier:copy; 29, argument_list; 30, expression_statement; 30, 31; 31, call; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:_hasher; 34, identifier:update; 35, argument_list; 35, 36; 36, identifier:serialized_edk; 37, expression_statement; 37, 38; 38, call; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:hashed_keys; 41, identifier:append; 42, argument_list; 42, 43; 43, call; 43, 44; 43, 47; 44, attribute; 44, 45; 44, 46; 45, identifier:_hasher; 46, identifier:finalize; 47, argument_list; 48, return_statement; 48, 49; 49, call; 49, 50; 49, 53; 50, attribute; 50, 51; 50, 52; 51, string:b""; 52, identifier:join; 53, argument_list; 53, 54; 54, call; 54, 55; 54, 56; 55, identifier:sorted; 56, argument_list; 56, 57; 57, identifier: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)) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:getOverlaySortOrder; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:ulOverlayHandle; 6, block; 6, 7; 6, 15; 6, 21; 6, 32; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:fn; 10, attribute; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifier:self; 13, identifier:function_table; 14, identifier:getOverlaySortOrder; 15, expression_statement; 15, 16; 16, assignment; 16, 17; 16, 18; 17, identifier:punSortOrder; 18, call; 18, 19; 18, 20; 19, identifier:c_uint32; 20, argument_list; 21, expression_statement; 21, 22; 22, assignment; 22, 23; 22, 24; 23, identifier:result; 24, call; 24, 25; 24, 26; 25, identifier:fn; 26, argument_list; 26, 27; 26, 28; 27, identifier:ulOverlayHandle; 28, call; 28, 29; 28, 30; 29, identifier:byref; 30, argument_list; 30, 31; 31, identifier:punSortOrder; 32, return_statement; 32, 33; 33, expression_list; 33, 34; 33, 35; 34, identifier:result; 35, attribute; 35, 36; 35, 37; 36, identifier:punSortOrder; 37, identifier:value | def getOverlaySortOrder(self, ulOverlayHandle):
fn = self.function_table.getOverlaySortOrder
punSortOrder = c_uint32()
result = fn(ulOverlayHandle, byref(punSortOrder))
return result, punSortOrder.value |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:naturalize_string; 3, parameters; 3, 4; 4, identifier:key; 5, block; 5, 6; 6, return_statement; 6, 7; 7, list_comprehension; 7, 8; 7, 23; 8, conditional_expression:if; 8, 9; 8, 13; 8, 18; 9, call; 9, 10; 9, 11; 10, identifier:int; 11, argument_list; 11, 12; 12, identifier:text; 13, call; 13, 14; 13, 17; 14, attribute; 14, 15; 14, 16; 15, identifier:text; 16, identifier:isdigit; 17, argument_list; 18, call; 18, 19; 18, 22; 19, attribute; 19, 20; 19, 21; 20, identifier:text; 21, identifier:lower; 22, argument_list; 23, for_in_clause; 23, 24; 23, 25; 24, identifier:text; 25, call; 25, 26; 25, 29; 26, attribute; 26, 27; 26, 28; 27, identifier:re; 28, identifier:split; 29, argument_list; 29, 30; 29, 31; 30, identifier:numregex; 31, identifier:key | def naturalize_string(key):
return [int(text) if text.isdigit() else text.lower()
for text in re.split(numregex, key)] |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_rows; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:options; 6, block; 6, 7; 6, 45; 6, 104; 6, 123; 7, if_statement; 7, 8; 7, 11; 7, 32; 8, subscript; 8, 9; 8, 10; 9, identifier:options; 10, string:"oldsortslice"; 11, block; 11, 12; 12, expression_statement; 12, 13; 13, assignment; 13, 14; 13, 15; 14, identifier:rows; 15, call; 15, 16; 15, 19; 16, attribute; 16, 17; 16, 18; 17, identifier:copy; 18, identifier:deepcopy; 19, argument_list; 19, 20; 20, subscript; 20, 21; 20, 24; 21, attribute; 21, 22; 21, 23; 22, identifier:self; 23, identifier:_rows; 24, slice; 24, 25; 24, 28; 24, 29; 25, subscript; 25, 26; 25, 27; 26, identifier:options; 27, string:"start"; 28, colon; 29, subscript; 29, 30; 29, 31; 30, identifier:options; 31, string:"end"; 32, else_clause; 32, 33; 33, block; 33, 34; 34, expression_statement; 34, 35; 35, assignment; 35, 36; 35, 37; 36, identifier:rows; 37, call; 37, 38; 37, 41; 38, attribute; 38, 39; 38, 40; 39, identifier:copy; 40, identifier:deepcopy; 41, argument_list; 41, 42; 42, attribute; 42, 43; 42, 44; 43, identifier:self; 44, identifier:_rows; 45, if_statement; 45, 46; 45, 49; 46, subscript; 46, 47; 46, 48; 47, identifier:options; 48, string:"sortby"; 49, block; 49, 50; 49, 63; 49, 76; 49, 92; 50, expression_statement; 50, 51; 51, assignment; 51, 52; 51, 53; 52, identifier:sortindex; 53, call; 53, 54; 53, 59; 54, attribute; 54, 55; 54, 58; 55, attribute; 55, 56; 55, 57; 56, identifier:self; 57, identifier:_field_names; 58, identifier:index; 59, argument_list; 59, 60; 60, subscript; 60, 61; 60, 62; 61, identifier:options; 62, string:"sortby"; 63, expression_statement; 63, 64; 64, assignment; 64, 65; 64, 66; 65, identifier:rows; 66, list_comprehension; 66, 67; 66, 73; 67, binary_operator:+; 67, 68; 67, 72; 68, list:[row[sortindex]]; 68, 69; 69, subscript; 69, 70; 69, 71; 70, identifier:row; 71, identifier:sortindex; 72, identifier:row; 73, for_in_clause; 73, 74; 73, 75; 74, identifier:row; 75, identifier:rows; 76, expression_statement; 76, 77; 77, call; 77, 78; 77, 81; 78, attribute; 78, 79; 78, 80; 79, identifier:rows; 80, identifier:sort; 81, argument_list; 81, 82; 81, 87; 82, keyword_argument; 82, 83; 82, 84; 83, identifier:reverse; 84, subscript; 84, 85; 84, 86; 85, identifier:options; 86, string:"reversesort"; 87, keyword_argument; 87, 88; 87, 89; 88, identifier:key; 89, subscript; 89, 90; 89, 91; 90, identifier:options; 91, string:"sort_key"; 92, expression_statement; 92, 93; 93, assignment; 93, 94; 93, 95; 94, identifier:rows; 95, list_comprehension; 95, 96; 95, 101; 96, subscript; 96, 97; 96, 98; 97, identifier:row; 98, slice; 98, 99; 98, 100; 99, integer:1; 100, colon; 101, for_in_clause; 101, 102; 101, 103; 102, identifier:row; 103, identifier:rows; 104, if_statement; 104, 105; 104, 109; 105, not_operator; 105, 106; 106, subscript; 106, 107; 106, 108; 107, identifier:options; 108, string:"oldsortslice"; 109, block; 109, 110; 110, expression_statement; 110, 111; 111, assignment; 111, 112; 111, 113; 112, identifier:rows; 113, subscript; 113, 114; 113, 115; 114, identifier:rows; 115, slice; 115, 116; 115, 119; 115, 120; 116, subscript; 116, 117; 116, 118; 117, identifier:options; 118, string:"start"; 119, colon; 120, subscript; 120, 121; 120, 122; 121, identifier:options; 122, string:"end"; 123, return_statement; 123, 124; 124, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_resolve_sort_by; 3, parameters; 3, 4; 3, 5; 4, identifier:sort_by; 5, identifier:flag_radius_query; 6, block; 6, 7; 6, 79; 7, if_statement; 7, 8; 7, 11; 7, 19; 7, 71; 8, comparison_operator:is; 8, 9; 8, 10; 9, identifier:sort_by; 10, None; 11, block; 11, 12; 12, if_statement; 12, 13; 12, 14; 13, identifier:flag_radius_query; 14, block; 14, 15; 15, expression_statement; 15, 16; 16, assignment; 16, 17; 16, 18; 17, identifier:sort_by; 18, identifier:SORT_BY_DIST; 19, elif_clause; 19, 20; 19, 25; 20, call; 20, 21; 20, 22; 21, identifier:isinstance; 22, argument_list; 22, 23; 22, 24; 23, identifier:sort_by; 24, identifier:string_types; 25, block; 25, 26; 26, if_statement; 26, 27; 26, 34; 26, 53; 27, comparison_operator:==; 27, 28; 27, 33; 28, call; 28, 29; 28, 32; 29, attribute; 29, 30; 29, 31; 30, identifier:sort_by; 31, identifier:lower; 32, argument_list; 33, identifier:SORT_BY_DIST; 34, block; 34, 35; 34, 49; 35, if_statement; 35, 36; 35, 39; 36, comparison_operator:is; 36, 37; 36, 38; 37, identifier:flag_radius_query; 38, False; 39, block; 39, 40; 39, 44; 40, expression_statement; 40, 41; 41, assignment; 41, 42; 41, 43; 42, identifier:msg; 43, string:"`sort_by` arg can be 'dist' only under distance based query!"; 44, raise_statement; 44, 45; 45, call; 45, 46; 45, 47; 46, identifier:ValueError; 47, argument_list; 47, 48; 48, identifier:msg; 49, expression_statement; 49, 50; 50, assignment; 50, 51; 50, 52; 51, identifier:sort_by; 52, identifier:SORT_BY_DIST; 53, elif_clause; 53, 54; 53, 61; 54, comparison_operator:not; 54, 55; 54, 56; 55, identifier:sort_by; 56, attribute; 56, 57; 56, 60; 57, attribute; 57, 58; 57, 59; 58, identifier:SimpleZipcode; 59, identifier:__table__; 60, identifier:columns; 61, block; 61, 62; 61, 66; 62, expression_statement; 62, 63; 63, assignment; 63, 64; 63, 65; 64, identifier:msg; 65, string:"`sort_by` arg has to be one of the Zipcode attribute or 'dist'!"; 66, raise_statement; 66, 67; 67, call; 67, 68; 67, 69; 68, identifier:ValueError; 69, argument_list; 69, 70; 70, identifier:msg; 71, else_clause; 71, 72; 72, block; 72, 73; 73, expression_statement; 73, 74; 74, assignment; 74, 75; 74, 76; 75, identifier:sort_by; 76, attribute; 76, 77; 76, 78; 77, identifier:sort_by; 78, identifier:name; 79, return_statement; 79, 80; 80, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:getOPOrUserServices; 3, parameters; 3, 4; 4, identifier:openid_services; 5, block; 5, 6; 5, 15; 5, 25; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:op_services; 9, call; 9, 10; 9, 11; 10, identifier:arrangeByType; 11, argument_list; 11, 12; 11, 13; 12, identifier:openid_services; 13, list:[OPENID_IDP_2_0_TYPE]; 13, 14; 14, identifier:OPENID_IDP_2_0_TYPE; 15, expression_statement; 15, 16; 16, assignment; 16, 17; 16, 18; 17, identifier:openid_services; 18, call; 18, 19; 18, 20; 19, identifier:arrangeByType; 20, argument_list; 20, 21; 20, 22; 21, identifier:openid_services; 22, attribute; 22, 23; 22, 24; 23, identifier:OpenIDServiceEndpoint; 24, identifier:openid_type_uris; 25, return_statement; 25, 26; 26, boolean_operator:or; 26, 27; 26, 28; 27, identifier:op_services; 28, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:AdvSearch; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:document; 5, identifier:search; 6, default_parameter; 6, 7; 6, 8; 7, identifier:bs; 8, integer:3; 9, block; 9, 10; 9, 12; 9, 21; 9, 25; 9, 29; 9, 173; 10, expression_statement; 10, 11; 11, string:'''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
'''; 12, expression_statement; 12, 13; 13, assignment; 13, 14; 13, 15; 14, identifier:searchre; 15, call; 15, 16; 15, 19; 16, attribute; 16, 17; 16, 18; 17, identifier:re; 18, identifier:compile; 19, argument_list; 19, 20; 20, identifier:search; 21, expression_statement; 21, 22; 22, assignment; 22, 23; 22, 24; 23, identifier:matches; 24, list:[]; 25, expression_statement; 25, 26; 26, assignment; 26, 27; 26, 28; 27, identifier:searchels; 28, list:[]; 29, for_statement; 29, 30; 29, 31; 29, 36; 30, identifier:element; 31, call; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:document; 34, identifier:iter; 35, argument_list; 36, block; 36, 37; 37, if_statement; 37, 38; 37, 47; 38, comparison_operator:==; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:element; 41, identifier:tag; 42, binary_operator:%; 42, 43; 42, 44; 43, string:'{%s}t'; 44, subscript; 44, 45; 44, 46; 45, identifier:nsprefixes; 46, string:'w'; 47, block; 47, 48; 48, if_statement; 48, 49; 48, 52; 49, attribute; 49, 50; 49, 51; 50, identifier:element; 51, identifier:text; 52, block; 52, 53; 52, 60; 52, 75; 52, 79; 53, expression_statement; 53, 54; 54, call; 54, 55; 54, 58; 55, attribute; 55, 56; 55, 57; 56, identifier:searchels; 57, identifier:append; 58, argument_list; 58, 59; 59, identifier:element; 60, if_statement; 60, 61; 60, 67; 61, comparison_operator:>; 61, 62; 61, 66; 62, call; 62, 63; 62, 64; 63, identifier:len; 64, argument_list; 64, 65; 65, identifier:searchels; 66, identifier:bs; 67, block; 67, 68; 68, expression_statement; 68, 69; 69, call; 69, 70; 69, 73; 70, attribute; 70, 71; 70, 72; 71, identifier:searchels; 72, identifier:pop; 73, argument_list; 73, 74; 74, integer:0; 75, expression_statement; 75, 76; 76, assignment; 76, 77; 76, 78; 77, identifier:found; 78, False; 79, for_statement; 79, 80; 79, 81; 79, 91; 80, identifier:l; 81, call; 81, 82; 81, 83; 82, identifier:range; 83, argument_list; 83, 84; 83, 85; 84, integer:1; 85, binary_operator:+; 85, 86; 85, 90; 86, call; 86, 87; 86, 88; 87, identifier:len; 88, argument_list; 88, 89; 89, identifier:searchels; 90, integer:1; 91, block; 91, 92; 91, 96; 92, if_statement; 92, 93; 92, 94; 93, identifier:found; 94, block; 94, 95; 95, break_statement; 96, for_statement; 96, 97; 96, 98; 96, 105; 97, identifier:s; 98, call; 98, 99; 98, 100; 99, identifier:range; 100, argument_list; 100, 101; 101, call; 101, 102; 101, 103; 102, identifier:len; 103, argument_list; 103, 104; 104, identifier:searchels; 105, block; 105, 106; 105, 110; 106, if_statement; 106, 107; 106, 108; 107, identifier:found; 108, block; 108, 109; 109, break_statement; 110, if_statement; 110, 111; 110, 119; 111, comparison_operator:<=; 111, 112; 111, 115; 112, binary_operator:+; 112, 113; 112, 114; 113, identifier:s; 114, identifier:l; 115, call; 115, 116; 115, 117; 116, identifier:len; 117, argument_list; 117, 118; 118, identifier:searchels; 119, block; 119, 120; 119, 130; 119, 134; 119, 146; 119, 155; 120, expression_statement; 120, 121; 121, assignment; 121, 122; 121, 123; 122, identifier:e; 123, call; 123, 124; 123, 125; 124, identifier:range; 125, argument_list; 125, 126; 125, 127; 126, identifier:s; 127, binary_operator:+; 127, 128; 127, 129; 128, identifier:s; 129, identifier:l; 130, expression_statement; 130, 131; 131, assignment; 131, 132; 131, 133; 132, identifier:txtsearch; 133, string:''; 134, for_statement; 134, 135; 134, 136; 134, 137; 135, identifier:k; 136, identifier:e; 137, block; 137, 138; 138, expression_statement; 138, 139; 139, augmented_assignment:+=; 139, 140; 139, 141; 140, identifier:txtsearch; 141, attribute; 141, 142; 141, 145; 142, subscript; 142, 143; 142, 144; 143, identifier:searchels; 144, identifier:k; 145, identifier:text; 146, expression_statement; 146, 147; 147, assignment; 147, 148; 147, 149; 148, identifier:match; 149, call; 149, 150; 149, 153; 150, attribute; 150, 151; 150, 152; 151, identifier:searchre; 152, identifier:search; 153, argument_list; 153, 154; 154, identifier:txtsearch; 155, if_statement; 155, 156; 155, 157; 156, identifier:match; 157, block; 157, 158; 157, 169; 158, expression_statement; 158, 159; 159, call; 159, 160; 159, 163; 160, attribute; 160, 161; 160, 162; 161, identifier:matches; 162, identifier:append; 163, argument_list; 163, 164; 164, call; 164, 165; 164, 168; 165, attribute; 165, 166; 165, 167; 166, identifier:match; 167, identifier:group; 168, argument_list; 169, expression_statement; 169, 170; 170, assignment; 170, 171; 170, 172; 171, identifier:found; 172, True; 173, return_statement; 173, 174; 174, call; 174, 175; 174, 176; 175, identifier:set; 176, argument_list; 176, 177; 177, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:get_project_files; 3, parameters; 4, block; 4, 5; 4, 14; 4, 18; 4, 77; 5, if_statement; 5, 6; 5, 9; 6, call; 6, 7; 6, 8; 7, identifier:is_git_project; 8, argument_list; 9, block; 9, 10; 10, return_statement; 10, 11; 11, call; 11, 12; 11, 13; 12, identifier:get_git_project_files; 13, argument_list; 14, expression_statement; 14, 15; 15, assignment; 15, 16; 15, 17; 16, identifier:project_files; 17, list:[]; 18, for_statement; 18, 19; 18, 23; 18, 29; 19, pattern_list; 19, 20; 19, 21; 19, 22; 20, identifier:top; 21, identifier:subdirs; 22, identifier:files; 23, call; 23, 24; 23, 27; 24, attribute; 24, 25; 24, 26; 25, identifier:os; 26, identifier:walk; 27, argument_list; 27, 28; 28, string:'.'; 29, block; 29, 30; 29, 49; 30, for_statement; 30, 31; 30, 32; 30, 33; 31, identifier:subdir; 32, identifier:subdirs; 33, block; 33, 34; 34, if_statement; 34, 35; 34, 41; 35, call; 35, 36; 35, 39; 36, attribute; 36, 37; 36, 38; 37, identifier:subdir; 38, identifier:startswith; 39, argument_list; 39, 40; 40, string:'.'; 41, block; 41, 42; 42, expression_statement; 42, 43; 43, call; 43, 44; 43, 47; 44, attribute; 44, 45; 44, 46; 45, identifier:subdirs; 46, identifier:remove; 47, argument_list; 47, 48; 48, identifier:subdir; 49, for_statement; 49, 50; 49, 51; 49, 52; 50, identifier:f; 51, identifier:files; 52, block; 52, 53; 52, 62; 53, if_statement; 53, 54; 53, 60; 54, call; 54, 55; 54, 58; 55, attribute; 55, 56; 55, 57; 56, identifier:f; 57, identifier:startswith; 58, argument_list; 58, 59; 59, string:'.'; 60, block; 60, 61; 61, continue_statement; 62, expression_statement; 62, 63; 63, call; 63, 64; 63, 67; 64, attribute; 64, 65; 64, 66; 65, identifier:project_files; 66, identifier:append; 67, argument_list; 67, 68; 68, call; 68, 69; 68, 74; 69, attribute; 69, 70; 69, 73; 70, attribute; 70, 71; 70, 72; 71, identifier:os; 72, identifier:path; 73, identifier:join; 74, argument_list; 74, 75; 74, 76; 75, identifier:top; 76, identifier:f; 77, return_statement; 77, 78; 78, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_validate_path; 3, parameters; 3, 4; 4, identifier:path; 5, block; 5, 6; 5, 13; 5, 31; 5, 45; 6, if_statement; 6, 7; 6, 10; 7, comparison_operator:is; 7, 8; 7, 9; 8, identifier:path; 9, None; 10, block; 10, 11; 11, return_statement; 11, 12; 12, None; 13, expression_statement; 13, 14; 14, assignment; 14, 15; 14, 16; 15, identifier:new_path; 16, call; 16, 17; 16, 20; 17, attribute; 17, 18; 17, 19; 18, identifier:np; 19, identifier:array; 20, argument_list; 20, 21; 21, call; 21, 22; 21, 23; 22, identifier:sorted; 23, argument_list; 23, 24; 23, 28; 24, call; 24, 25; 24, 26; 25, identifier:set; 26, argument_list; 26, 27; 27, identifier:path; 28, keyword_argument; 28, 29; 28, 30; 29, identifier:reverse; 30, True; 31, if_statement; 31, 32; 31, 39; 32, comparison_operator:!=; 32, 33; 32, 36; 33, subscript; 33, 34; 33, 35; 34, identifier:new_path; 35, integer:0; 36, subscript; 36, 37; 36, 38; 37, identifier:path; 38, integer:0; 39, block; 39, 40; 40, expression_statement; 40, 41; 41, call; 41, 42; 41, 43; 42, identifier:print; 43, argument_list; 43, 44; 44, string:"Warning: Path must be sorted largest to smallest."; 45, return_statement; 45, 46; 46, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:count; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 15; 5, 24; 5, 30; 5, 55; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:request_params; 9, call; 9, 10; 9, 11; 10, identifier:dict; 11, argument_list; 11, 12; 12, attribute; 12, 13; 12, 14; 13, identifier:self; 14, identifier:request_params; 15, expression_statement; 15, 16; 16, assignment; 16, 17; 16, 18; 17, identifier:request_url; 18, call; 18, 19; 18, 20; 19, identifier:str; 20, argument_list; 20, 21; 21, attribute; 21, 22; 21, 23; 22, identifier:self; 23, identifier:request_url; 24, expression_statement; 24, 25; 25, assignment; 25, 26; 25, 29; 26, subscript; 26, 27; 26, 28; 27, identifier:request_params; 28, string:'rows'; 29, integer:0; 30, expression_statement; 30, 31; 31, assignment; 31, 32; 31, 33; 32, identifier:result; 33, call; 33, 34; 33, 54; 34, attribute; 34, 35; 34, 53; 35, call; 35, 36; 35, 39; 36, attribute; 36, 37; 36, 38; 37, identifier:self; 38, identifier:do_http_request; 39, argument_list; 39, 40; 39, 41; 39, 42; 39, 45; 40, string:'get'; 41, identifier:request_url; 42, keyword_argument; 42, 43; 42, 44; 43, identifier:data; 44, identifier:request_params; 45, keyword_argument; 45, 46; 45, 47; 46, identifier:custom_header; 47, call; 47, 48; 47, 49; 48, identifier:str; 49, argument_list; 49, 50; 50, attribute; 50, 51; 50, 52; 51, identifier:self; 52, identifier:etiquette; 53, identifier:json; 54, argument_list; 55, return_statement; 55, 56; 56, call; 56, 57; 56, 58; 57, identifier:int; 58, argument_list; 58, 59; 59, subscript; 59, 60; 59, 63; 60, subscript; 60, 61; 60, 62; 61, identifier:result; 62, string:'message'; 63, string:'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']) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:url; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 33; 5, 52; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:request_params; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifier:_escaped_pagging; 13, argument_list; 14, expression_statement; 14, 15; 15, assignment; 15, 16; 15, 17; 16, identifier:sorted_request_params; 17, call; 17, 18; 17, 19; 18, identifier:sorted; 19, argument_list; 19, 20; 20, list_comprehension; 20, 21; 20, 24; 21, tuple; 21, 22; 21, 23; 22, identifier:k; 23, identifier:v; 24, for_in_clause; 24, 25; 24, 28; 25, pattern_list; 25, 26; 25, 27; 26, identifier:k; 27, identifier:v; 28, call; 28, 29; 28, 32; 29, attribute; 29, 30; 29, 31; 30, identifier:request_params; 31, identifier:items; 32, argument_list; 33, expression_statement; 33, 34; 34, assignment; 34, 35; 34, 36; 35, identifier:req; 36, call; 36, 37; 36, 51; 37, attribute; 37, 38; 37, 50; 38, call; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:requests; 41, identifier:Request; 42, argument_list; 42, 43; 42, 44; 42, 47; 43, string:'get'; 44, attribute; 44, 45; 44, 46; 45, identifier:self; 46, identifier:request_url; 47, keyword_argument; 47, 48; 47, 49; 48, identifier:params; 49, identifier:sorted_request_params; 50, identifier:prepare; 51, argument_list; 52, return_statement; 52, 53; 53, attribute; 53, 54; 53, 55; 54, identifier:req; 55, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sortByNamespacePrefix; 3, parameters; 3, 4; 3, 5; 4, identifier:urisList; 5, identifier:nsList; 6, block; 6, 7; 6, 11; 6, 18; 6, 53; 6, 67; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:exit; 10, list:[]; 11, expression_statement; 11, 12; 12, assignment; 12, 13; 12, 14; 13, identifier:urisList; 14, call; 14, 15; 14, 16; 15, identifier:sort_uri_list_by_name; 16, argument_list; 16, 17; 17, identifier:urisList; 18, for_statement; 18, 19; 18, 20; 18, 21; 19, identifier:ns; 20, identifier:nsList; 21, block; 21, 22; 21, 26; 21, 49; 22, expression_statement; 22, 23; 23, assignment; 23, 24; 23, 25; 24, identifier:innerexit; 25, list:[]; 26, for_statement; 26, 27; 26, 28; 26, 29; 27, identifier:uri; 28, identifier:urisList; 29, block; 29, 30; 30, if_statement; 30, 31; 30, 43; 31, call; 31, 32; 31, 38; 32, attribute; 32, 33; 32, 37; 33, call; 33, 34; 33, 35; 34, identifier:str; 35, argument_list; 35, 36; 36, identifier:uri; 37, identifier:startswith; 38, argument_list; 38, 39; 39, call; 39, 40; 39, 41; 40, identifier:str; 41, argument_list; 41, 42; 42, identifier:ns; 43, block; 43, 44; 44, expression_statement; 44, 45; 45, augmented_assignment:+=; 45, 46; 45, 47; 46, identifier:innerexit; 47, list:[uri]; 47, 48; 48, identifier:uri; 49, expression_statement; 49, 50; 50, augmented_assignment:+=; 50, 51; 50, 52; 51, identifier:exit; 52, identifier:innerexit; 53, for_statement; 53, 54; 53, 55; 53, 56; 54, identifier:uri; 55, identifier:urisList; 56, block; 56, 57; 57, if_statement; 57, 58; 57, 61; 58, comparison_operator:not; 58, 59; 58, 60; 59, identifier:uri; 60, identifier:exit; 61, block; 61, 62; 62, expression_statement; 62, 63; 63, augmented_assignment:+=; 63, 64; 63, 65; 64, identifier:exit; 65, list:[uri]; 65, 66; 66, identifier:uri; 67, return_statement; 67, 68; 68, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:sort_uri_list_by_name; 3, parameters; 3, 4; 3, 5; 4, identifier:uri_list; 5, default_parameter; 5, 6; 5, 7; 6, identifier:bypassNamespace; 7, False; 8, block; 8, 9; 8, 35; 9, function_definition; 9, 10; 9, 11; 9, 13; 9, 34; 10, function_name:get_last_bit; 11, parameters; 11, 12; 12, identifier:uri_string; 13, ERROR; 13, 14; 13, 33; 14, ERROR; 14, 15; 14, 16; 14, 19; 14, 20; 14, 31; 14, 32; 15, identifier:x; 16, attribute; 16, 17; 16, 18; 17, identifier:uri_string; 18, identifier:split; 19, ERROR; 20, keyword_argument; 20, 21; 20, 22; 21, identifier:x; 22, subscript; 22, 23; 22, 29; 23, call; 23, 24; 23, 27; 24, attribute; 24, 25; 24, 26; 25, identifier:uri_string; 26, identifier:split; 27, argument_list; 27, 28; 28, string:"/"; 29, unary_operator:-; 29, 30; 30, integer:1; 31, identifier:return; 32, identifier:x; 33, block:; 34, block:; 35, try_statement; 35, 36; 35, 65; 36, block; 36, 37; 37, if_statement; 37, 38; 37, 39; 37, 58; 38, identifier:bypassNamespace; 39, block; 39, 40; 40, return_statement; 40, 41; 41, call; 41, 42; 41, 43; 42, identifier:sorted; 43, argument_list; 43, 44; 43, 45; 44, identifier:uri_list; 45, keyword_argument; 45, 46; 45, 47; 46, identifier:key; 47, lambda; 47, 48; 47, 50; 48, lambda_parameters; 48, 49; 49, identifier:x; 50, call; 50, 51; 50, 52; 51, identifier:get_last_bit; 52, argument_list; 52, 53; 53, call; 53, 54; 53, 57; 54, attribute; 54, 55; 54, 56; 55, identifier:x; 56, identifier:__str__; 57, argument_list; 58, else_clause; 58, 59; 59, block; 59, 60; 60, return_statement; 60, 61; 61, call; 61, 62; 61, 63; 62, identifier:sorted; 63, argument_list; 63, 64; 64, identifier:uri_list; 65, except_clause; 65, 66; 66, block; 66, 67; 66, 72; 67, expression_statement; 67, 68; 68, call; 68, 69; 68, 70; 69, identifier:print; 70, argument_list; 70, 71; 71, string:"Error in <sort_uri_list_by_name>: possibly a UnicodeEncodeError"; 72, return_statement; 72, 73; 73, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:try_sort_fmt_opts; 3, parameters; 3, 4; 3, 5; 4, identifier:rdf_format_opts_list; 5, identifier:uri; 6, block; 6, 7; 6, 20; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 12; 9, pattern_list; 9, 10; 9, 11; 10, identifier:filename; 11, identifier:file_extension; 12, call; 12, 13; 12, 18; 13, attribute; 13, 14; 13, 17; 14, attribute; 14, 15; 14, 16; 15, identifier:os; 16, identifier:path; 17, identifier:splitext; 18, argument_list; 18, 19; 19, identifier:uri; 20, if_statement; 20, 21; 20, 28; 20, 37; 20, 54; 20, 71; 20, 88; 20, 101; 21, boolean_operator:or; 21, 22; 21, 25; 22, comparison_operator:==; 22, 23; 22, 24; 23, identifier:file_extension; 24, string:".ttl"; 25, comparison_operator:==; 25, 26; 25, 27; 26, identifier:file_extension; 27, string:".turtle"; 28, block; 28, 29; 29, return_statement; 29, 30; 30, list:['turtle', 'n3', 'nt', 'json-ld', 'rdfa', 'xml']; 30, 31; 30, 32; 30, 33; 30, 34; 30, 35; 30, 36; 31, string:'turtle'; 32, string:'n3'; 33, string:'nt'; 34, string:'json-ld'; 35, string:'rdfa'; 36, string:'xml'; 37, elif_clause; 37, 38; 37, 45; 38, boolean_operator:or; 38, 39; 38, 42; 39, comparison_operator:==; 39, 40; 39, 41; 40, identifier:file_extension; 41, string:".xml"; 42, comparison_operator:==; 42, 43; 42, 44; 43, identifier:file_extension; 44, string:".rdf"; 45, block; 45, 46; 46, return_statement; 46, 47; 47, list:['xml', 'turtle', 'n3', 'nt', 'json-ld', 'rdfa']; 47, 48; 47, 49; 47, 50; 47, 51; 47, 52; 47, 53; 48, string:'xml'; 49, string:'turtle'; 50, string:'n3'; 51, string:'nt'; 52, string:'json-ld'; 53, string:'rdfa'; 54, elif_clause; 54, 55; 54, 62; 55, boolean_operator:or; 55, 56; 55, 59; 56, comparison_operator:==; 56, 57; 56, 58; 57, identifier:file_extension; 58, string:".nt"; 59, comparison_operator:==; 59, 60; 59, 61; 60, identifier:file_extension; 61, string:".n3"; 62, block; 62, 63; 63, return_statement; 63, 64; 64, list:['n3', 'nt', 'turtle', 'xml', 'json-ld', 'rdfa']; 64, 65; 64, 66; 64, 67; 64, 68; 64, 69; 64, 70; 65, string:'n3'; 66, string:'nt'; 67, string:'turtle'; 68, string:'xml'; 69, string:'json-ld'; 70, string:'rdfa'; 71, elif_clause; 71, 72; 71, 79; 72, boolean_operator:or; 72, 73; 72, 76; 73, comparison_operator:==; 73, 74; 73, 75; 74, identifier:file_extension; 75, string:".json"; 76, comparison_operator:==; 76, 77; 76, 78; 77, identifier:file_extension; 78, string:".jsonld"; 79, block; 79, 80; 80, return_statement; 80, 81; 81, list:[
'json-ld',
'rdfa',
'n3',
'nt',
'turtle',
'xml',
]; 81, 82; 81, 83; 81, 84; 81, 85; 81, 86; 81, 87; 82, string:'json-ld'; 83, string:'rdfa'; 84, string:'n3'; 85, string:'nt'; 86, string:'turtle'; 87, string:'xml'; 88, elif_clause; 88, 89; 88, 92; 89, comparison_operator:==; 89, 90; 89, 91; 90, identifier:file_extension; 91, string:".rdfa"; 92, block; 92, 93; 93, return_statement; 93, 94; 94, list:[
'rdfa',
'json-ld',
'n3',
'nt',
'turtle',
'xml',
]; 94, 95; 94, 96; 94, 97; 94, 98; 94, 99; 94, 100; 95, string:'rdfa'; 96, string:'json-ld'; 97, string:'n3'; 98, string:'nt'; 99, string:'turtle'; 100, string:'xml'; 101, else_clause; 101, 102; 102, block; 102, 103; 103, return_statement; 103, 104; 104, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:collect_results; 3, parameters; 3, 4; 4, identifier:working_folder; 5, block; 5, 6; 5, 10; 5, 17; 5, 23; 5, 102; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:results; 9, dictionary; 10, expression_statement; 10, 11; 11, assignment; 11, 12; 11, 13; 12, identifier:working_folder; 13, call; 13, 14; 13, 15; 14, identifier:Path; 15, argument_list; 15, 16; 16, identifier:working_folder; 17, expression_statement; 17, 18; 18, assignment; 18, 19; 18, 20; 19, identifier:output_folders; 20, binary_operator:/; 20, 21; 20, 22; 21, identifier:working_folder; 22, string:'output_folders'; 23, for_statement; 23, 24; 23, 25; 23, 31; 24, identifier:rec_name; 25, call; 25, 26; 25, 29; 26, attribute; 26, 27; 26, 28; 27, identifier:os; 28, identifier:listdir; 29, argument_list; 29, 30; 30, identifier:output_folders; 31, block; 31, 32; 31, 46; 31, 52; 32, if_statement; 32, 33; 32, 44; 33, not_operator; 33, 34; 34, call; 34, 35; 34, 40; 35, attribute; 35, 36; 35, 39; 36, attribute; 36, 37; 36, 38; 37, identifier:os; 38, identifier:path; 39, identifier:isdir; 40, argument_list; 40, 41; 41, binary_operator:/; 41, 42; 41, 43; 42, identifier:output_folders; 43, identifier:rec_name; 44, block; 44, 45; 45, continue_statement; 46, expression_statement; 46, 47; 47, assignment; 47, 48; 47, 51; 48, subscript; 48, 49; 48, 50; 49, identifier:results; 50, identifier:rec_name; 51, dictionary; 52, for_statement; 52, 53; 52, 54; 52, 62; 53, identifier:sorter_name; 54, call; 54, 55; 54, 58; 55, attribute; 55, 56; 55, 57; 56, identifier:os; 57, identifier:listdir; 58, argument_list; 58, 59; 59, binary_operator:/; 59, 60; 59, 61; 60, identifier:output_folders; 61, identifier:rec_name; 62, block; 62, 63; 62, 71; 62, 83; 62, 89; 63, expression_statement; 63, 64; 64, assignment; 64, 65; 64, 66; 65, identifier:output_folder; 66, binary_operator:/; 66, 67; 66, 70; 67, binary_operator:/; 67, 68; 67, 69; 68, identifier:output_folders; 69, identifier:rec_name; 70, identifier:sorter_name; 71, if_statement; 71, 72; 71, 81; 72, not_operator; 72, 73; 73, call; 73, 74; 73, 79; 74, attribute; 74, 75; 74, 78; 75, attribute; 75, 76; 75, 77; 76, identifier:os; 77, identifier:path; 78, identifier:isdir; 79, argument_list; 79, 80; 80, identifier:output_folder; 81, block; 81, 82; 82, continue_statement; 83, expression_statement; 83, 84; 84, assignment; 84, 85; 84, 86; 85, identifier:SorterClass; 86, subscript; 86, 87; 86, 88; 87, identifier:sorter_dict; 88, identifier:sorter_name; 89, expression_statement; 89, 90; 90, assignment; 90, 91; 90, 96; 91, subscript; 91, 92; 91, 95; 92, subscript; 92, 93; 92, 94; 93, identifier:results; 94, identifier:rec_name; 95, identifier:sorter_name; 96, call; 96, 97; 96, 100; 97, attribute; 97, 98; 97, 99; 98, identifier:SorterClass; 99, identifier:get_result_from_folder; 100, argument_list; 100, 101; 101, identifier:output_folder; 102, return_statement; 102, 103; 103, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:run_sorter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:sorter_name_or_class; 5, identifier:recording; 6, default_parameter; 6, 7; 6, 8; 7, identifier:output_folder; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:delete_output_folder; 11, False; 12, default_parameter; 12, 13; 12, 14; 13, identifier:grouping_property; 14, None; 15, default_parameter; 15, 16; 15, 17; 16, identifier:parallel; 17, False; 18, default_parameter; 18, 19; 18, 20; 19, identifier:debug; 20, False; 21, dictionary_splat_pattern; 21, 22; 22, identifier:params; 23, block; 23, 24; 23, 54; 23, 78; 23, 86; 23, 92; 23, 100; 24, if_statement; 24, 25; 24, 30; 24, 37; 24, 46; 25, call; 25, 26; 25, 27; 26, identifier:isinstance; 27, argument_list; 27, 28; 27, 29; 28, identifier:sorter_name_or_class; 29, identifier:str; 30, block; 30, 31; 31, expression_statement; 31, 32; 32, assignment; 32, 33; 32, 34; 33, identifier:SorterClass; 34, subscript; 34, 35; 34, 36; 35, identifier:sorter_dict; 36, identifier:sorter_name_or_class; 37, elif_clause; 37, 38; 37, 41; 38, comparison_operator:in; 38, 39; 38, 40; 39, identifier:sorter_name_or_class; 40, identifier:sorter_full_list; 41, block; 41, 42; 42, expression_statement; 42, 43; 43, assignment; 43, 44; 43, 45; 44, identifier:SorterClass; 45, identifier:sorter_name_or_class; 46, else_clause; 46, 47; 47, block; 47, 48; 48, raise_statement; 48, 49; 49, parenthesized_expression; 49, 50; 50, call; 50, 51; 50, 52; 51, identifier:ValueError; 52, argument_list; 52, 53; 53, string:'Unknown sorter'; 54, expression_statement; 54, 55; 55, assignment; 55, 56; 55, 57; 56, identifier:sorter; 57, call; 57, 58; 57, 59; 58, identifier:SorterClass; 59, argument_list; 59, 60; 59, 63; 59, 66; 59, 69; 59, 72; 59, 75; 60, keyword_argument; 60, 61; 60, 62; 61, identifier:recording; 62, identifier:recording; 63, keyword_argument; 63, 64; 63, 65; 64, identifier:output_folder; 65, identifier:output_folder; 66, keyword_argument; 66, 67; 66, 68; 67, identifier:grouping_property; 68, identifier:grouping_property; 69, keyword_argument; 69, 70; 69, 71; 70, identifier:parallel; 71, identifier:parallel; 72, keyword_argument; 72, 73; 72, 74; 73, identifier:debug; 74, identifier:debug; 75, keyword_argument; 75, 76; 75, 77; 76, identifier:delete_output_folder; 77, identifier:delete_output_folder; 78, expression_statement; 78, 79; 79, call; 79, 80; 79, 83; 80, attribute; 80, 81; 80, 82; 81, identifier:sorter; 82, identifier:set_params; 83, argument_list; 83, 84; 84, dictionary_splat; 84, 85; 85, identifier:params; 86, expression_statement; 86, 87; 87, call; 87, 88; 87, 91; 88, attribute; 88, 89; 88, 90; 89, identifier:sorter; 90, identifier:run; 91, argument_list; 92, expression_statement; 92, 93; 93, assignment; 93, 94; 93, 95; 94, identifier:sortingextractor; 95, call; 95, 96; 95, 99; 96, attribute; 96, 97; 96, 98; 97, identifier:sorter; 98, identifier:get_result; 99, argument_list; 100, return_statement; 100, 101; 101, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:compute_performance; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:SC; 5, default_parameter; 5, 6; 5, 7; 6, identifier:verbose; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:output; 10, string:'dict'; 11, block; 11, 12; 11, 18; 11, 33; 11, 48; 11, 63; 11, 78; 11, 93; 11, 106; 11, 117; 11, 128; 11, 139; 11, 150; 11, 184; 11, 202; 12, expression_statement; 12, 13; 13, assignment; 13, 14; 13, 15; 14, identifier:counts; 15, attribute; 15, 16; 15, 17; 16, identifier:SC; 17, identifier:_counts; 18, expression_statement; 18, 19; 19, assignment; 19, 20; 19, 21; 20, identifier:tp_rate; 21, binary_operator:*; 21, 22; 21, 32; 22, binary_operator:/; 22, 23; 22, 29; 23, call; 23, 24; 23, 25; 24, identifier:float; 25, argument_list; 25, 26; 26, subscript; 26, 27; 26, 28; 27, identifier:counts; 28, string:'TP'; 29, subscript; 29, 30; 29, 31; 30, identifier:counts; 31, string:'TOT_ST1'; 32, integer:100; 33, expression_statement; 33, 34; 34, assignment; 34, 35; 34, 36; 35, identifier:cl_rate; 36, binary_operator:*; 36, 37; 36, 47; 37, binary_operator:/; 37, 38; 37, 44; 38, call; 38, 39; 38, 40; 39, identifier:float; 40, argument_list; 40, 41; 41, subscript; 41, 42; 41, 43; 42, identifier:counts; 43, string:'CL'; 44, subscript; 44, 45; 44, 46; 45, identifier:counts; 46, string:'TOT_ST1'; 47, integer:100; 48, expression_statement; 48, 49; 49, assignment; 49, 50; 49, 51; 50, identifier:fn_rate; 51, binary_operator:*; 51, 52; 51, 62; 52, binary_operator:/; 52, 53; 52, 59; 53, call; 53, 54; 53, 55; 54, identifier:float; 55, argument_list; 55, 56; 56, subscript; 56, 57; 56, 58; 57, identifier:counts; 58, string:'FN'; 59, subscript; 59, 60; 59, 61; 60, identifier:counts; 61, string:'TOT_ST1'; 62, integer:100; 63, expression_statement; 63, 64; 64, assignment; 64, 65; 64, 66; 65, identifier:fp_st1; 66, binary_operator:*; 66, 67; 66, 77; 67, binary_operator:/; 67, 68; 67, 74; 68, call; 68, 69; 68, 70; 69, identifier:float; 70, argument_list; 70, 71; 71, subscript; 71, 72; 71, 73; 72, identifier:counts; 73, string:'FP'; 74, subscript; 74, 75; 74, 76; 75, identifier:counts; 76, string:'TOT_ST1'; 77, integer:100; 78, expression_statement; 78, 79; 79, assignment; 79, 80; 79, 81; 80, identifier:fp_st2; 81, binary_operator:*; 81, 82; 81, 92; 82, binary_operator:/; 82, 83; 82, 89; 83, call; 83, 84; 83, 85; 84, identifier:float; 85, argument_list; 85, 86; 86, subscript; 86, 87; 86, 88; 87, identifier:counts; 88, string:'FP'; 89, subscript; 89, 90; 89, 91; 90, identifier:counts; 91, string:'TOT_ST2'; 92, integer:100; 93, expression_statement; 93, 94; 94, assignment; 94, 95; 94, 96; 95, identifier:accuracy; 96, binary_operator:*; 96, 97; 96, 105; 97, binary_operator:/; 97, 98; 97, 99; 98, identifier:tp_rate; 99, parenthesized_expression; 99, 100; 100, binary_operator:+; 100, 101; 100, 104; 101, binary_operator:+; 101, 102; 101, 103; 102, identifier:tp_rate; 103, identifier:fn_rate; 104, identifier:fp_st1; 105, integer:100; 106, expression_statement; 106, 107; 107, assignment; 107, 108; 107, 109; 108, identifier:sensitivity; 109, binary_operator:*; 109, 110; 109, 116; 110, binary_operator:/; 110, 111; 110, 112; 111, identifier:tp_rate; 112, parenthesized_expression; 112, 113; 113, binary_operator:+; 113, 114; 113, 115; 114, identifier:tp_rate; 115, identifier:fn_rate; 116, integer:100; 117, expression_statement; 117, 118; 118, assignment; 118, 119; 118, 120; 119, identifier:miss_rate; 120, binary_operator:*; 120, 121; 120, 127; 121, binary_operator:/; 121, 122; 121, 123; 122, identifier:fn_rate; 123, parenthesized_expression; 123, 124; 124, binary_operator:+; 124, 125; 124, 126; 125, identifier:tp_rate; 126, identifier:fn_rate; 127, integer:100; 128, expression_statement; 128, 129; 129, assignment; 129, 130; 129, 131; 130, identifier:precision; 131, binary_operator:*; 131, 132; 131, 138; 132, binary_operator:/; 132, 133; 132, 134; 133, identifier:tp_rate; 134, parenthesized_expression; 134, 135; 135, binary_operator:+; 135, 136; 135, 137; 136, identifier:tp_rate; 137, identifier:fp_st1; 138, integer:100; 139, expression_statement; 139, 140; 140, assignment; 140, 141; 140, 142; 141, identifier:false_discovery_rate; 142, binary_operator:*; 142, 143; 142, 149; 143, binary_operator:/; 143, 144; 143, 145; 144, identifier:fp_st1; 145, parenthesized_expression; 145, 146; 146, binary_operator:+; 146, 147; 146, 148; 147, identifier:tp_rate; 148, identifier:fp_st1; 149, integer:100; 150, expression_statement; 150, 151; 151, assignment; 151, 152; 151, 153; 152, identifier:performance; 153, dictionary; 153, 154; 153, 157; 153, 160; 153, 163; 153, 166; 153, 169; 153, 172; 153, 175; 153, 178; 153, 181; 154, pair; 154, 155; 154, 156; 155, string:'tp'; 156, identifier:tp_rate; 157, pair; 157, 158; 157, 159; 158, string:'cl'; 159, identifier:cl_rate; 160, pair; 160, 161; 160, 162; 161, string:'fn'; 162, identifier:fn_rate; 163, pair; 163, 164; 163, 165; 164, string:'fp_st1'; 165, identifier:fp_st1; 166, pair; 166, 167; 166, 168; 167, string:'fp_st2'; 168, identifier:fp_st2; 169, pair; 169, 170; 169, 171; 170, string:'accuracy'; 171, identifier:accuracy; 172, pair; 172, 173; 172, 174; 173, string:'sensitivity'; 174, identifier:sensitivity; 175, pair; 175, 176; 175, 177; 176, string:'precision'; 177, identifier:precision; 178, pair; 178, 179; 178, 180; 179, string:'miss_rate'; 180, identifier:miss_rate; 181, pair; 181, 182; 181, 183; 182, string:'false_disc_rate'; 183, identifier:false_discovery_rate; 184, if_statement; 184, 185; 184, 186; 185, identifier:verbose; 186, block; 186, 187; 186, 197; 187, expression_statement; 187, 188; 188, assignment; 188, 189; 188, 190; 189, identifier:txt; 190, call; 190, 191; 190, 194; 191, attribute; 191, 192; 191, 193; 192, identifier:_txt_performance; 193, identifier:format; 194, argument_list; 194, 195; 195, dictionary_splat; 195, 196; 196, identifier:performance; 197, expression_statement; 197, 198; 198, call; 198, 199; 198, 200; 199, identifier:print; 200, argument_list; 200, 201; 201, identifier:txt; 202, if_statement; 202, 203; 202, 206; 202, 209; 203, comparison_operator:==; 203, 204; 203, 205; 204, identifier:output; 205, string:'dict'; 206, block; 206, 207; 207, return_statement; 207, 208; 208, identifier:performance; 209, elif_clause; 209, 210; 209, 213; 210, comparison_operator:==; 210, 211; 210, 212; 211, identifier:output; 212, string:'pandas'; 213, block; 213, 214; 214, return_statement; 214, 215; 215, call; 215, 216; 215, 219; 216, attribute; 216, 217; 216, 218; 217, identifier:pd; 218, identifier:Series; 219, argument_list; 219, 220; 220, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_color_stop_rgba; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:self; 5, identifier:offset; 6, identifier:red; 7, identifier:green; 8, identifier:blue; 9, default_parameter; 9, 10; 9, 11; 10, identifier:alpha; 11, integer:1; 12, block; 12, 13; 12, 27; 13, expression_statement; 13, 14; 14, call; 14, 15; 14, 18; 15, attribute; 15, 16; 15, 17; 16, identifier:cairo; 17, identifier:cairo_pattern_add_color_stop_rgba; 18, argument_list; 18, 19; 18, 22; 18, 23; 18, 24; 18, 25; 18, 26; 19, attribute; 19, 20; 19, 21; 20, identifier:self; 21, identifier:_pointer; 22, identifier:offset; 23, identifier:red; 24, identifier:green; 25, identifier:blue; 26, identifier:alpha; 27, expression_statement; 27, 28; 28, call; 28, 29; 28, 32; 29, attribute; 29, 30; 29, 31; 30, identifier:self; 31, identifier:_check_status; 32, argument_list | 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() |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:get_all; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:fields; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:query; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:sort; 23, string:''; 24, default_parameter; 24, 25; 24, 26; 25, identifier:view; 26, string:''; 27, block; 27, 28; 28, return_statement; 28, 29; 29, call; 29, 30; 29, 35; 30, attribute; 30, 31; 30, 34; 31, attribute; 31, 32; 31, 33; 32, identifier:self; 33, identifier:_client; 34, identifier:get_all; 35, argument_list; 35, 36; 35, 37; 35, 38; 35, 41; 35, 44; 35, 47; 35, 50; 36, identifier:start; 37, identifier:count; 38, keyword_argument; 38, 39; 38, 40; 39, identifier:filter; 40, identifier:filter; 41, keyword_argument; 41, 42; 41, 43; 42, identifier:sort; 43, identifier:sort; 44, keyword_argument; 44, 45; 44, 46; 45, identifier:query; 46, identifier:query; 47, keyword_argument; 47, 48; 47, 49; 48, identifier:fields; 49, identifier:fields; 50, keyword_argument; 50, 51; 50, 52; 51, identifier:view; 52, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:get_appliances; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:fields; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:query; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:sort; 23, string:''; 24, default_parameter; 24, 25; 24, 26; 25, identifier:view; 26, string:''; 27, block; 27, 28; 27, 36; 28, expression_statement; 28, 29; 29, assignment; 29, 30; 29, 31; 30, identifier:uri; 31, binary_operator:+; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:self; 34, identifier:URI; 35, string:'/image-streamer-appliances'; 36, return_statement; 36, 37; 37, call; 37, 38; 37, 43; 38, attribute; 38, 39; 38, 42; 39, attribute; 39, 40; 39, 41; 40, identifier:self; 41, identifier:_client; 42, identifier:get_all; 43, argument_list; 43, 44; 43, 45; 43, 46; 43, 49; 43, 52; 43, 55; 43, 58; 43, 61; 44, identifier:start; 45, identifier:count; 46, keyword_argument; 46, 47; 46, 48; 47, identifier:filter; 48, identifier:filter; 49, keyword_argument; 49, 50; 49, 51; 50, identifier:sort; 51, identifier:sort; 52, keyword_argument; 52, 53; 52, 54; 53, identifier:query; 54, identifier:query; 55, keyword_argument; 55, 56; 55, 57; 56, identifier:fields; 57, identifier:fields; 58, keyword_argument; 58, 59; 58, 60; 59, identifier:view; 60, identifier:view; 61, keyword_argument; 61, 62; 61, 63; 62, identifier:uri; 63, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:get_all; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:sort; 14, string:''; 15, block; 15, 16; 16, return_statement; 16, 17; 17, call; 17, 18; 17, 23; 18, attribute; 18, 19; 18, 22; 19, attribute; 19, 20; 19, 21; 20, identifier:self; 21, identifier:_helper; 22, identifier:get_all; 23, argument_list; 23, 24; 23, 25; 23, 26; 24, identifier:start; 25, identifier:count; 26, keyword_argument; 26, 27; 26, 28; 27, identifier:sort; 28, identifier:sort | def get_all(self, start=0, count=-1, sort=''):
return self._helper.get_all(start, count, sort=sort) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:get_endpoints; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:sort; 17, string:''; 18, block; 18, 19; 18, 32; 19, expression_statement; 19, 20; 20, assignment; 20, 21; 20, 22; 21, identifier:uri; 22, call; 22, 23; 22, 26; 23, attribute; 23, 24; 23, 25; 24, string:"{}/endpoints/"; 25, identifier:format; 26, argument_list; 26, 27; 27, subscript; 27, 28; 27, 31; 28, attribute; 28, 29; 28, 30; 29, identifier:self; 30, identifier:data; 31, string:"uri"; 32, return_statement; 32, 33; 33, call; 33, 34; 33, 39; 34, attribute; 34, 35; 34, 38; 35, attribute; 35, 36; 35, 37; 36, identifier:self; 37, identifier:_helper; 38, identifier:get_all; 39, argument_list; 39, 40; 39, 41; 39, 42; 39, 45; 39, 48; 40, identifier:start; 41, identifier:count; 42, keyword_argument; 42, 43; 42, 44; 43, identifier:filter; 44, identifier:filter; 45, keyword_argument; 45, 46; 45, 47; 46, identifier:sort; 47, identifier:sort; 48, keyword_argument; 48, 49; 48, 50; 49, identifier:uri; 50, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:__findFirstMissing; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:array; 6, identifier:start; 7, identifier:end; 8, block; 8, 9; 8, 19; 8, 29; 8, 41; 8, 60; 9, if_statement; 9, 10; 9, 14; 10, parenthesized_expression; 10, 11; 11, comparison_operator:>; 11, 12; 11, 13; 12, identifier:start; 13, identifier:end; 14, block; 14, 15; 15, return_statement; 15, 16; 16, binary_operator:+; 16, 17; 16, 18; 17, identifier:end; 18, integer:1; 19, if_statement; 19, 20; 19, 26; 20, parenthesized_expression; 20, 21; 21, comparison_operator:!=; 21, 22; 21, 23; 22, identifier:start; 23, subscript; 23, 24; 23, 25; 24, identifier:array; 25, identifier:start; 26, block; 26, 27; 27, return_statement; 27, 28; 28, identifier:start; 29, expression_statement; 29, 30; 30, assignment; 30, 31; 30, 32; 31, identifier:mid; 32, call; 32, 33; 32, 34; 33, identifier:int; 34, argument_list; 34, 35; 35, binary_operator:/; 35, 36; 35, 40; 36, parenthesized_expression; 36, 37; 37, binary_operator:+; 37, 38; 37, 39; 38, identifier:start; 39, identifier:end; 40, integer:2; 41, if_statement; 41, 42; 41, 48; 42, parenthesized_expression; 42, 43; 43, comparison_operator:==; 43, 44; 43, 47; 44, subscript; 44, 45; 44, 46; 45, identifier:array; 46, identifier:mid; 47, identifier:mid; 48, block; 48, 49; 49, return_statement; 49, 50; 50, call; 50, 51; 50, 54; 51, attribute; 51, 52; 51, 53; 52, identifier:self; 53, identifier:__findFirstMissing; 54, argument_list; 54, 55; 54, 56; 54, 59; 55, identifier:array; 56, binary_operator:+; 56, 57; 56, 58; 57, identifier:mid; 58, integer:1; 59, identifier:end; 60, return_statement; 60, 61; 61, call; 61, 62; 61, 65; 62, attribute; 62, 63; 62, 64; 63, identifier:self; 64, identifier:__findFirstMissing; 65, argument_list; 65, 66; 65, 67; 65, 68; 66, identifier:array; 67, identifier:start; 68, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:get_reachable_storage_pools; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:query; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:sort; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:networks; 23, None; 24, default_parameter; 24, 25; 24, 26; 25, identifier:scope_exclusions; 26, None; 27, default_parameter; 27, 28; 27, 29; 28, identifier:scope_uris; 29, string:''; 30, block; 30, 31; 30, 39; 30, 75; 30, 109; 31, expression_statement; 31, 32; 32, assignment; 32, 33; 32, 34; 33, identifier:uri; 34, binary_operator:+; 34, 35; 34, 38; 35, attribute; 35, 36; 35, 37; 36, identifier:self; 37, identifier:URI; 38, string:"/reachable-storage-pools"; 39, if_statement; 39, 40; 39, 41; 40, identifier:networks; 41, block; 41, 42; 41, 46; 41, 56; 41, 67; 42, expression_statement; 42, 43; 43, assignment; 43, 44; 43, 45; 44, identifier:elements; 45, string:"\'"; 46, for_statement; 46, 47; 46, 48; 46, 49; 47, identifier:n; 48, identifier:networks; 49, block; 49, 50; 50, expression_statement; 50, 51; 51, augmented_assignment:+=; 51, 52; 51, 53; 52, identifier:elements; 53, binary_operator:+; 53, 54; 53, 55; 54, identifier:n; 55, string:','; 56, expression_statement; 56, 57; 57, assignment; 57, 58; 57, 59; 58, identifier:elements; 59, binary_operator:+; 59, 60; 59, 66; 60, subscript; 60, 61; 60, 62; 61, identifier:elements; 62, slice; 62, 63; 62, 64; 63, colon; 64, unary_operator:-; 64, 65; 65, integer:1; 66, string:"\'"; 67, expression_statement; 67, 68; 68, assignment; 68, 69; 68, 70; 69, identifier:uri; 70, binary_operator:+; 70, 71; 70, 74; 71, binary_operator:+; 71, 72; 71, 73; 72, identifier:uri; 73, string:"?networks="; 74, identifier:elements; 75, if_statement; 75, 76; 75, 77; 76, identifier:scope_exclusions; 77, block; 77, 78; 77, 87; 77, 100; 78, expression_statement; 78, 79; 79, assignment; 79, 80; 79, 81; 80, identifier:storage_pools_uris; 81, call; 81, 82; 81, 85; 82, attribute; 82, 83; 82, 84; 83, string:","; 84, identifier:join; 85, argument_list; 85, 86; 86, identifier:scope_exclusions; 87, expression_statement; 87, 88; 88, assignment; 88, 89; 88, 90; 89, identifier:uri; 90, conditional_expression:if; 90, 91; 90, 94; 90, 97; 91, binary_operator:+; 91, 92; 91, 93; 92, identifier:uri; 93, string:"?"; 94, comparison_operator:not; 94, 95; 94, 96; 95, string:"?"; 96, identifier:uri; 97, binary_operator:+; 97, 98; 97, 99; 98, identifier:uri; 99, string:"&"; 100, expression_statement; 100, 101; 101, augmented_assignment:+=; 101, 102; 101, 103; 102, identifier:uri; 103, call; 103, 104; 103, 107; 104, attribute; 104, 105; 104, 106; 105, string:"scopeExclusions={}"; 106, identifier:format; 107, argument_list; 107, 108; 108, identifier:storage_pools_uris; 109, return_statement; 109, 110; 110, call; 110, 111; 110, 116; 111, attribute; 111, 112; 111, 115; 112, attribute; 112, 113; 112, 114; 113, identifier:self; 114, identifier:_client; 115, identifier:get; 116, argument_list; 116, 117; 117, call; 117, 118; 117, 123; 118, attribute; 118, 119; 118, 122; 119, attribute; 119, 120; 119, 121; 120, identifier:self; 121, identifier:_client; 122, identifier:build_query_uri; 123, argument_list; 123, 124; 123, 127; 123, 130; 123, 133; 123, 136; 123, 139; 123, 142; 124, keyword_argument; 124, 125; 124, 126; 125, identifier:start; 126, identifier:start; 127, keyword_argument; 127, 128; 127, 129; 128, identifier:count; 129, identifier:count; 130, keyword_argument; 130, 131; 130, 132; 131, identifier:filter; 132, identifier:filter; 133, keyword_argument; 133, 134; 133, 135; 134, identifier:query; 135, identifier:query; 136, keyword_argument; 136, 137; 136, 138; 137, identifier:sort; 138, identifier:sort; 139, keyword_argument; 139, 140; 139, 141; 140, identifier:uri; 141, identifier:uri; 142, keyword_argument; 142, 143; 142, 144; 143, identifier:scope_uris; 144, identifier: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)) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:get_snapshots; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 13; 3, 16; 4, identifier:self; 5, identifier:volume_id_or_uri; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:count; 11, unary_operator:-; 11, 12; 12, integer:1; 13, default_parameter; 13, 14; 13, 15; 14, identifier:filter; 15, string:''; 16, default_parameter; 16, 17; 16, 18; 17, identifier:sort; 18, string:''; 19, block; 19, 20; 19, 29; 20, expression_statement; 20, 21; 21, assignment; 21, 22; 21, 23; 22, identifier:uri; 23, call; 23, 24; 23, 27; 24, attribute; 24, 25; 24, 26; 25, identifier:self; 26, identifier:__build_volume_snapshot_uri; 27, argument_list; 27, 28; 28, identifier:volume_id_or_uri; 29, return_statement; 29, 30; 30, call; 30, 31; 30, 36; 31, attribute; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:self; 34, identifier:_client; 35, identifier:get_all; 36, argument_list; 36, 37; 36, 38; 36, 39; 36, 42; 36, 45; 37, identifier:start; 38, identifier:count; 39, keyword_argument; 39, 40; 39, 41; 40, identifier:filter; 41, identifier:filter; 42, keyword_argument; 42, 43; 42, 44; 43, identifier:sort; 44, identifier:sort; 45, keyword_argument; 45, 46; 45, 47; 46, identifier:uri; 47, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:get_extra_managed_storage_volume_paths; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:sort; 17, string:''; 18, block; 18, 19; 18, 27; 19, expression_statement; 19, 20; 20, assignment; 20, 21; 20, 22; 21, identifier:uri; 22, binary_operator:+; 22, 23; 22, 26; 23, attribute; 23, 24; 23, 25; 24, identifier:self; 25, identifier:URI; 26, string:'/repair?alertFixType=ExtraManagedStorageVolumePaths'; 27, return_statement; 27, 28; 28, call; 28, 29; 28, 34; 29, attribute; 29, 30; 29, 33; 30, attribute; 30, 31; 30, 32; 31, identifier:self; 32, identifier:_client; 33, identifier:get_all; 34, argument_list; 34, 35; 34, 36; 34, 37; 34, 40; 34, 43; 35, identifier:start; 36, identifier:count; 37, keyword_argument; 37, 38; 37, 39; 38, identifier:filter; 39, identifier:filter; 40, keyword_argument; 40, 41; 40, 42; 41, identifier:sort; 42, identifier:sort; 43, keyword_argument; 43, 44; 43, 45; 44, identifier:uri; 45, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:get_attachable_volumes; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:query; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:sort; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:scope_uris; 23, string:''; 24, default_parameter; 24, 25; 24, 26; 25, identifier:connections; 26, string:''; 27, block; 27, 28; 27, 36; 27, 54; 28, expression_statement; 28, 29; 29, assignment; 29, 30; 29, 31; 30, identifier:uri; 31, binary_operator:+; 31, 32; 31, 35; 32, attribute; 32, 33; 32, 34; 33, identifier:self; 34, identifier:URI; 35, string:'/attachable-volumes'; 36, if_statement; 36, 37; 36, 38; 37, identifier:connections; 38, block; 38, 39; 39, expression_statement; 39, 40; 40, augmented_assignment:+=; 40, 41; 40, 42; 41, identifier:uri; 42, call; 42, 43; 42, 44; 43, identifier:str; 44, argument_list; 44, 45; 45, binary_operator:+; 45, 46; 45, 49; 46, binary_operator:+; 46, 47; 46, 48; 47, string:'?'; 48, string:'connections='; 49, call; 49, 50; 49, 53; 50, attribute; 50, 51; 50, 52; 51, identifier:connections; 52, identifier:__str__; 53, argument_list; 54, return_statement; 54, 55; 55, call; 55, 56; 55, 61; 56, attribute; 56, 57; 56, 60; 57, attribute; 57, 58; 57, 59; 58, identifier:self; 59, identifier:_client; 60, identifier:get_all; 61, argument_list; 61, 62; 61, 63; 61, 64; 61, 67; 61, 70; 61, 73; 61, 76; 62, identifier:start; 63, identifier:count; 64, keyword_argument; 64, 65; 64, 66; 65, identifier:filter; 66, identifier:filter; 67, keyword_argument; 67, 68; 67, 69; 68, identifier:query; 69, identifier:query; 70, keyword_argument; 70, 71; 70, 72; 71, identifier:sort; 72, identifier:sort; 73, keyword_argument; 73, 74; 73, 75; 74, identifier:uri; 75, identifier:uri; 76, keyword_argument; 76, 77; 76, 78; 77, identifier:scope_uris; 78, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:get_available_storage_systems; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:sort; 17, string:''; 18, dictionary_splat_pattern; 18, 19; 19, identifier:kwargs; 20, block; 20, 21; 20, 33; 21, expression_statement; 21, 22; 22, assignment; 22, 23; 22, 24; 23, identifier:uri; 24, call; 24, 25; 24, 30; 25, attribute; 25, 26; 25, 29; 26, attribute; 26, 27; 26, 28; 27, identifier:self; 28, identifier:_helper; 29, identifier:build_uri_with_query_string; 30, argument_list; 30, 31; 30, 32; 31, identifier:kwargs; 32, string:'/available-storage-systems'; 33, return_statement; 33, 34; 34, call; 34, 35; 34, 40; 35, attribute; 35, 36; 35, 39; 36, attribute; 36, 37; 36, 38; 37, identifier:self; 38, identifier:_helper; 39, identifier:get_all; 40, argument_list; 40, 41; 40, 44; 40, 47; 40, 50; 40, 53; 41, keyword_argument; 41, 42; 41, 43; 42, identifier:start; 43, identifier:start; 44, keyword_argument; 44, 45; 44, 46; 45, identifier:count; 46, identifier:count; 47, keyword_argument; 47, 48; 47, 49; 48, identifier:filter; 49, identifier:filter; 50, keyword_argument; 50, 51; 50, 52; 51, identifier:sort; 52, identifier:sort; 53, keyword_argument; 53, 54; 53, 55; 54, identifier:uri; 55, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 33; 2, function_name:build_query_uri; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:uri; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, integer:0; 11, default_parameter; 11, 12; 11, 13; 12, identifier:count; 13, unary_operator:-; 13, 14; 14, integer:1; 15, default_parameter; 15, 16; 15, 17; 16, identifier:filter; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:query; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:sort; 23, string:''; 24, default_parameter; 24, 25; 24, 26; 25, identifier:view; 26, string:''; 27, default_parameter; 27, 28; 27, 29; 28, identifier:fields; 29, string:''; 30, default_parameter; 30, 31; 30, 32; 31, identifier:scope_uris; 32, string:''; 33, block; 33, 34; 33, 46; 33, 58; 33, 70; 33, 82; 33, 94; 33, 106; 33, 115; 33, 122; 33, 131; 33, 149; 34, if_statement; 34, 35; 34, 36; 35, identifier:filter; 36, block; 36, 37; 37, expression_statement; 37, 38; 38, assignment; 38, 39; 38, 40; 39, identifier:filter; 40, call; 40, 41; 40, 44; 41, attribute; 41, 42; 41, 43; 42, identifier:self; 43, identifier:make_query_filter; 44, argument_list; 44, 45; 45, identifier:filter; 46, if_statement; 46, 47; 46, 48; 47, identifier:query; 48, block; 48, 49; 49, expression_statement; 49, 50; 50, assignment; 50, 51; 50, 52; 51, identifier:query; 52, binary_operator:+; 52, 53; 52, 54; 53, string:"&query="; 54, call; 54, 55; 54, 56; 55, identifier:quote; 56, argument_list; 56, 57; 57, identifier:query; 58, if_statement; 58, 59; 58, 60; 59, identifier:sort; 60, block; 60, 61; 61, expression_statement; 61, 62; 62, assignment; 62, 63; 62, 64; 63, identifier:sort; 64, binary_operator:+; 64, 65; 64, 66; 65, string:"&sort="; 66, call; 66, 67; 66, 68; 67, identifier:quote; 68, argument_list; 68, 69; 69, identifier:sort; 70, if_statement; 70, 71; 70, 72; 71, identifier:view; 72, block; 72, 73; 73, expression_statement; 73, 74; 74, assignment; 74, 75; 74, 76; 75, identifier:view; 76, binary_operator:+; 76, 77; 76, 78; 77, string:"&view="; 78, call; 78, 79; 78, 80; 79, identifier:quote; 80, argument_list; 80, 81; 81, identifier:view; 82, if_statement; 82, 83; 82, 84; 83, identifier:fields; 84, block; 84, 85; 85, expression_statement; 85, 86; 86, assignment; 86, 87; 86, 88; 87, identifier:fields; 88, binary_operator:+; 88, 89; 88, 90; 89, string:"&fields="; 90, call; 90, 91; 90, 92; 91, identifier:quote; 92, argument_list; 92, 93; 93, identifier:fields; 94, if_statement; 94, 95; 94, 96; 95, identifier:scope_uris; 96, block; 96, 97; 97, expression_statement; 97, 98; 98, assignment; 98, 99; 98, 100; 99, identifier:scope_uris; 100, binary_operator:+; 100, 101; 100, 102; 101, string:"&scopeUris="; 102, call; 102, 103; 102, 104; 103, identifier:quote; 104, argument_list; 104, 105; 105, identifier:scope_uris; 106, expression_statement; 106, 107; 107, assignment; 107, 108; 107, 109; 108, identifier:path; 109, conditional_expression:if; 109, 110; 109, 111; 109, 112; 110, identifier:uri; 111, identifier:uri; 112, attribute; 112, 113; 112, 114; 113, identifier:self; 114, identifier:_base_uri; 115, expression_statement; 115, 116; 116, call; 116, 117; 116, 120; 117, attribute; 117, 118; 117, 119; 118, identifier:self; 119, identifier:validate_resource_uri; 120, argument_list; 120, 121; 121, identifier:path; 122, expression_statement; 122, 123; 123, assignment; 123, 124; 123, 125; 124, identifier:symbol; 125, conditional_expression:if; 125, 126; 125, 127; 125, 130; 126, string:'?'; 127, comparison_operator:not; 127, 128; 127, 129; 128, string:'?'; 129, identifier:path; 130, string:'&'; 131, expression_statement; 131, 132; 132, assignment; 132, 133; 132, 134; 133, identifier:uri; 134, call; 134, 135; 134, 138; 135, attribute; 135, 136; 135, 137; 136, string:"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}"; 137, identifier:format; 138, argument_list; 138, 139; 138, 140; 138, 141; 138, 142; 138, 143; 138, 144; 138, 145; 138, 146; 138, 147; 138, 148; 139, identifier:path; 140, identifier:symbol; 141, identifier:start; 142, identifier:count; 143, identifier:filter; 144, identifier:query; 145, identifier:sort; 146, identifier:view; 147, identifier:fields; 148, identifier:scope_uris; 149, return_statement; 149, 150; 150, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 33; 2, function_name:build_query_uri; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:query; 17, string:''; 18, default_parameter; 18, 19; 18, 20; 19, identifier:sort; 20, string:''; 21, default_parameter; 21, 22; 21, 23; 22, identifier:view; 23, string:''; 24, default_parameter; 24, 25; 24, 26; 25, identifier:fields; 26, string:''; 27, default_parameter; 27, 28; 27, 29; 28, identifier:uri; 29, None; 30, default_parameter; 30, 31; 30, 32; 31, identifier:scope_uris; 32, string:''; 33, block; 33, 34; 33, 46; 33, 58; 33, 70; 33, 82; 33, 94; 33, 106; 33, 115; 33, 122; 33, 131; 33, 149; 34, if_statement; 34, 35; 34, 36; 35, identifier:filter; 36, block; 36, 37; 37, expression_statement; 37, 38; 38, assignment; 38, 39; 38, 40; 39, identifier:filter; 40, call; 40, 41; 40, 44; 41, attribute; 41, 42; 41, 43; 42, identifier:self; 43, identifier:__make_query_filter; 44, argument_list; 44, 45; 45, identifier:filter; 46, if_statement; 46, 47; 46, 48; 47, identifier:query; 48, block; 48, 49; 49, expression_statement; 49, 50; 50, assignment; 50, 51; 50, 52; 51, identifier:query; 52, binary_operator:+; 52, 53; 52, 54; 53, string:"&query="; 54, call; 54, 55; 54, 56; 55, identifier:quote; 56, argument_list; 56, 57; 57, identifier:query; 58, if_statement; 58, 59; 58, 60; 59, identifier:sort; 60, block; 60, 61; 61, expression_statement; 61, 62; 62, assignment; 62, 63; 62, 64; 63, identifier:sort; 64, binary_operator:+; 64, 65; 64, 66; 65, string:"&sort="; 66, call; 66, 67; 66, 68; 67, identifier:quote; 68, argument_list; 68, 69; 69, identifier:sort; 70, if_statement; 70, 71; 70, 72; 71, identifier:view; 72, block; 72, 73; 73, expression_statement; 73, 74; 74, assignment; 74, 75; 74, 76; 75, identifier:view; 76, binary_operator:+; 76, 77; 76, 78; 77, string:"&view="; 78, call; 78, 79; 78, 80; 79, identifier:quote; 80, argument_list; 80, 81; 81, identifier:view; 82, if_statement; 82, 83; 82, 84; 83, identifier:fields; 84, block; 84, 85; 85, expression_statement; 85, 86; 86, assignment; 86, 87; 86, 88; 87, identifier:fields; 88, binary_operator:+; 88, 89; 88, 90; 89, string:"&fields="; 90, call; 90, 91; 90, 92; 91, identifier:quote; 92, argument_list; 92, 93; 93, identifier:fields; 94, if_statement; 94, 95; 94, 96; 95, identifier:scope_uris; 96, block; 96, 97; 97, expression_statement; 97, 98; 98, assignment; 98, 99; 98, 100; 99, identifier:scope_uris; 100, binary_operator:+; 100, 101; 100, 102; 101, string:"&scopeUris="; 102, call; 102, 103; 102, 104; 103, identifier:quote; 104, argument_list; 104, 105; 105, identifier:scope_uris; 106, expression_statement; 106, 107; 107, assignment; 107, 108; 107, 109; 108, identifier:path; 109, conditional_expression:if; 109, 110; 109, 111; 109, 112; 110, identifier:uri; 111, identifier:uri; 112, attribute; 112, 113; 112, 114; 113, identifier:self; 114, identifier:_uri; 115, expression_statement; 115, 116; 116, call; 116, 117; 116, 120; 117, attribute; 117, 118; 117, 119; 118, identifier:self; 119, identifier:__validate_resource_uri; 120, argument_list; 120, 121; 121, identifier:path; 122, expression_statement; 122, 123; 123, assignment; 123, 124; 123, 125; 124, identifier:symbol; 125, conditional_expression:if; 125, 126; 125, 127; 125, 130; 126, string:'?'; 127, comparison_operator:not; 127, 128; 127, 129; 128, string:'?'; 129, identifier:path; 130, string:'&'; 131, expression_statement; 131, 132; 132, assignment; 132, 133; 132, 134; 133, identifier:uri; 134, call; 134, 135; 134, 138; 135, attribute; 135, 136; 135, 137; 136, string:"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}"; 137, identifier:format; 138, argument_list; 138, 139; 138, 140; 138, 141; 138, 142; 138, 143; 138, 144; 138, 145; 138, 146; 138, 147; 138, 148; 139, identifier:path; 140, identifier:symbol; 141, identifier:start; 142, identifier:count; 143, identifier:filter; 144, identifier:query; 145, identifier:sort; 146, identifier:view; 147, identifier:fields; 148, identifier:scope_uris; 149, return_statement; 149, 150; 150, identifier: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 |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:get_all_without_ethernet; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 12; 3, 15; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:0; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, unary_operator:-; 10, 11; 11, integer:1; 12, default_parameter; 12, 13; 12, 14; 13, identifier:filter; 14, string:''; 15, default_parameter; 15, 16; 15, 17; 16, identifier:sort; 17, string:''; 18, block; 18, 19; 18, 29; 19, expression_statement; 19, 20; 20, assignment; 20, 21; 20, 22; 21, identifier:without_ethernet_client; 22, call; 22, 23; 22, 24; 23, identifier:ResourceClient; 24, argument_list; 24, 25; 24, 28; 25, attribute; 25, 26; 25, 27; 26, identifier:self; 27, identifier:_connection; 28, string:"/rest/logical-downlinks/withoutEthernet"; 29, return_statement; 29, 30; 30, call; 30, 31; 30, 34; 31, attribute; 31, 32; 31, 33; 32, identifier:without_ethernet_client; 33, identifier:get_all; 34, argument_list; 34, 35; 34, 36; 34, 37; 34, 40; 35, identifier:start; 36, identifier:count; 37, keyword_argument; 37, 38; 37, 39; 38, identifier:filter; 39, identifier:filter; 40, keyword_argument; 40, 41; 40, 42; 41, identifier:sort; 42, identifier: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) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:reduce_sort; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:js_cmp; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:options; 10, None; 11, block; 11, 12; 11, 23; 11, 32; 12, if_statement; 12, 13; 12, 16; 13, comparison_operator:is; 13, 14; 13, 15; 14, identifier:options; 15, None; 16, block; 16, 17; 17, expression_statement; 17, 18; 18, assignment; 18, 19; 18, 20; 19, identifier:options; 20, call; 20, 21; 20, 22; 21, identifier:dict; 22, argument_list; 23, if_statement; 23, 24; 23, 25; 24, identifier:js_cmp; 25, block; 25, 26; 26, expression_statement; 26, 27; 27, assignment; 27, 28; 27, 31; 28, subscript; 28, 29; 28, 30; 29, identifier:options; 30, string:'arg'; 31, identifier:js_cmp; 32, return_statement; 32, 33; 33, call; 33, 34; 33, 37; 34, attribute; 34, 35; 34, 36; 35, identifier:self; 36, identifier:reduce; 37, argument_list; 37, 38; 37, 39; 38, string:"Riak.reduceSort"; 39, keyword_argument; 39, 40; 39, 41; 40, identifier:options; 41, identifier: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