sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sortby; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:ntd; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 21; 9, 36; 10, comparison_operator:in; 10, 11; 10, 12; 11, string:'reldepth'; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_nts_sorted; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:hdrgo_prt; 6, identifier:hdrgos; 7, identifier:hdrgo_sort; 8, block; 8, 9; 8, 11; 8, 15; 8, 25; 9, expression_statement; 9, 10; 10, comment; 11, expression...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:get_sorted_hdrgo2usrgos; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:hdrgos; 6, default_parameter; 6, 7; 6, 8; 7, identifier:flat_list; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:hdrgo_prt; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_init_hdrgo_sortby; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:hdrgo_sortby; 6, identifier:sortby; 7, block; 7, 8; 7, 10; 7, 17; 7, 24; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; 10, 14; 11, com...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_get_sortgo; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 25; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 16; 9, comparison_operator:in; 9, 10; 9, 11; 10, string:'sortgo'; 11, attribute; 11, 12; 11,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_sorted_section; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:nts_section; 6, block; 6, 7; 6, 9; 6, 10; 6, 35; 6, 50; 6, 51; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, if_statement; 10, 11; 10, 16; 11, compar...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_sections_2dnt; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:sec2d_go; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, return_statement; 9, 10; 10, list_comprehension; 10, 11; 10, 19; 11, tuple; 11, 12; 11...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_ntgos_sorted; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:hdrgos; 6, block; 6, 7; 6, 9; 6, 17; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:go2nt;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_sortobj; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:goea_results; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kws; 8, block; 8, 9; 8, 11; 8, 24; 8, 36; 8, 48; 8, 67; 8, 76; 8, 77; 8, 96; 9, expression_statement;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_sorted_relationships; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:goterm; 6, block; 6, 7; 6, 9; 6, 19; 6, 30; 6, 45; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 17; 10, comparison_operator:in; 10,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:write_dag; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:out; 7, attribute; 7, 8; 7, 9; 8, identifier:sys; 9, identifier:stdout; 10, block; 10, 11; 10, 13; 11, expression_statement; 11, 12; 12, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:sort_nts; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:nt_list; 6, identifier:codekey; 7, block; 7, 8; 7, 10; 7, 11; 7, 12; 7, 13; 7, 33; 8, expression_statement; 8, 9; 9, comment; 10, comment; 11, comment; 12, comment; 13...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:prt_gos; 3, parameters; 3, 4; 3, 5; 3, 10; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:prt; 7, attribute; 7, 8; 7, 9; 8, identifier:sys; 9, identifier:stdout; 10, dictionary_splat_pattern; 10, 11; 11, identifier:kws_usr...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_nts_flat; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:hdrgo_prt; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:use_sections; 10, True; 11, block; 11, 12; 11, 14; 11, 15; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_adjust_prt_flds; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:kws_xlsx; 6, identifier:desc2nts; 7, identifier:shade_hdrgos; 8, block; 8, 9; 8, 11; 8, 12; 8, 21; 8, 22; 8, 32; 8, 33; 8, 34; 8, 38; 8, 39; 8, 50; 8, 51...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_shade_hdrgos; 3, parameters; 3, 4; 4, dictionary_splat_pattern; 4, 5; 5, identifier:kws; 6, block; 6, 7; 6, 9; 6, 10; 6, 19; 6, 20; 6, 29; 6, 30; 6, 31; 6, 32; 6, 33; 6, 44; 6, 59; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:dflt_sortby_objgoea; 3, parameters; 3, 4; 4, identifier:goea_res; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, list:[getattr(goea_res, 'enrichment'), getattr(goea_res, 'namespace...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:dflt_sortby_ntgoea; 3, parameters; 3, 4; 4, identifier:ntgoea; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, list:[ntgoea.enrichment, ntgoea.namespace, ntgoea.p_un...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 12; 3, 15; 4, identifier:x; 5, default_parameter; 5, 6; 5, 7; 6, identifier:axis; 7, unary_operator:-; 7, 8; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:reverse; 11, False; 12, def...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:optimize; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 30; 5, 31; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, with_statement; 9, 10; 9, 20; 10, with_clause; 10, 11; 11, with_item; 11, 12; 12, as_pattern;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:sort_common_members; 3, parameters; 4, block; 4, 5; 4, 7; 4, 13; 4, 17; 4, 24; 4, 28; 4, 45; 4, 52; 4, 78; 4, 92; 5, expression_statement; 5, 6; 6, comment; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:filename; 10, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_ConstructPartitions; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:collection_links; 6, identifier:partitions_per_node; 7, block; 7, 8; 7, 10; 7, 17; 7, 35; 7, 39; 7, 94; 7, 100; 8, expression_statement; 8, 9; 9, comment; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_leap_seconds; 3, parameters; 3, 4; 4, identifier:fileobj; 5, block; 5, 6; 5, 8; 5, 15; 5, 35; 5, 44; 5, 95; 5, 96; 5, 97; 5, 98; 5, 107; 5, 117; 5, 133; 5, 147; 5, 153; 5, 165; 5, 172; 5, 186; 5, 198; 5, 206; 6, expression_statement; 6, 7...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:build_delta_t_table; 3, parameters; 3, 4; 4, identifier:delta_t_recent; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 23; 5, 30; 5, 40; 5, 58; 5, 59; 5, 66; 5, 76; 5, 84; 5, 104; 5, 105; 5, 109; 5, 118; 5, 131; 5, 141; 5, 155; 6, expression_statement;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 55; 2, function_name:plot_confusion_matrix_with_cv; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 3, 31; 3, 34; 3, 37; 3, 40; 3, 43; 3, 46; 3, 49; 3, 52; 4, identifier:clf; 5, identifier:X; 6, identifier:y; 7, default_para...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 42; 2, function_name:plot_confusion_matrix; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 3, 30; 3, 33; 3, 36; 3, 39; 4, identifier:y_true; 5, identifier:y_pred; 6, default_parameter; 6, 7; 6, 8; 7, identifier:labels; 8, None; 9,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sorting; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 126; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 17; 9, call; 9, 10; 9, 15; 10, attribute; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, id...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:filter_query; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:query; 6, identifier:filter_info; 7, identifier:model; 8, block; 8, 9; 8, 11; 8, 35; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12; 1...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:sort_query; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:query; 6, identifier:sort_info; 7, block; 7, 8; 7, 10; 7, 68; 8, expression_statement; 8, 9; 9, comment; 10, for_statement; 10, 11; 10, 12; 10, 13; 11, identifier:so...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 25; 2, function_name:_get_log_entries; 3, parameters; 3, 4; 4, identifier:self; 5, type; 5, 6; 6, generic_type; 6, 7; 6, 8; 7, identifier:List; 8, type_parameter; 8, 9; 9, type; 9, 10; 10, generic_type; 10, 11; 10, 12; 11, identifier:Tuple; 12, type_paramete...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:sort_by_size; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:group_limit; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:discard_others; 10, False; 11, default_parameter; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get_comments; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:resource; 6, default_parameter; 6, 7; 6, 8; 7, identifier:before; 8, None; 9, block; 9, 10; 9, 12; 9, 29; 9, 69; 10, expression_statement; 10, 11; 11, comment; 12,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:clean_fail; 3, parameters; 3, 4; 4, identifier:func; 5, block; 5, 6; 5, 8; 5, 56; 6, expression_statement; 6, 7; 7, string:''' A decorator to cleanly exit on a failed call to AWS. catch a `botocore.exceptions.ClientError` raised from an...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:parse_header; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:value; 7, string:'*/*'; 8, block; 8, 9; 8, 11; 9, expression_statement; 9, 10; 10, comment; 11, expression_statement; 11, 12; 12, yield;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sort_canonical; 3, parameters; 3, 4; 3, 5; 4, identifier:keyword; 5, identifier:stmts; 6, block; 6, 7; 6, 9; 6, 24; 6, 28; 6, 29; 6, 42; 6, 109; 6, 110; 6, 125; 7, expression_statement; 7, 8; 8, comment; 9, try_statement; 9, 10; 9, 19; 10, bloc...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 4, identifier:self; 5, identifier:key; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:nu...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_url_filemeta; 3, parameters; 3, 4; 4, identifier:url; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 37; 5, 45; 5, 129; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:parsed_url...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 59; 2, function_name:offline_plotly_scatter_bubble; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 32; 3, 35; 3, 38; 3, 50; 3, 56; 4, identifier:df; 5, default_parameter; 5, 6; 5, 7; 6, identifier:x; 7, string:'x'; 8, default_paramet...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:get_acronyms; 3, parameters; 3, 4; 4, default_parameter; 4, 5; 4, 6; 5, identifier:manuscript; 6, call; 6, 7; 6, 12; 7, attribute; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:os; 10, identifier:path; 11, identifier:expanduser; 12, ar...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_find; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rpcmethod; 6, block; 6, 7; 6, 9; 6, 25; 6, 31; 6, 53; 6, 65; 6, 69; 6, 106; 6, 114; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, call; 10, 11;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 21; 2, function_name:match_key; 3, parameters; 3, 4; 4, identifier:self; 5, type; 5, 6; 6, generic_type; 6, 7; 6, 8; 7, identifier:Tuple; 8, type_parameter; 8, 9; 8, 11; 8, 13; 8, 15; 9, type; 9, 10; 10, identifier:bool; 11, type; 11, 12; 12, identifier:bool...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 1, 13; 2, function_name:build_key; 3, parameters; 3, 4; 4, identifier:self; 5, type; 5, 6; 6, generic_type; 6, 7; 6, 8; 7, identifier:Tuple; 8, type_parameter; 8, 9; 8, 11; 9, type; 9, 10; 10, identifier:bool; 11, type; 11, 12; 12, identifier:int; 13, block; 13...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:load_ui_file; 3, parameters; 3, 4; 4, identifier:name; 5, block; 5, 6; 5, 8; 5, 16; 5, 33; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:ui; 11, call; 11, 12; 11, 15; 12, a...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:__remove_category; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:id; 6, block; 6, 7; 6, 9; 6, 13; 6, 30; 6, 34; 6, 43; 6, 52; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_sort; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 15; 10, subscript; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, ident...
def _sort(self): """sort sprites by z_order""" self.__dict__['_z_ordered_sprites'] = sorted(self.sprites, key=lambda sprite:sprite.z_order)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_get_mouse_cursor; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 8, 19; 8, 34; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:entries; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 15; 5, 33; 5, 50; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 5, 28; 5, 39; 5, 46; 5, 53; 5, 134; 5, 141; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 5, 171; 5, 185; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, identifier:sorted; 12, blo...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_versions; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 5, 81; 5, 82; 5, 104; 5, 110; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, ide...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_reset; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:load; 6, block; 6, 7; 6, 9; 6, 20; 6, 26; 6, 32; 6, 40; 6, 48; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, i...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_build_index; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 5, 45; 5, 52; 5, 59; 5, 74; 5, 92; 5, 118; 5, 139; 5, 155; 5, 161; 5, 211; 5, 223; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_fromset; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:values; 6, default_parameter; 6, 7; 6, 8; 7, identifier:key; 8, None; 9, block; 9, 10; 9, 12; 9, 21; 9, 27; 9, 28; 9, 37; 10, expression_statement; 10, 11; 11, comment;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_argsort_and_resolve_ties; 3, parameters; 3, 4; 3, 5; 4, identifier:time; 5, identifier:random_state; 6, block; 6, 7; 6, 9; 6, 16; 6, 28; 6, 32; 6, 90; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 1...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:toposort_classes; 3, parameters; 3, 4; 4, identifier:classes; 5, block; 5, 6; 5, 8; 5, 141; 5, 142; 5, 154; 5, 160; 5, 164; 5, 187; 6, expression_statement; 6, 7; 7, comment; 8, function_definition; 8, 9; 8, 10; 8, 15; 9, function_name:get_clas...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_init_steps; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 5, 22; 5, 29; 5, 33; 5, 60; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, i...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:ranker; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:X; 6, identifier:meta; 7, block; 7, 8; 7, 10; 7, 11; 7, 26; 7, 40; 7, 41; 7, 49; 7, 59; 7, 60; 7, 70; 7, 76; 8, expression_statement; 8, 9; 9, comment; 10, comment; 11, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:create_pickled_data; 3, parameters; 3, 4; 3, 5; 4, identifier:idevice; 5, identifier:filename; 6, block; 6, 7; 6, 9; 6, 13; 6, 29; 6, 33; 6, 41; 6, 54; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 1...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_html_string; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 10; 7, 19; 7, 44; 8, expression_statement; 8, 9; 9, comment; 10, expression_statement; 10, 11; 11, assig...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_last_update_time; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 28; 6, expression_statement; 6, 7; 7, string:''' Gets the time at which each ledger was updated. Can be called at any time to get this infor...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_listChunks; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 44; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:chunks; 11, list:[]; 12, for_stateme...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:mostCommonElement; 3, parameters; 3, 4; 3, 12; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:elements; 6, type; 6, 7; 7, generic_type; 7, 8; 7, 9; 8, identifier:Iterable; 9, type_parameter; 9, 10; 10, type; 10, 11; 11, identifier:T; 12, typed_...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:minute_index_to_session_labels; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:index; 6, block; 6, 7; 6, 9; 6, 20; 6, 21; 6, 22; 6, 43; 6, 62; 6, 63; 6, 70; 6, 162; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:aggregate_repeated_calls; 3, parameters; 3, 4; 3, 5; 4, identifier:frame; 5, identifier:options; 6, block; 6, 7; 6, 9; 6, 16; 6, 20; 6, 21; 6, 83; 6, 84; 6, 98; 6, 99; 6, 100; 6, 101; 6, 118; 6, 119; 7, expression_statement; 7, 8; 8, string:'''...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:get_all_tags_names_as_list; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:admin; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:language; 10, string:"en"; 11, block; 11, 12; 11...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_users; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:course; 6, block; 6, 7; 6, 9; 6, 57; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:users; 12, ca...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:radius_cmp; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:a; 5, identifier:b; 6, identifier:offsets; 7, block; 7, 8; 7, 10; 7, 24; 7, 31; 7, 39; 8, expression_statement; 8, 9; 9, string:'''return +1 or -1 for for sorting'''; 10, expression_sta...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:generate_enums_info; 3, parameters; 3, 4; 3, 5; 4, identifier:enums; 5, identifier:msgs; 6, block; 6, 7; 6, 9; 6, 234; 7, expression_statement; 7, 8; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 12; 10, identifier:enum; 11, identifier:enums; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:compare_report_print; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:sorted_list; 5, identifier:scores; 6, identifier:best_name; 7, block; 7, 8; 7, 10; 7, 18; 7, 44; 7, 100; 7, 104; 7, 115; 7, 142; 7, 146; 7, 221; 7, 232; 8, expression_statemen...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:replace_cells; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:key; 6, identifier:sorted_row_idxs; 7, block; 7, 8; 7, 10; 7, 17; 7, 21; 7, 25; 7, 37; 7, 108; 7, 123; 8, expression_statement; 8, 9; 9, comment; 10, expression_s...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:OnSortAscending; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:event; 6, block; 6, 7; 6, 9; 6, 64; 7, expression_statement; 7, 8; 8, comment; 9, try_statement; 9, 10; 9, 48; 10, block; 10, 11; 10, 41; 11, with_statement; 11, 12; ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:get_font_list; 3, parameters; 4, block; 4, 5; 4, 7; 4, 15; 4, 31; 4, 37; 5, expression_statement; 5, 6; 6, comment; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:font_map; 10, call; 10, 11; 10, 14; 11, attribute; 11, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_sorted_keys; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:keys; 6, identifier:startkey; 7, default_parameter; 7, 8; 7, 9; 8, identifier:reverse; 9, False; 10, block; 10, 11; 10, 13; 10, 26; 10, 73; 10, 86; 10, 100;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:stratify; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 30; 5, 38; 5, 76; 5, 92; 5, 112; 5, 131; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 14; 10, pattern_list; 10, 11...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 43; 2, function_name:list_current_orders; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 25; 3, 28; 3, 31; 3, 34; 3, 37; 3, 40; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:bet_ids; 7, None; 8, default_parameter; 8, 9; 8, 10...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:visit_Module; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:node; 6, block; 6, 7; 6, 9; 6, 15; 6, 21; 6, 52; 6, 94; 6, 105; 6, 113; 6, 119; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:qzordered; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:A; 5, identifier:B; 6, default_parameter; 6, 7; 6, 8; 7, identifier:crit; 8, float:1.0; 9, block; 9, 10; 9, 12; 9, 16; 9, 32; 9, 52; 9, 71; 10, expression_statement; 10, 11; 11, string:"...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:ordqz; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:A; 5, identifier:B; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, string:'lhp'; 9, default_parameter; 9, 10; 9, 11; 10, identifier:output; 11, string:'...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:inverse_cdf; 3, parameters; 3, 4; 3, 5; 4, identifier:su; 5, identifier:W; 6, block; 6, 7; 6, 9; 6, 13; 6, 19; 6, 27; 6, 37; 6, 67; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, i...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort_items; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:items; 6, default_parameter; 6, 7; 6, 8; 7, identifier:args; 8, False; 9, block; 9, 10; 9, 12; 9, 26; 9, 35; 9, 111; 9, 127; 9, 256; 9, 272; 10, expression_statement...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 23; 5, 38; 5, 53; 5, 68; 5, 83; 5, 98; 5, 113; 5, 128; 5, 143; 5, 158; 5, 173; 5, 188; 5, 203; 5, 218; 6, expression_statement; 6, 7; 7, string:''' Sorts components...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_catalogue_chronologically; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 25; 5, 49; 6, expression_statement; 6, 7; 7, string:''' Sorts the catalogue into chronological order '''; 8, expression_sta...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:cmp_mat; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, identifier:b; 6, block; 6, 7; 6, 9; 6, 13; 6, 48; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:c; 12, integer:0...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_dicoms; 3, parameters; 3, 4; 4, identifier:dicoms; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 30; 5, 48; 5, 66; 5, 88; 5, 110; 5, 132; 5, 143; 5, 154; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, comment; 10, comment;...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_get_sorted_mosaics; 3, parameters; 3, 4; 4, identifier:dicom_input; 5, block; 5, 6; 5, 8; 5, 9; 5, 24; 5, 58; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:relate_obs_ids_to_chosen_alts; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:obs_id_array; 5, identifier:alt_id_array; 6, identifier:choice_array; 7, block; 7, 8; 7, 10; 7, 11; 7, 15; 7, 68; 7, 69; 8, expression_statement; 8, 9; 9, comment; 10...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:create_estimation_obj; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:model_obj; 5, identifier:init_vals; 6, default_parameter; 6, 7; 6, 8; 7, identifier:mappings; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sequence; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 110; 6, expression_statement; 6, 7; 7, string:''' sort the points in the line with given option '''; 8, if_statement; 8, 9; 8, 20; 9, parenthesized_expr...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_pos; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:key; 6, block; 6, 7; 6, 9; 6, 26; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:p; 12, call; 12, ...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:lapmod; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 4, identifier:n; 5, identifier:cc; 6, identifier:ii; 7, identifier:kk; 8, default_parameter; 8, 9; 8, 10; 9, identifier:fast; 10, True; 11, default_parameter; 11, 12; 11, 13; 1...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_items; 3, parameters; 3, 4; 4, identifier:items; 5, block; 5, 6; 5, 8; 5, 12; 5, 50; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:sorted_items; 11, dictionary; 12, fo...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_user_permissions; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:user_id; 6, block; 6, 7; 6, 9; 6, 22; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:p...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:transformChildrenToNative; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 10; 8, 23; 9, identifier:childArray; 10, generator_expression; 10, 11; 10, 16; 11, s...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sort_candidate_pairs; 3, parameters; 3, 4; 3, 5; 4, identifier:pairs; 5, identifier:ice_controlling; 6, block; 6, 7; 6, 9; 6, 26; 7, expression_statement; 7, 8; 8, comment; 9, function_definition; 9, 10; 9, 11; 9, 13; 10, function_name:pair_pri...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:order_by_refs; 3, parameters; 3, 4; 4, identifier:envs; 5, block; 5, 6; 5, 8; 5, 25; 5, 37; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:topology; 11, dictionary_comprehen...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:merged_packages; 3, parameters; 3, 4; 3, 5; 4, identifier:env_packages; 5, identifier:names; 6, block; 6, 7; 6, 9; 6, 32; 6, 36; 6, 42; 6, 80; 6, 113; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:recursive_refs; 3, parameters; 3, 4; 3, 5; 4, identifier:envs; 5, identifier:name; 6, block; 6, 7; 6, 9; 6, 26; 6, 32; 6, 65; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identif...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:reference_cluster; 3, parameters; 3, 4; 3, 5; 4, identifier:envs; 5, identifier:name; 6, block; 6, 7; 6, 9; 6, 29; 6, 43; 6, 89; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, iden...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:search; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:text; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:offset; 11, integer:100; 12,...
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; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:query; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, identifier:query; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:offset; 11, integer:100; 12,...
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...