nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:sortby; 3, parameters; 4, block; 5, identifier:self; 6, identifier:ntd; 7, expression_statement; 8, if_statement; 9, comment:"""Return function for sorting."""; 10, comparison_operator:'reldepth' in self.grprobj.gosubdag.prt_attr['flds']; 11, block; 12, else_clause; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 10, 13; 10, 14; 11, 15; 12, 16; 13, 17; 14, 18; 14, 19; 15, 20; 16, 21; 18, 22; 18, 23; 19, 24; 20, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 28, 39; 29, 40; 29, 41; 33, 42; 34, 4...
def sortby(self, ntd): """Return function for sorting.""" if 'reldepth' in self.grprobj.gosubdag.prt_attr['flds']: return [ntd.NS, -1*ntd.dcnt, ntd.reldepth] else: return [ntd.NS, -1*ntd.dcnt, ntd.depth]
0, module; 1, function_definition; 2, function_name:get_nts_sorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:hdrgo_prt; 7, identifier:hdrgos; 8, identifier:hdrgo_sort; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Return a flat list o...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 9, 13; 10, 14; 11, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 19, 21; 19, 22; 20, 23; 20, 24; 20, 25; 20, 26
def get_nts_sorted(self, hdrgo_prt, hdrgos, hdrgo_sort): """Return a flat list of grouped and sorted GO terms.""" nts_flat = [] self.get_sorted_hdrgo2usrgos(hdrgos, nts_flat, hdrgo_prt, hdrgo_sort) return nts_flat
0, module; 1, function_definition; 2, function_name:get_sorted_hdrgo2usrgos; 3, parameters; 4, block; 5, identifier:self; 6, identifier:hdrgos; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, comment:# Return user-specfied sort or default sort of header and user GO IDs; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 12, 26; 13, 27; 15, 28; 16, 29; 16, 30; 17, 31; 17, 32; 17, 33; 18, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 31, 44; 3...
def get_sorted_hdrgo2usrgos(self, hdrgos, flat_list=None, hdrgo_prt=True, hdrgo_sort=True): """Return GO IDs sorting using go2nt's namedtuple.""" # Return user-specfied sort or default sort of header and user GO IDs sorted_hdrgos_usrgos = [] h2u_get = self.grprobj.hdrgo2usrgos.get ...
0, module; 1, function_definition; 2, function_name:_init_hdrgo_sortby; 3, parameters; 4, block; 5, identifier:self; 6, identifier:hdrgo_sortby; 7, identifier:sortby; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:"""Initialize header sort function."""; 13, comparison_oper...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 9, 14; 10, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 17, 24; 17, 25; 20, 26; 23, 27
def _init_hdrgo_sortby(self, hdrgo_sortby, sortby): """Initialize header sort function.""" if hdrgo_sortby is not None: return hdrgo_sortby if sortby is not None: return sortby return self.sortby
0, module; 1, function_definition; 2, function_name:_get_sortgo; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:"""Get function for sorting GO terms in a list of namedtuples."""; 10, comparison_operator:'sortgo' in self.datobj.kws; 11, block; 12, b...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 10, 14; 11, 15; 12, 16; 12, 17; 13, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 26, 31; 26, 32; 27, 33; 28, 34; 28, 35; 31, 36; 31, 37; 34, 38; 34, 39; 38, 40; 38, 41
def _get_sortgo(self): """Get function for sorting GO terms in a list of namedtuples.""" if 'sortgo' in self.datobj.kws: return self.datobj.kws['sortgo'] return self.datobj.grprdflt.gosubdag.prt_attr['sort'] + "\n"
0, module; 1, function_definition; 2, function_name:_get_sorted_section; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nts_section; 7, expression_statement; 8, comment:#pylint: disable=unnecessary-lambda; 9, if_statement; 10, if_statement; 11, comment:# print('SORT GO IDS IN A SECTION'); 12, return_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 9, 14; 9, 15; 10, 16; 10, 17; 12, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 26, 35; 26, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 36, 43; ...
def _get_sorted_section(self, nts_section): """Sort GO IDs in each section, if requested by user.""" #pylint: disable=unnecessary-lambda if self.section_sortby is True: return sorted(nts_section, key=lambda nt: self.sortgos.usrgo_sortby(nt)) if self.section_sortby is False or...
0, module; 1, function_definition; 2, function_name:get_sections_2dnt; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sec2d_go; 7, expression_statement; 8, return_statement; 9, comment:"""Return a sections list containing sorted lists of namedtuples."""; 10, list_comprehension; 11, tuple; 12, for_in_clause;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 17, 21; 17, 22; 18, 23
def get_sections_2dnt(self, sec2d_go): """Return a sections list containing sorted lists of namedtuples.""" return [(nm, self.get_ntgos_sorted(gos)) for nm, gos in sec2d_go]
0, module; 1, function_definition; 2, function_name:get_ntgos_sorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:hdrgos; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Return sorted Grouper namedtuples if there are user GO IDs underneath."""; 11, assignment; 12, ca...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 19, 25; 20, 26; 20, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 27, 33; 27, 34; 32, 35; 32, 36
def get_ntgos_sorted(self, hdrgos): """Return sorted Grouper namedtuples if there are user GO IDs underneath.""" go2nt = self.grprobj.go2nt return sorted([go2nt[go] for go in hdrgos if go in go2nt], key=self.fncsortnt)
0, module; 1, function_definition; 2, function_name:get_sortobj; 3, parameters; 4, block; 5, identifier:self; 6, identifier:goea_results; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 15, 24; 16, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 27, 38; 27, 39; 29, 40; 29, 41; 31, 42; 31, 43; 33, ...
def get_sortobj(self, goea_results, **kws): """Return a Grouper object, given a list of GOEnrichmentRecord.""" nts_goea = MgrNtGOEAs(goea_results).get_goea_nts_prt(**kws) goids = set(nt.GO for nt in nts_goea) go2nt = {nt.GO:nt for nt in nts_goea} grprobj = Grouper("GOEA", goids, ...
0, module; 1, function_definition; 2, function_name:_get_sorted_relationships; 3, parameters; 4, block; 5, identifier:self; 6, identifier:goterm; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, comment:"""Traverse GO Terms above the current GO Term. Th...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 23, 34; 23, 35; 24, 36; 25, 37; 25, 38; 27, 39; 28, 40; 28, 41; 29, 42; 34, 43; ...
def _get_sorted_relationships(self, goterm): """Traverse GO Terms above the current GO Term. Then add current GO Term to sorted.""" if goterm.id in self.goids_seen: return self.goids_seen.add(goterm.id) for goterm_upper in goterm.get_goterms_upper(): self._get_sor...
0, module; 1, function_definition; 2, function_name:write_dag; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, for_statement; 9, identifier:out; 10, attribute; 11, comment:"""Write info for all GO Terms in obo file, sorted numerically."""; 12, identifier:rec; 13, call; 14,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 10, 15; 10, 16; 13, 17; 13, 18; 14, 19; 18, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 25, 28; 25, 29; 29, 30; 29, 31
def write_dag(self, out=sys.stdout): """Write info for all GO Terms in obo file, sorted numerically.""" for rec in sorted(self.values()): print(rec, file=out)
0, module; 1, function_definition; 2, function_name:sort_nts; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nt_list; 7, identifier:codekey; 8, expression_statement; 9, comment:# Problem is that some members in the nt_list do NOT have; 10, comment:# codekey=EvidenceCode, then it returns None, which breaks p...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 8, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 18, 21; 18, 22; 20, 23; 20, 24; 21, 25; 22, 26; 22, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 27, 33; 30, 34; 30, 35; 32, 36; 32, 37; 33, 38; 37, 39; 37, 40
def sort_nts(self, nt_list, codekey): """Sort list of namedtuples such so evidence codes in same order as code2nt.""" # Problem is that some members in the nt_list do NOT have # codekey=EvidenceCode, then it returns None, which breaks py34 and 35 # The fix here is that for these members,...
0, module; 1, function_definition; 2, function_name:prt_gos; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, comment:# deprecated; 10, comment:# Keyword arguments (control content): hdrgo_prt section_prt use_sections; 11, comment:# desc2nts con...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 8, 19; 12, 20; 14, 21; 15, 22; 17, 23; 17, 24; 20, 25; 20, 26; 21, 27; 21, 28; 26, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 35, 39; 35, 40; 38, 41; 39, 42; 39, 43; 40, ...
def prt_gos(self, prt=sys.stdout, **kws_usr): """Sort user GO ids, grouped under broader GO terms or sections. Print to screen.""" # deprecated # Keyword arguments (control content): hdrgo_prt section_prt use_sections # desc2nts contains: (sections hdrgo_prt sortobj) or (flat hdrgo_prt s...
0, module; 1, function_definition; 2, function_name:get_nts_flat; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# Either there are no sections OR we are not using them; 10, if_statement; 11, if_statement; 12, return_statement; 13, identifier...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 10, 18; 10, 19; 11, 20; 11, 21; 12, 22; 18, 23; 18, 24; 19, 25; 20, 26; 21, 27; 23, 28; 23, 29; 24, 30; 25, 31; 27, 32; 28, 33; 28, 34; 31, 35; 31, 36; 32, 37; 32, 38; 35, 39; 35, 40; 36, 41; 36, 42; 36, 43; 37...
def get_nts_flat(self, hdrgo_prt=True, use_sections=True): """Return a flat list of sorted nts.""" # Either there are no sections OR we are not using them if self.sectobj is None or not use_sections: return self.sortgos.get_nts_sorted( hdrgo_prt, hdrgo...
0, module; 1, function_definition; 2, function_name:_adjust_prt_flds; 3, parameters; 4, block; 5, identifier:self; 6, identifier:kws_xlsx; 7, identifier:desc2nts; 8, identifier:shade_hdrgos; 9, expression_statement; 10, comment:# Use xlsx prt_flds from the user, if provided; 11, if_statement; 12, comment:# If the user ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 9, 23; 11, 24; 11, 25; 13, 26; 16, 27; 18, 28; 21, 29; 21, 30; 21, 31; 22, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 31, 42; 32, 43; 32, 44; ...
def _adjust_prt_flds(self, kws_xlsx, desc2nts, shade_hdrgos): """Print user-requested fields or provided fields minus info fields.""" # Use xlsx prt_flds from the user, if provided if "prt_flds" in kws_xlsx: return kws_xlsx["prt_flds"] # If the user did not provide specific f...
0, module; 1, function_definition; 2, function_name:_get_shade_hdrgos; 3, parameters; 4, block; 5, dictionary_splat_pattern; 6, expression_statement; 7, comment:# KWS: shade_hdrgos hdrgo_prt section_sortby top_n; 8, if_statement; 9, comment:# Return user-sepcified hdrgo_prt, if provided; 10, if_statement; 11, comment:#...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 5, 18; 6, 19; 8, 20; 8, 21; 10, 22; 10, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 20, 29; 20, 30; 21, 31; 22, 32; 22, 33; 23, 34; 24, 35; 24, 36; 25, 37; 26, 38; 26, 39; 27, 40; 29, 41; 31, 42; 32, 43; 34, 44...
def _get_shade_hdrgos(**kws): """If no hdrgo_prt specified, and these conditions are present -> hdrgo_prt=F.""" # KWS: shade_hdrgos hdrgo_prt section_sortby top_n if 'shade_hdrgos' in kws: return kws['shade_hdrgos'] # Return user-sepcified hdrgo_prt, if provided if 'h...
0, module; 1, function_definition; 2, function_name:dflt_sortby_objgoea; 3, parameters; 4, block; 5, identifier:goea_res; 6, expression_statement; 7, return_statement; 8, comment:"""Default sorting of GOEA results."""; 9, list; 10, call; 11, call; 12, call; 13, call; 14, call; 15, identifier:getattr; 16, argument_list;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 9, 12; 9, 13; 9, 14; 10, 15; 10, 16; 11, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 14, 24; 16, 25; 16, 26; 18, 27; 18, 28; 20, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 28, 36; 30, 37; 32, 38; 34, 39
def dflt_sortby_objgoea(goea_res): """Default sorting of GOEA results.""" return [getattr(goea_res, 'enrichment'), getattr(goea_res, 'namespace'), getattr(goea_res, 'p_uncorrected'), getattr(goea_res, 'depth'), getattr(goea_res, 'GO')]
0, module; 1, function_definition; 2, function_name:dflt_sortby_ntgoea; 3, parameters; 4, block; 5, identifier:ntgoea; 6, expression_statement; 7, return_statement; 8, comment:"""Default sorting of GOEA results stored in namedtuples."""; 9, list; 10, attribute; 11, attribute; 12, attribute; 13, attribute; 14, attribute...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 9, 12; 9, 13; 9, 14; 10, 15; 10, 16; 11, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 14, 24
def dflt_sortby_ntgoea(ntgoea): """Default sorting of GOEA results stored in namedtuples.""" return [ntgoea.enrichment, ntgoea.namespace, ntgoea.p_uncorrected, ntgoea.depth, ntgoea.GO]
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:x; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, import_from_statement; 12, expression_statement; 13, return_statement; 14, identifier:axis; 15, unary_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 15, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 29, 36; 30, 37; 33, 38; 33, 39; 33, 40; 35, 41; 35, 42; 35, 43; 35, 44...
def sort(x, axis=-1, reverse=False, with_index=False, only_index=False): """Sorts the elements of `x` along a given `axis` in ascending order by value. A negative `axis` counts from the last dimension of `x`, so the default of -1 sorts along the last dimension. If `reverse` is True, then the elements ar...
0, module; 1, function_definition; 2, function_name:optimize; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# load benchmarks results; 8, with_statement; 9, comment:# optimize; 10, for_statement; 11, comment:"""Sort algorithm implementations by speed. """; 12, with_clause; 13,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 8, 12; 8, 13; 10, 14; 10, 15; 10, 16; 12, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 16, 25; 16, 26; 16, 27; 16, 28; 17, 29; 18, 30; 21, 31; 21, 32; 23, 33; 24, 34; 24, 35; 26, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 33, 42; 33, 43...
def optimize(self): """Sort algorithm implementations by speed. """ # load benchmarks results with open(LIBRARIES_FILE, 'r') as f: libs_data = json.load(f) # optimize for alg, libs_names in libs_data.items(): libs = self.get_libs(alg) i...
0, module; 1, function_definition; 2, function_name:sort_common_members; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, exp...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 5, 15; 6, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 14, 28; 16, 29; 16, 30; 17, 31; 17, 32; 18, 33; 18, 34; 19, 35; 19, 36; 20, 37; 20, 38; 21, 39; 21, 40; 22, 41; 23, 42; 23, 43; 26, ...
def sort_common_members(): """Sorts the keys and members""" filename = PREFIX + '/common_members.json' sorted_json_data = {} json_data = read_json(filename) all_keys = [] for key, value in json_data.items(): all_keys.append(key) sorted_keys = sorted(all_keys) for key in sorted...
0, module; 1, function_definition; 2, function_name:_ConstructPartitions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:collection_links; 7, identifier:partitions_per_node; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expressio...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 14, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 21, 30; 21, 31; 22, 32; 22, 33; 25, 34; 25, 35; 27, 36; 27, 37; 30, 38; 31, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3...
def _ConstructPartitions(self, collection_links, partitions_per_node): """Constructs the partitions in the consistent ring by assigning them to collection nodes using the hashing algorithm and then finally sorting the partitions based on the hash value. """ collections_node_count = len(c...
0, module; 1, function_definition; 2, function_name:parse_leap_seconds; 3, parameters; 4, block; 5, identifier:fileobj; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, with_statement; 11, comment:# The file went out of date at the beginning of July 2016, and kept; 12, co...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 6, 25; 7, 26; 8, 27; 8, 28; 8, 29; 8, 30; 9, 31; 10, 32; 10, 33; 10, 34; 14, 35; 15, 36; 16, 37; 17, 38; 18, 39; 19, 40; 20, 41; 21, 42; 22, 43; 23, 44; 24, 45; ...
def parse_leap_seconds(fileobj): """Parse the IERS file ``Leap_Second.dat``. The leap dates array can be searched with:: index = np.searchsorted(leap_dates, jd, 'right') The resulting index allows (TAI - UTC) to be fetched with:: offset = leap_offsets[index] """ lines = iter(fil...
0, module; 1, function_definition; 2, function_name:build_delta_t_table; 3, parameters; 4, block; 5, identifier:delta_t_recent; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# Prefer USNO over Morrison and Stephenson where they overlap.; 10, expression_statement; 11, expression_s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 6, 25; 7, 26; 8, 27; 10, 28; 11, 29; 12, 30; 14, 31; 15, 32; 16, 33; 17, 34; 19, 35; 20, 36; 21, 37; 22, 38; 23, 39; 24, 40; 26, 41; 26, 42; 27, 43; 27, 44; 28, ...
def build_delta_t_table(delta_t_recent): """Build a table for interpolating Delta T. Given a 2xN array of recent Delta T values, whose element 0 is a sorted array of TT Julian dates and element 1 is Delta T values, this routine returns a more complete table by prepending two built-in data sources t...
0, module; 1, function_definition; 2, function_name:plot_confusion_matrix_with_cv; 3, parameters; 4, block; 5, identifier:clf; 6, identifier:X; 7, identifier:y; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 3, 19; 3, 20; 3, 21; 3, 22; 3, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 15, 43; 15, 44; 16, 45; 1...
def plot_confusion_matrix_with_cv(clf, X, y, labels=None, true_labels=None, pred_labels=None, title=None, normalize=False, hide_zeros=False, x_tick_rotation=0, do_cv=True, cv=None, shu...
0, module; 1, function_definition; 2, function_name:plot_confusion_matrix; 3, parameters; 4, block; 5, identifier:y_true; 6, identifier:y_pred; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parame...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 4, 40; 7, 41; 7, 42; 8, 43; 8, 44; 9, 45; 9, 46; 10, 47;...
def plot_confusion_matrix(y_true, y_pred, labels=None, true_labels=None, pred_labels=None, title=None, normalize=False, hide_zeros=False, x_tick_rotation=0, ax=None, figsize=None, cmap='Blues', title_fontsize="large", ...
0, module; 1, function_definition; 2, function_name:sorting; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:"""Return fields to sort by including sort name for SQLAlchemy and row sort parameter for other ORMs :return list: a list o...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 10, 14; 11, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 16, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 20, 28; 21, 29; 21, 30; 23, 31; 23, 32; 24, 33; 24, 34; 24, 35; 24, 36; 24, 37; 24, 38; 31, 39; 31, 40; 32, 41; 33, 42; 34, 4...
def sorting(self): """Return fields to sort by including sort name for SQLAlchemy and row sort parameter for other ORMs :return list: a list of sorting information Example of return value:: [ {'field': 'created_at', 'order': 'desc'}, ] ...
0, module; 1, function_definition; 2, function_name:filter_query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, identifier:filter_info; 8, identifier:model; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""Filter query according to jsonapi 1.0 :param Query ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 9, 12; 10, 13; 10, 14; 11, 15; 14, 16; 14, 17; 16, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 21, 24; 21, 25; 23, 26; 23, 27; 25, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 30, 34; 30, 35; 33, 36
def filter_query(self, query, filter_info, model): """Filter query according to jsonapi 1.0 :param Query query: sqlalchemy query to sort :param filter_info: filter information :type filter_info: dict or None :param DeclarativeMeta model: an sqlalchemy model :return Query...
0, module; 1, function_definition; 2, function_name:sort_query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, identifier:sort_info; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Sort query according to jsonapi 1.0 :param Query query: sqlalchemy query to ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 9, 14; 10, 15; 14, 16; 14, 17; 14, 18; 16, 19; 17, 20; 17, 21; 18, 22; 19, 23; 19, 24; 20, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 28, 34; 28, 35; 30, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43;...
def sort_query(self, query, sort_info): """Sort query according to jsonapi 1.0 :param Query query: sqlalchemy query to sort :param list sort_info: sort information :return Query: the sorted query """ for sort_opt in sort_info: field = sort_opt['field'] ...
0, module; 1, function_definition; 2, function_name:_get_log_entries; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, if_statement; 10, identifier:List; 11, type_parameter; 12, comment:""" Return the log entries for this computation and its children. T...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 7, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 11, 16; 13, 17; 13, 18; 14, 19; 15, 20; 16, 21; 19, 22; 20, 23; 21, 24; 21, 25; 23, 26; 25, 27; 25, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 29, 35; 30, 36; 32, 37; 35, 38; 35, 39; 37, 40; 37, 41; 39, 42; 40, 43; ...
def _get_log_entries(self) -> List[Tuple[int, bytes, List[int], bytes]]: """ Return the log entries for this computation and its children. They are sorted in the same order they were emitted during the transaction processing, and include the sequential counter as the first element of th...
0, module; 1, function_definition; 2, function_name:sort_by_size; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# sort groups by number of elements; 11, expression_statement; 12, comment:# if group-limit is provided, c...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 11, 23; 13, 24; 13, 25; 13, 26; 15, 27; 15, 28; 21, 29; 23, 30; 23, 31; 24, 32; 24, 33; 26, 34; 26, 35; 26, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 30, 42; 30, 43; 31, 44;...
def sort_by_size(self, group_limit=None, discard_others=False, others_label='others'): """ Sort the groups by the number of elements they contain, descending. Also has option to limit the number of groups. If this option is chosen, the remaining elements are placed ...
0, module; 1, function_definition; 2, function_name:get_comments; 3, parameters; 4, block; 5, identifier:self; 6, identifier:resource; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, try_statement; 11, return_statement; 12, identifier:before; 13, None; 14, comment:""" Get comments for a file...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 25, 32; 27, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 33, 42; 33, 43; ...
def get_comments(self, resource, before=None): """ Get comments for a file or URL. Retrieve a list of VirusTotal Community comments for a given file or URL. VirusTotal Community comments are user submitted reviews on a given item, these comments may contain anything from the in-the-wild locatio...
0, module; 1, function_definition; 2, function_name:clean_fail; 3, parameters; 4, block; 5, identifier:func; 6, expression_statement; 7, function_definition; 8, return_statement; 9, string; 10, function_name:func_wrapper; 11, parameters; 12, block; 13, identifier:func_wrapper; 14, string_content:A decorator to cleanly ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 15, 18; 16, 19; 17, 20; 17, 21; 20, 22; 21, 23; 21, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 28, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 35, 41; 35, 42; 36, 43;...
def clean_fail(func): ''' A decorator to cleanly exit on a failed call to AWS. catch a `botocore.exceptions.ClientError` raised from an action. This sort of error is raised if you are targeting a region that isn't set up (see, `credstash setup`. ''' def func_wrapper(*args, **kwargs): ...
0, module; 1, function_definition; 2, function_name:parse_header; 3, parameters; 4, block; 5, identifier:cls; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, identifier:value; 10, string; 11, comment:"""Parse HTTP accept header and return instances sorted by weight."""; 12, yield; 13, string_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 10, 13; 12, 14; 14, 15; 14, 16; 16, 17; 16, 18; 17, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 24, 29; 24, 30; 25, 31; 27, 32; 27, 33; 28, 34; 28, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 36, 4...
def parse_header(cls, value='*/*'): """Parse HTTP accept header and return instances sorted by weight.""" yield from sorted(( cls.from_string(token.strip()) for token in value.split(',') if token.strip() ), reverse=True)
0, module; 1, function_definition; 2, function_name:sort_canonical; 3, parameters; 4, block; 5, identifier:keyword; 6, identifier:stmts; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, comment:# keep the order of data definition statements and case; 11, expression_statement; 12, for_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 8, 17; 8, 18; 9, 19; 11, 20; 12, 21; 12, 22; 12, 23; 12, 24; 14, 25; 15, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 24, 38; 24, 39; 25, 40; 25, 41; 27, 42; 29, 43; 33, ...
def sort_canonical(keyword, stmts): """Sort all `stmts` in the canonical order defined by `keyword`. Return the sorted list. The `stmt` list is not modified. If `keyword` does not have a canonical order, the list is returned as is. """ try: (_arg_type, subspec) = stmt_map[keyword] ...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, expression_st...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 15, 43; 16, 44; 16, 45; 1...
def sort(self, key, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False): '''Sort and return the list, set or sorted set at ``key``. ``start`` and ``num`` allow for paging through the sorted data ``by`` allows using an external key to weight ...
0, module; 1, function_definition; 2, function_name:get_url_filemeta; 3, parameters; 4, block; 5, identifier:url; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, try_statement; 12, return_statement; 13, comment:""" Request HTML for the page at the URL in...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 12, 23; 14, 24; 14, 25; 15, 26; 15, 27; 16, 28; 17, 29; 17, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 25, 41; 25, 42; 28, 43; 29,...
def get_url_filemeta(url): """ Request HTML for the page at the URL indicated and return the url, filename, and remote size TODO: just add remote_size and basename and filename attributes to the urlparse object instead of returning a dict >>> sorted(get_url_filemeta('mozilla.com').items()) [...
0, module; 1, function_definition; 2, function_name:offline_plotly_scatter_bubble; 3, parameters; 4, block; 5, identifier:df; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_pa...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 6, 33; 6, 34; 7, 35; 7, 36; 8, 37; 8, 38; 9, 39; 9, 40; 10, 41; 10, 42; 11, 43; 11, 44; 12, 45; 12, 46; 1...
def offline_plotly_scatter_bubble(df, x='x', y='y', size_col='size', text_col='text', category_col='category', possible_categories=None, filename=None, config={'displaylogo': False}, x...
0, module; 1, function_definition; 2, function_name:get_acronyms; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, identifier:manuscript; 11, call; 12, comment:""" Find all the 2 and 3-letter acronyms in the manuscript and return...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 5, 11; 6, 12; 7, 13; 8, 14; 8, 15; 8, 16; 9, 17; 11, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 25, 32; 26, 33; 26, 34; 26, 35; 28, 36; 29, 37; 29, 38; 31, 39; 35, 40; 35, 41; 36, 42; 36, 43; 40...
def get_acronyms(manuscript=os.path.expanduser('~/code/nlpia/lane/manuscript')): """ Find all the 2 and 3-letter acronyms in the manuscript and return as a sorted list of tuples """ acronyms = [] for f, lines in get_lines(manuscript): for line in lines: matches = CRE_ACRONYM.finditer(lin...
0, module; 1, function_definition; 2, function_name:_find; 3, parameters; 4, block; 5, identifier:self; 6, identifier:rpcmethod; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 14, 26; 15, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26,...
async def _find(self, rpcmethod): """ Get either a value or list of nodes. Args: rpcmethod: The protocol's callfindValue or call_find_node. The process: 1. calls find_* to current ALPHA nearest not already queried nodes, adding results to current near...
0, module; 1, function_definition; 2, function_name:match_key; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, identifier:Tuple; 13, type_parameter; 14, comment:"""A Key to sort the rules by weight for m...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 5, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 13, 19; 13, 20; 13, 21; 13, 22; 15, 23; 15, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 19, 32; 20, 33; 21, 34; 22, 35; 23, 36; 23, 37; 25, 38; 27, 39; 27, 40; 28, 41; 30, 42; 31, 43; 3...
def match_key(self) -> Tuple[bool, bool, int, List[WeightedPart]]: """A Key to sort the rules by weight for matching. The key leads to ordering: - By first order by defaults as they are simple rules without conversions. - Then on the complexity of the rule, i.e. does it ha...
0, module; 1, function_definition; 2, function_name:build_key; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:Tuple; 12, type_parameter; 13, comment:"""A Key to sort the rules by weight for building. The key ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 19, 26; 19, 27; 21, 28; 22, 29; 23, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 32, 37; 34, 38; 36, 39; 36, 40; 36, 41; 38, 42; 38, 43; ...
def build_key(self) -> Tuple[bool, int]: """A Key to sort the rules by weight for building. The key leads to ordering: - By routes with defaults first, as these must be evaulated for building before ones without. - Then the more complex routes (most converted parts). ...
0, module; 1, function_definition; 2, function_name:load_ui_file; 3, parameters; 4, block; 5, identifier:name; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""loads interface from the glade file; sorts out the path business"""; 11, assignment; 12, call; 13,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 22, 25; 22, 26; 25, 27; 25, 28; 26, 29; 26, 30; 27, 31; 27, 32; 29, 33; 29, 34
def load_ui_file(name): """loads interface from the glade file; sorts out the path business""" ui = gtk.Builder() ui.add_from_file(os.path.join(runtime.data_dir, name)) return ui
0, module; 1, function_definition; 2, function_name:__remove_category; 3, parameters; 4, block; 5, identifier:self; 6, identifier:id; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, com...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 24, 33; 24, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 3...
def __remove_category(self, id): """move all activities to unsorted and remove category""" affected_query = """ SELECT id FROM facts WHERE activity_id in (SELECT id FROM activities where category_id=?) """ affected_ids = [res[0] for res in self.fet...
0, module; 1, function_definition; 2, function_name:_sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:"""sort sprites by z_order"""; 9, assignment; 10, subscript; 11, call; 12, attribute; 13, string; 14, identifier:sorted; 15, argument_list; 16, identifier:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 15, 19; 15, 20; 19, 21; 19, 22; 20, 23; 20, 24; 24, 25; 24, 26; 25, 27; 26, 28; 26, 29
def _sort(self): """sort sprites by z_order""" self.__dict__['_z_ordered_sprites'] = sorted(self.sprites, key=lambda sprite:sprite.z_order)
0, module; 1, function_definition; 2, function_name:_get_mouse_cursor; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, comment:"""Determine mouse cursor. By default look for self.mouse_cursor is defined and take that. Otherwise use gdk.CursorType.FLEUR for dragg...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 7, 12; 9, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 28, 36; 35, 37; 35, 38; 36, 39; 36, 40; 37, 41; 37, 42; 39, 43;...
def _get_mouse_cursor(self): """Determine mouse cursor. By default look for self.mouse_cursor is defined and take that. Otherwise use gdk.CursorType.FLEUR for draggable sprites and gdk.CursorType.HAND2 for interactive sprites. Defaults to scenes cursor. """ if self.mouse_...
0, module; 1, function_definition; 2, function_name:entries; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, comment:""" Return the sorted list of entries in this container, each represented by its...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 24, 35; 25, 36; 25, 37; 30, 38; 30, 39; 32, 40; 32, 41; 35, 42; 35, 43; 4...
def entries(self): """ Return the sorted list of entries in this container, each represented by its full path inside the container. :rtype: list of strings (path) :raises: TypeError: if this container does not exist :raises: OSError: if an error occurred reading the give...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, expression_statement; 15...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 14, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 20, 36; 21, 37; 21, 38; 23, 39; 23, 40; 24, 41; 24, 42; 24, 43; 25, ...
def sort(self): """ Sort the fragments in the list. :raises ValueError: if there is a fragment which violates the list constraints """ if self.is_guaranteed_sorted: self.log(u"Already sorted, returning") return self.log...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, function_definition; 9, expression_statement; 10, expression_statement; 11, comment:"""Sort variants from most correct to consume, to least. Sort rules: v...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 7, 13; 8, 14; 8, 15; 8, 16; 9, 17; 10, 18; 12, 19; 12, 20; 13, 21; 15, 22; 16, 23; 16, 24; 16, 25; 16, 26; 16, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 23, 34; 24, 35; 25, 36; 25, 37; 25, 38; 26, 39; 27, 40; 27, 41; 27, 42; 28, 43; 28...
def sort(self): """Sort variants from most correct to consume, to least. Sort rules: version_priority: - sort by highest versions of packages shared with request; - THEN least number of additional packages added to solve; - THEN highest versions of additional packages; ...
0, module; 1, function_definition; 2, function_name:sort_versions; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, for_statement; 9, comment:# default ordering is version descending; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:"""Sort entri...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 8, 18; 10, 19; 11, 20; 12, 21; 12, 22; 14, 23; 14, 24; 15, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 26, 36; 26, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 30,...
def sort_versions(self): """Sort entries by version. The order is typically descending, but package order functions can change this. """ if self.sorted: return for orderer in (self.solver.package_orderers or []): entries = orderer.reorder(self.en...
0, module; 1, function_definition; 2, function_name:_reset; 3, parameters; 4, block; 5, identifier:self; 6, identifier:load; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 22, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 2...
def _reset(self, load): """ Reset sorted list load. The *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size...
0, module; 1, function_definition; 2, function_name:_build_index; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_statement; 15,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 17, 35; 18, 36; 19, 37; 21, 38; 21, 39; 22, 40; 22, 41; 23, 42; 23, 43; 23, 44; 2...
def _build_index(self): """Build an index for indexing the sorted list. Indexes are represented as binary trees in a dense array notation similar to a binary heap. For example, given a _lists representation storing integers: [0]: 1 2 3 [1]: 4 5 [2]: 6 7 8 9 ...
0, module; 1, function_definition; 2, function_name:_fromset; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:values; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# pylint: disable=protected-access; 12, expression_statement; 13, return_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 12, 19; 13, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 22, 27; 22, 28; 23, 29; 23, 30; 25, 31; 25, 32; 26, 33; 27, 34; 27, 35; 28, 36; 33, 37; 33, 38
def _fromset(cls, values, key=None): """Initialize sorted set from existing set.""" sorted_set = object.__new__(cls) sorted_set._set = values # pylint: disable=protected-access sorted_set.__init__(key=key) return sorted_set
0, module; 1, function_definition; 2, function_name:_argsort_and_resolve_ties; 3, parameters; 4, block; 5, identifier:time; 6, identifier:random_state; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, while_statement; 12, return_statement; 13, comment:"""Like nump...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 21, 32; 21, 33; 23, 34; 23, 35; 27, 36; 27, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 30, 43; ...
def _argsort_and_resolve_ties(time, random_state): """Like numpy.argsort, but resolves ties uniformly at random""" n_samples = len(time) order = numpy.argsort(time, kind="mergesort") i = 0 while i < n_samples - 1: inext = i + 1 while inext < n_samples and...
0, module; 1, function_definition; 2, function_name:toposort_classes; 3, parameters; 4, block; 5, identifier:classes; 6, expression_statement; 7, function_definition; 8, comment:# Map names to classes; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 7, 16; 7, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 16, 25; 16, 26; 16, 27; 16, 28; 17, 29; 17, 30; 17, 31; 17, 32; 17, 33; 17, 34; 17, 35; 17, 36; 17, 37; 17, 38; 17, 39; 17, 40; 17, 41; 17, 42; 17, 43; 17,...
def toposort_classes(classes): """Sort class metadatas so that a superclass is always before the subclass""" def get_class_topolist(class_name, name_to_class, processed_classes, current_trace): """Return a topologically sorted list of this class's dependencies and class itself Args: ...
0, module; 1, function_definition; 2, function_name:_init_steps; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, comment:""" Given the flow conf...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 25, 40; 25, 41; 26, 42; 26, 43; 2...
def _init_steps(self,): """ Given the flow config and everything else, create a list of steps to run, sorted by step number. :return: List[StepSpec] """ self._check_old_yaml_format() config_steps = self.flow_config.steps self._check_infinite_flows(config_steps) ...
0, module; 1, function_definition; 2, function_name:ranker; 3, parameters; 4, block; 5, identifier:self; 6, identifier:X; 7, identifier:meta; 8, expression_statement; 9, comment:# total score is just a sum of each row; 10, expression_statement; 11, expression_statement; 12, comment:# matrix to array; 13, expression_sta...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 8, 19; 10, 20; 11, 21; 13, 22; 14, 23; 16, 24; 17, 25; 18, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 28, 41; 28, 42; 30, 43; 30, ...
def ranker(self, X, meta): """ Sort the place features list by the score of its relevance. """ # total score is just a sum of each row total_score = X.sum(axis=1).transpose() total_score = np.squeeze(np.asarray(total_score)) # matrix to array ranks = total_score....
0, module; 1, function_definition; 2, function_name:create_pickled_data; 3, parameters; 4, block; 5, identifier:idevice; 6, identifier:filename; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 27, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 33, 42; 33, 43; 34,...
def create_pickled_data(idevice, filename): """This helper will output the idevice to a pickled file named after the passed filename. This allows the data to be used without resorting to screen / pipe scrapping. """ data = {} for x in idevice.content: data[x] = idevice.content[x] l...
0, module; 1, function_definition; 2, function_name:get_html_string; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:kwargs; 12, comment:"""Return string representation of HTML formatted ver...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 19, 24; 19, 25; 22, 26; 23, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 27, 33; 32, 34; 32, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 37, 41; 37, 42; 41, 43; 4...
def get_html_string(self, **kwargs): """Return string representation of HTML formatted version of table in current state. Arguments: start - index of first data row to include in output end - index of last data row to include in output PLUS ONE (list slice style) fields - name...
0, module; 1, function_definition; 2, function_name:get_last_update_time; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, string; 10, assignment; 11, call; 12, string_content:Gets the time at which each ledger was updated. Can be called at a...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 9, 12; 10, 13; 10, 14; 11, 15; 11, 16; 14, 17; 14, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 25, 32; 25, 33; 30, 34; 30, 35; 32, 36; 32, 37; 33, 38; 33, 39; 34, 40; 34, 41; 36, 42; 36, 4...
def get_last_update_time(self): ''' Gets the time at which each ledger was updated. Can be called at any time to get this information. :return: an ordered dict of outdated ledgers sorted by last update time (from old to new) and then by ledger ID (in case of equal update time) ...
0, module; 1, function_definition; 2, function_name:_listChunks; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Lists stored chunks :return: sorted list of available chunk indices """; 11, ass...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 18, 24; 18, 25; 19, 26; 20, 27; 21, 28; 21, 29; 23, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 34, 38; 34, 39; 37, 40; 38, 41; 38, 42; 39, 43; ...
def _listChunks(self): """ Lists stored chunks :return: sorted list of available chunk indices """ chunks = [] for fileName in os.listdir(self.dataDir): index = ChunkedFileStore._fileNameToChunkIndex(fileName) if index is not None: ...
0, module; 1, function_definition; 2, function_name:mostCommonElement; 3, parameters; 4, block; 5, typed_parameter; 6, typed_default_parameter; 7, expression_statement; 8, class_definition; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:elements; 13, type; 14, identifier:to_hash...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 5, 12; 5, 13; 6, 14; 6, 15; 6, 16; 7, 17; 8, 18; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 13, 24; 15, 25; 19, 26; 20, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 26, 38; 26, 39; 27, 40; 27, 41; 27, 42; 28, 43; 28, 44...
def mostCommonElement(elements: Iterable[T], to_hashable_f: Callable=None): """ Find the most frequent element of a collection. :param elements: An iterable of elements :param to_hashable_f: (optional) if defined will be used to get hashable presentation for non-hashable elements. Otherwise jso...
0, module; 1, function_definition; 2, function_name:minute_index_to_session_labels; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, expression_statement; 8, if_statement; 9, comment:# Find the indices of the previous open and the next close for each; 10, comment:# minute.; 11, expression_statement;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 8, 19; 11, 20; 12, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 18, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 25, 39; 25, 40; 25, 41; 25, 42; 26, 43; 26, ...
def minute_index_to_session_labels(self, index): """ Given a sorted DatetimeIndex of market minutes, return a DatetimeIndex of the corresponding session labels. Parameters ---------- index: pd.DatetimeIndex or pd.Series The ordered list of market minutes we w...
0, module; 1, function_definition; 2, function_name:aggregate_repeated_calls; 3, parameters; 4, block; 5, identifier:frame; 6, identifier:options; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, comment:# iterate over a copy of the children since it's going to mutate while we're iterating; 11, fo...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 8, 21; 8, 22; 9, 23; 11, 24; 11, 25; 11, 26; 13, 27; 13, 28; 13, 29; 17, 30; 19, 31; 20, 32; 21, 33; 21, 34; 22, 35; 23, 36; 23, 37; 25, 38; 25, 39; 26, 40; 28, 41; 28, 42; 29, 43; 30, 44; ...
def aggregate_repeated_calls(frame, options): ''' Converts a timeline into a time-aggregate summary. Adds together calls along the same call stack, so that repeated calls appear as the same frame. Removes time-linearity - frames are sorted according to total time spent. Useful for outputs that dis...
0, module; 1, function_definition; 2, function_name:get_all_tags_names_as_list; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:#Cache miss, computes everything; 11, expression_statement; 12, expression_statement; 13, express...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 9, 24; 9, 25; 9, 26; 11, 27; 12, 28; 13, 29; 14, 30; 14, 31; 14, 32; 14, 33; 15, 34; 16, 35; 17, 36; 17, 37; 18, 38; 25, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 29,...
def get_all_tags_names_as_list(self, admin=False, language="en"): """ Computes and cache two list containing all tags name sorted by natural order on name """ if admin: if self._all_tags_cache_list_admin != {} and language in self._all_tags_cache_list_admin: return self._all...
0, module; 1, function_definition; 2, function_name:get_users; 3, parameters; 4, block; 5, identifier:self; 6, identifier:course; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Returns a sorted list of users """; 11, assignment; 12, identifier:users; 13, identifier:users; 14, cal...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 14, 15; 14, 16; 16, 17; 17, 18; 17, 19; 19, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25; 23, 26; 25, 27; 25, 28; 26, 29; 26, 30; 27, 31; 28, 32; 28, 33; 28, 34; 29, 35; 29, 36; 32, 37; 32, 38; 33, 39; 33, 40; 35, 41; 35, 42; 37, 4...
def get_users(self, course): """ Returns a sorted list of users """ users = OrderedDict(sorted(list(self.user_manager.get_users_info(self.user_manager.get_course_registered_users(course)).items()), key=lambda k: k[1][0] if k[1] is not None else "")) return users
0, module; 1, function_definition; 2, function_name:radius_cmp; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, identifier:offsets; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, string; 14, assignment; 15, comparison_operator:diff > 0; 16, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 10, 16; 11, 17; 11, 18; 12, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 17, 26; 17, 27; 18, 28; 22, 29; 22, 30; 25, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 32, 37; 34, 38; 34, 39; 36, 40; 36, 41
def radius_cmp(a, b, offsets): '''return +1 or -1 for for sorting''' diff = radius(a, offsets) - radius(b, offsets) if diff > 0: return 1 if diff < 0: return -1 return 0
0, module; 1, function_definition; 2, function_name:generate_enums_info; 3, parameters; 4, block; 5, identifier:enums; 6, identifier:msgs; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, comment:"""Add camel case swift names for enums an entries, descriptions and sort enums alphabetically"""; 11...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 13, 15; 13, 16; 13, 17; 13, 18; 13, 19; 13, 20; 13, 21; 13, 22; 13, 23; 13, 24; 14, 25; 14, 26; 15, 27; 16, 28; 17, 29; 18, 30; 18, 31; 19, 32; 20, 33; 21, 34; 21, 35; 21, 36; 22, 37; 23, 38; 24, 39; 25, 40; 25, 41; 26, 42; 27, 43;...
def generate_enums_info(enums, msgs): """Add camel case swift names for enums an entries, descriptions and sort enums alphabetically""" for enum in enums: enum.swift_name = camel_case_from_underscores(enum.name) enum.raw_value_type = get_enum_raw_type(enum, msgs) enum.formatted_descrip...
0, module; 1, function_definition; 2, function_name:compare_report_print; 3, parameters; 4, block; 5, identifier:sorted_list; 6, identifier:scores; 7, identifier:best_name; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_stat...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 16, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 4...
def compare_report_print(sorted_list, scores, best_name): """ Return compare report. :param sorted_list: sorted list of cm's :type sorted_list: list :param scores: scores of cm's :type scores: dict :param best_name: best cm name :type best_name: str :return: printable result as str ...
0, module; 1, function_definition; 2, function_name:replace_cells; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:sorted_row_idxs; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, for_sta...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 14, 25; 14, 26; 15, 27; 15, 28; 15, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 19, 35; 20, 36; 20, 37; 21, 38; 21, 39; 21, 40; 22, 41; 22, 42; 23, 43; 26...
def replace_cells(self, key, sorted_row_idxs): """Replaces cells in current selection so that they are sorted""" row, col, tab = key new_keys = {} del_keys = [] selection = self.grid.actions.get_selection() for __row, __col, __tab in self.grid.code_array: ...
0, module; 1, function_definition; 2, function_name:OnSortAscending; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, comment:"""Sort ascending event handler"""; 11, block; 12, except_clause; 13, call; 14, with_statement; 15, expre...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 18, 24; 20, 25; 20, 26; 20, 27; 21, 28; 22, 29; 23, 30; 23, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 29, 40; 31, 41; 31, 42; 32, 43...
def OnSortAscending(self, event): """Sort ascending event handler""" try: with undo.group(_("Sort ascending")): self.grid.actions.sort_ascending(self.grid.actions.cursor) statustext = _(u"Sorting complete.") except Exception, err: statustext ...
0, module; 1, function_definition; 2, function_name:get_font_list; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Returns a sorted list of all system font names"""; 11, assignment; 12, assignment; 13, call;...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 16, 21; 16, 22; 18, 23; 18, 24; 19, 25; 19, 26; 21, 27; 21, 28; 23, 29; 23, 30; 24, 31; 24, 32; 29, 33; 29, 34; 32, 35; 32, 36; 35, 37; 35, 38
def get_font_list(): """Returns a sorted list of all system font names""" font_map = pangocairo.cairo_font_map_get_default() font_list = [f.get_name() for f in font_map.list_families()] font_list.sort() return font_list
0, module; 1, function_definition; 2, function_name:_sorted_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys; 7, identifier:startkey; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 15, 27; 15, 28; 19, 29; 19, 30; 21, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 28, 39; 30, 40; 30, 41; 31, 42; 32, 43; 34,...
def _sorted_keys(self, keys, startkey, reverse=False): """Generator that yields sorted keys starting with startkey Parameters ---------- keys: Iterable of tuple/list \tKey sequence that is sorted startkey: Tuple/list \tFirst key to be yielded reverse: Bo...
0, module; 1, function_definition; 2, function_name:stratify; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, function_definition; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 12, 24; 13, 25; 15, 26; 15, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 19, 33; 21, 34; 21, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, ...
def stratify(self): """ Stratifies the sample based on propensity score. By default the sample is divided into five equal-sized bins. The number of bins can be set by modifying the object attribute named blocks. Alternatively, custom-sized bins can be created by setting blocks equal to a sorted list of ...
0, module; 1, function_definition; 2, function_name:list_current_orders; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 6, 23; 6, 24; 7, 25; 7, 26; 8, 27; 8, 28; 9, 29; 9, 30; 10, 31; 10, 32; 11, 33; 11, 34; 12, 35; 12, 36; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 15, 42; 16, 43; 16, 44; 17, 45;...
def list_current_orders(self, bet_ids=None, market_ids=None, order_projection=None, customer_order_refs=None, customer_strategy_refs=None, date_range=time_range(), order_by=None, sort_dir=None, from_record=None, record_count=None, session=None, lightweight=None): ...
0, module; 1, function_definition; 2, function_name:visit_Module; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, try_statement; 12, assert_statement; 13, expression_statement; 14, expression_statement; 15...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 14, 27; 15, 28; 17, 29; 17, 30; 18, 31; 18, 32; 20, 33; 20, 34; 21, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 24, 41; 26, 42; 26, 43; 27,...
def visit_Module(self, node): """ Keep everything but function definition then add sorted functions. Most of the time, many function sort work so we use function calldepth as a "sort hint" to simplify typing. """ newbody = list() olddef = list() for stmt ...
0, module; 1, function_definition; 2, function_name:qzordered; 3, parameters; 4, block; 5, identifier:A; 6, identifier:B; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:crit; 15, fl...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 17, 24; 17, 25; 19, 26; 19, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 23, 35; 23, 36; 23, 37; 28, 38; 29, 39; 29, 40; 29, 41; 29, 42; 29, 43; 29...
def qzordered(A,B,crit=1.0): "Eigenvalues bigger than crit are sorted in the top-left." TOL = 1e-10 def select(alpha, beta): return alpha**2>crit*beta**2 [S,T,alpha,beta,U,V] = ordqz(A,B,output='real',sort=select) eigval = abs(numpy.diag(S)/numpy.diag(T)) return [S,T,U,V,eigval]
0, module; 1, function_definition; 2, function_name:ordqz; 3, parameters; 4, block; 5, identifier:A; 6, identifier:B; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, import_statement; 14, import_statement; 15, import_from_stat...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 7, 37; 7, 38; 8, 39; 8, 40; 9, 41; 9, 42; 10, 43; 10, 44; 11, 45; 11, 46; 12,...
def ordqz(A, B, sort='lhp', output='real', overwrite_a=False, overwrite_b=False, check_finite=True): """ QZ decomposition for a pair of matrices with reordering. .. versionadded:: 0.17.0 Parameters ---------- A : (N, N) array_like 2d array to decompose B : (N, N) array_li...
0, module; 1, function_definition; 2, function_name:inverse_cdf; 3, parameters; 4, block; 5, identifier:su; 6, identifier:W; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:"""Inverse CDF ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 20, 31; 20, 32; 21, 33; 21, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 32, 41; 33, 42; 33, 43; 3...
def inverse_cdf(su, W): """Inverse CDF algorithm for a finite distribution. Parameters ---------- su: (M,) ndarray M sorted uniform variates (i.e. M ordered points in [0,1]). W: (N,) ndarray a vector of N normalized weights (>=0 and sum to one) Re...
0, module; 1, function_definition; 2, function_name:sort_items; 3, parameters; 4, block; 5, identifier:self; 6, identifier:items; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, function_definition; 11, function_definition; 12, function_definition; 13, function_definition; 14, function_definition; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 11, 25; 11, 26; 12, 27; 12, 28; 12, 29; 13, 30; 13, 31; 13, 32; 14, 33; 14, 34; 14, 35; 15, 36; 15, 37; 15, 38; 15, 39; 15, 40; 15, 41; 19, 42; 19, 43; 20, 4...
def sort_items(self,items,args=False): """ Sort the `self`'s contents, as contained in the list `items` as specified in `self`'s meta-data. """ if self.settings['sort'].lower() == 'src': return def alpha(i): return i.name def permission(i): if args: if i.intent ==...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, if_statement; 17, if_statemen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 11, 32; 12, 33; 12, 34; 13, 35; 13, 36; 14, 37; 14, 38; 15, 39; 15, 40; 16, 41; 16, 42; 17, 43; 17, 44; 18, 4...
def sort(self): ''' Sorts components of the object. ''' if hasattr(self,'variables'): sort_items(self,self.variables) if hasattr(self,'modules'): sort_items(self,self.modules) if hasattr(self,'submodules'): sort_items(self,self.submodul...
0, module; 1, function_definition; 2, function_name:sort_catalogue_chronologically; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, string; 12, assignment; 13, assignment; 14, call; 15, comment:# Catal...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 14, 24; 16, 25; 17, 26; 17, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 34, 43; 3...
def sort_catalogue_chronologically(self): ''' Sorts the catalogue into chronological order ''' dec_time = self.get_decimal_time() idx = np.argsort(dec_time) if np.all((idx[1:] - idx[:-1]) > 0.): # Catalogue was already in chronological order return...
0, module; 1, function_definition; 2, function_name:cmp_mat; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Sorts two matrices returning a positive or zero value """; 12, assignment; 13, pattern...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 22, 25; 22, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 35, 39; 35, 40; 38, 41; 40, 42; 40, 43; ...
def cmp_mat(a, b): """ Sorts two matrices returning a positive or zero value """ c = 0 for x, y in zip(a.flat, b.flat): c = cmp(abs(x), abs(y)) if c != 0: return c return c
0, module; 1, function_definition; 2, function_name:sort_dicoms; 3, parameters; 4, block; 5, identifier:dicoms; 6, expression_statement; 7, comment:# find most significant axis to use during sorting; 8, comment:# the original way of sorting (first x than y than z) does not work in certain border situations; 9, comment:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 11, 21; 12, 22; 13, 23; 14, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 4...
def sort_dicoms(dicoms): """ Sort the dicoms based om the image possition patient :param dicoms: list of dicoms """ # find most significant axis to use during sorting # the original way of sorting (first x than y than z) does not work in certain border situations # where for exampe the X wi...
0, module; 1, function_definition; 2, function_name:_get_sorted_mosaics; 3, parameters; 4, block; 5, identifier:dicom_input; 6, expression_statement; 7, comment:# Order all dicom files by acquisition number; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Search all mosaics in the d...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 8, 12; 9, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 14, 20; 14, 21; 16, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 30, 36; 30, 37; 31, 38; 31, 39; 33, 40; 33, 41; 34, 42; 34, 43; 3...
def _get_sorted_mosaics(dicom_input): """ Search all mosaics in the dicom directory, sort and validate them """ # Order all dicom files by acquisition number sorted_mosaics = sorted(dicom_input, key=lambda x: x.AcquisitionNumber) for index in range(0, len(sorted_mosaics) - 1): # Validat...
0, module; 1, function_definition; 2, function_name:relate_obs_ids_to_chosen_alts; 3, parameters; 4, block; 5, identifier:obs_id_array; 6, identifier:alt_id_array; 7, identifier:choice_array; 8, expression_statement; 9, comment:# Figure out which units of observation chose each alternative.; 10, expression_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 8, 14; 10, 15; 11, 16; 11, 17; 11, 18; 11, 19; 13, 20; 15, 21; 15, 22; 17, 23; 17, 24; 19, 25; 19, 26; 19, 27; 23, 28; 23, 29; 24, 30; 25, 31; 27, 32; 30, 33; 30, 34; 31, 35; 31, 36; 31, 37; 32, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43;...
def relate_obs_ids_to_chosen_alts(obs_id_array, alt_id_array, choice_array): """ Creates a dictionary that relates each unique alternative id to the set of observations ids that chose the given alternative. Parameters ---------- ...
0, module; 1, function_definition; 2, function_name:create_estimation_obj; 3, parameters; 4, block; 5, identifier:model_obj; 6, identifier:init_vals; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, comment:# Get the mapping matrices for each model; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 13, 33; 15, 34; 17, 35; 19, 36; 21, 37; 23, 38; 33, 39; 33, 40; 33, 41; 34, 42; 34, 43; 35, 44; 35, 45...
def create_estimation_obj(model_obj, init_vals, mappings=None, ridge=None, constrained_pos=None, weights=None): """ Should return a model estimation object corresponding to the model...
0, module; 1, function_definition; 2, function_name:sequence; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, string; 10, parenthesized_expression; 11, block; 12, parenthesized_expression; 13, block; 14, string_content:sort the points in the line with given opt...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 8, 13; 9, 14; 10, 15; 11, 16; 12, 17; 13, 18; 15, 19; 15, 20; 16, 21; 16, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 18, 29; 18, 30; 18, 31; 19, 32; 19, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 25, 40; 25, 41; 27, 42; 28, 43;...
def sequence(self): ''' sort the points in the line with given option ''' if (len(self.Points[0]) == 2): if (self.Sort == 'X' or self.Sort == 'x'): self.Points.sort(key=lambda x: x[0]) self.order(self.Points) elif (self.Sort == 'Y'...
0, module; 1, function_definition; 2, function_name:_get_pos; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, comment:"""Get the index of the given key in the sorted key list. We return the position with the nearest hash bas...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 9, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 14, 20; 16, 21; 16, 22; 18, 23; 18, 24; 19, 25; 20, 26; 22, 27; 22, 28; 24, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 31, 37; 31, 38; 33, 39; 33, 40; 34, 41; 35, 42; 35, 43
def _get_pos(self, key): """Get the index of the given key in the sorted key list. We return the position with the nearest hash based on the provided key unless we reach the end of the continuum/ring in which case we return the 0 (beginning) index position. :param key: the key ...
0, module; 1, function_definition; 2, function_name:lapmod; 3, parameters; 4, block; 5, identifier:n; 6, identifier:cc; 7, identifier:ii; 8, identifier:kk; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# log = logging.getLogger('lapmod'); 14, expression_statem...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 9, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 12, 23; 14, 24; 15, 25; 15, 26; 15, 27; 15, 28; 16, 29; 16, 30; 16, 31; 24, 32; 24, 33; 25, 34; 25, 35; 27, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 33, 42; 33, 43; 33,...
def lapmod(n, cc, ii, kk, fast=True, return_cost=True, fp_version=FP_DYNAMIC): """Solve sparse linear assignment problem using Jonker-Volgenant algorithm. n: number of rows of the assignment cost matrix cc: 1D array of all finite elements of the assignement cost matrix ii: 1D array of indice...
0, module; 1, function_definition; 2, function_name:sort_items; 3, parameters; 4, block; 5, identifier:items; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""sorts the items into a dictionary of categories, with a list of items"""; 11, assignment; 12, identifier:i...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 14, 18; 14, 19; 14, 20; 18, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 24, 30; 24, 31; 26, 32; 26, 33; 27, 34; 27, 35; 29, 36; 30, 37; 30, 38; 31, 39; 33, 40; 33, 41; 33, 42; 34, 43; ...
def sort_items(items): """sorts the items into a dictionary of categories, with a list of items""" sorted_items = {} for item in items: category = lookup(item, 'itemCategory', 'categoryCode') if sorted_items.get(category) is None: sorted_items[category] = [] sorted_items...
0, module; 1, function_definition; 2, function_name:get_user_permissions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:user_id; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Returns a sorted list of a users permissions"""; 11, assignment; 12, call; 13, identifier:pe...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 20, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 25, 30; 25, 31; 31, 32; 32, 33
def get_user_permissions(self, user_id): """Returns a sorted list of a users permissions""" permissions = self.user_service.getPermissions(id=user_id) return sorted(permissions, key=itemgetter('keyName'))
0, module; 1, function_definition; 2, function_name:transformChildrenToNative; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, for_statement; 8, comment:""" Recursively replace children with their native representation. Sort to get dependency order right, like vtimezone before ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 10, 12; 10, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 14, 21; 15, 22; 15, 23; 18, 24; 18, 25; 21, 26; 21, 27; 24, 28; 24, 29; 26, 30; 27, 31; 30, 32; 30, 33; 31, 34; 31, 35; 33, 36; 33, 37; 34, 38; 34, 39; 36, 40; 36, 41
def transformChildrenToNative(self): """ Recursively replace children with their native representation. Sort to get dependency order right, like vtimezone before vevent. """ for childArray in (self.contents[k] for k in self.sortChildKeys()): for child in childArray: ...
0, module; 1, function_definition; 2, function_name:sort_candidate_pairs; 3, parameters; 4, block; 5, identifier:pairs; 6, identifier:ice_controlling; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, comment:""" Sort a list of candidate pairs. """; 11, function_name:pair_priority; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 12, 15; 13, 16; 14, 17; 14, 18; 16, 19; 17, 20; 17, 21; 18, 22; 19, 23; 22, 24; 22, 25; 23, 26; 23, 27; 27, 28; 27, 29; 27, 30; 28, 31; 28, 32; 29, 33; 29, 34
def sort_candidate_pairs(pairs, ice_controlling): """ Sort a list of candidate pairs. """ def pair_priority(pair): return -candidate_pair_priority(pair.local_candidate, pair.remote_candidate, ice_controlling) pa...
0, module; 1, function_definition; 2, function_name:order_by_refs; 3, parameters; 4, block; 5, identifier:envs; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Return topologicaly sorted list of environments. I.e. all referenced environments are pl...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 32, 42; 32, 43...
def order_by_refs(envs): """ Return topologicaly sorted list of environments. I.e. all referenced environments are placed before their references. """ topology = { env['name']: set(env['refs']) for env in envs } by_name = { env['name']: env for env in envs ...
0, module; 1, function_definition; 2, function_name:merged_packages; 3, parameters; 4, block; 5, identifier:env_packages; 6, identifier:names; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, return_statement; 14, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 20, 32; 22, 33; 22, 34; 25, 35; 25, 36; 29, 37; 29, 38; 32, 39; 32, 40; 32, 41; 33, 42; 33, 43; 3...
def merged_packages(env_packages, names): """ Return union set of environment packages with given names >>> sorted(merged_packages( ... { ... 'a': {'x': 1, 'y': 2}, ... 'b': {'y': 2, 'z': 3}, ... 'c': {'z': 3, 'w': 4} ... }, ... ['a', 'b'] ......
0, module; 1, function_definition; 2, function_name:recursive_refs; 3, parameters; 4, block; 5, identifier:envs; 6, identifier:name; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:""" Return set of recursive refs for given env name ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 22, 29; 22, 30; 23, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 31, 41; 31, 42; 32, 43;...
def recursive_refs(envs, name): """ Return set of recursive refs for given env name >>> local_refs = sorted(recursive_refs([ ... {'name': 'base', 'refs': []}, ... {'name': 'test', 'refs': ['base']}, ... {'name': 'local', 'refs': ['test']}, ... ], 'local')) >>> local_refs == ...
0, module; 1, function_definition; 2, function_name:reference_cluster; 3, parameters; 4, block; 5, identifier:envs; 6, identifier:name; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, return_statement; 12, comment:""" Return set of all env names referencing or ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 17, 27; 17, 28; 20, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 25, 36; 26, 37; 27, 38; 27, 39; 27, 40; 28, 41; 29, 42; 29, 43;...
def reference_cluster(envs, name): """ Return set of all env names referencing or referenced by given name. >>> cluster = sorted(reference_cluster([ ... {'name': 'base', 'refs': []}, ... {'name': 'test', 'refs': ['base']}, ... {'name': 'local', 'refs': ['test']}, ... ], 'tes...
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, assert_statement; 13, expression_statement; 14, return_statement; 15, identi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 13, 26; 14, 27; 24, 28; 24, 29; 25, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 31, 37; 33, 38; 33, 39; 34, 40; 35, 41; 35, 42; 36, 43; 36, 4...
def search(self, text, sort=None, offset=100, page=1, aquarius_url=None): """ Search an asset in oceanDB using aquarius. :param text: String with the value that you are searching :param sort: Dictionary to choose order base in some value :param offset: Number of elements shows b...
0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, id...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 32, 41; 35, 42; 35, 43; 36, 4...
def query(self, query, sort=None, offset=100, page=1, aquarius_url=None): """ Search an asset in oceanDB using search query. :param query: dict with query parameters (e.g.) https://github.com/oceanprotocol/aquarius/blob/develop/docs/for_api_users/API.md :param sort: Dictiona...