nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:interev_mag; 3, parameters; 4, block; 5, identifier:times; 6, identifier:mags; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, import_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expressio...
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; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 7, 35; 7, 36; 8, 37; 9, 38; 10, 39; 11, 40; 12, 41; 13, 42; 14, 43; 16, 44; 17, 45; 18, 46;...
def interev_mag(times, mags, size=(10.5, 7.5), **kwargs): """ Plot inter-event times against magnitude. :type times: list :param times: list of the detection times, must be sorted the same as mags :type mags: list :param mags: list of magnitudes :type size: tuple :param size: Size of fi...
0, module; 1, function_definition; 2, function_name:pprint_blockers; 3, parameters; 4, block; 5, identifier:blockers; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Pretty print blockers into a sequence of strings. Results will be sorted by top-level project...
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; 14, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 32, 42; 33, 43; ...
def pprint_blockers(blockers): """Pretty print blockers into a sequence of strings. Results will be sorted by top-level project name. This means that if a project is blocking another project then the dependent project will be what is used in the sorting, not the project at the bottom of the depende...
0, module; 1, function_definition; 2, function_name:get_document_summary; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, for_statement; 15,...
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; 10, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 14, 30; 14, 31; 15, 32; 23, 33; 23, 34; 25, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 28, 41; 28, 42; 30, 43; 30, 44;...
def get_document_summary(self, N=None, cite_sort=True, refresh=True): """Return a summary string of documents. Parameters ---------- N : int or None (optional, default=None) Maximum number of documents to include in the summary. If None, return all documents. ...
0, module; 1, function_definition; 2, function_name:_match_version_string; 3, parameters; 4, block; 5, identifier:version; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# If, for whatever reason, the binary didn't tell us its version, then; 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; 6, 15; 7, 16; 8, 17; 9, 18; 13, 19; 13, 20; 13, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 21, 32; 22, 33; 22, 34; 22, 35; 24, 36; 24, 37; 26, 38; 26, 39; 27, 40; 27, 41; 27, 42; 28, 43; 28,...
def _match_version_string(version): """Sort a binary version string into major, minor, and micro integers. :param str version: A version string in the form x.x.x :raises GnuPGVersionError: if the **version** string couldn't be parsed. :rtype: tuple :returns: A 3-tuple of integers, representing the...
0, module; 1, function_definition; 2, function_name:generate_help; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Generates help text with alphabetically sorted recipes."""; 11, assignment; 12, assignment; 13, pat...
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; 8, 14; 8, 15; 9, 16; 11, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 14, 25; 15, 26; 18, 27; 20, 28; 20, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 27, 35; 28, 36; 28, 37; 31, 38; 31, 39; 32, 40; 32, 41; 36, 42; 36, 43; 3...
def generate_help(): """Generates help text with alphabetically sorted recipes.""" help_text = '\nAvailable recipes:\n\n' recipes = config.Config.get_registered_recipes() for contents, _, _ in sorted(recipes, key=lambda k: k[0]['name']): help_text += ' {0:<35s}{1:s}\n'.format( contents['name'], cont...
0, module; 1, function_definition; 2, function_name:write_to_csv; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, dictionary_splat_pattern; 12, expression_statement; 13, import_statement; 14, if_statement; 15...
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; 6, 26; 6, 27; 7, 28; 7, 29; 8, 30; 8, 31; 9, 32; 9, 33; 10, 34; 10, 35; 11, 36; 12, 37; 13, 38; 14, 39; 14, 40; 14, 41; 14, 42; 15, 43; 17, 44; 18, 45; 18...
def write_to_csv(self, filename=None, extension='.dat', overwrite=False, stride=1, chunksize=None, **kw): """ write all data to csv with numpy.savetxt Parameters ---------- filename : str, optional filename string, which may contain placeholders {itraj} ...
0, module; 1, function_definition; 2, function_name:add_distances; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indices; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, import_from_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, express...
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; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 27, 37; 30, 38; 30, 39; 32, 40; 32, 41; 34, 42; 34, 43; 35, ...
def add_distances(self, indices, periodic=True, indices2=None): r""" Adds the distances between atoms to the feature list. Parameters ---------- indices : can be of two types: ndarray((n, 2), dtype=int): n x 2 array with the pairs of atoms be...
0, module; 1, function_definition; 2, function_name:add_inverse_distances; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indices; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, import_from_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14,...
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; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 27, 37; 30, 38; 30, 39; 32, 40; 32, 41; 34, 42; 34, 43; 35, ...
def add_inverse_distances(self, indices, periodic=True, indices2=None): """ Adds the inverse distances between atoms to the feature list. Parameters ---------- indices : can be of two types: ndarray((n, 2), dtype=int): n x 2 array with the pa...
0, module; 1, function_definition; 2, function_name:add_contacts; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indices; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, import_from_statement; 13, expression_statement; 14, expression_sta...
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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 33, 43; 36, 44;...
def add_contacts(self, indices, indices2=None, threshold=0.3, periodic=True, count_contacts=False): r""" Adds the contacts to the feature list. Parameters ---------- indices : can be of two types: ndarray((n, 2), dtype=int): n x 2 array with ...
0, module; 1, function_definition; 2, function_name:spd_eig; 3, parameters; 4, block; 5, identifier:W; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# check input; 11, assert_statement; 12, if_statement; 13, expression_statement; 14, comment:# sort them; 15, comm...
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; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 11, 35; 11, 36; 12, 37; 12, 38; 12, 39; 12, 40; 12, 41; 13, 42; 17, 43; 18, 44; 18, 45; 20,...
def spd_eig(W, epsilon=1e-10, method='QR', canonical_signs=False): """ Rank-reduced eigenvalue decomposition of symmetric positive definite matrix. Removes all negligible eigenvalues Parameters ---------- W : ndarray((n, n), dtype=float) Symmetric positive-definite (spd) matrix. epsilo...
0, module; 1, function_definition; 2, function_name:eig_corr; 3, parameters; 4, block; 5, identifier:C0; 6, identifier:Ct; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# solve the symmetric eigenvalue problem ...
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; 4, 19; 4, 20; 4, 21; 4, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 11, 30; 12, 31; 14, 32; 14, 33; 14, 34; 16, 35; 18, 36; 20, 37; 20, 38; 22, 39; 26, 40; 30, 41; 30, 42; 31, 43; 31, 44; 32, 4...
def eig_corr(C0, Ct, epsilon=1e-10, method='QR', sign_maxelement=False): r""" Solve generalized eigenvalue problem with correlation matrices C0 and Ct Numerically robust solution of a generalized Hermitian (symmetric) eigenvalue problem of the form .. math:: \mathbf{C}_t \mathbf{r}_i = \mathbf...
0, module; 1, function_definition; 2, function_name:sortino_ratio; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:threshold; 13, float:0.0; 14, identifier:ddof; 15, int...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 19, 21; 19, 22; 20, 23; 20, 24; 22, 25; 22, 26; 23, 27; 25, 28; 25, 29; 26, 30; 26, 31; 26, 32; 27, 33; 27, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 33, 42; 41, 43; 41,...
def sortino_ratio(self, threshold=0.0, ddof=0, freq=None): """Return over a threshold per unit of downside deviation. A performance appraisal ratio that replaces standard deviation in the Sharpe ratio with downside deviation. [Source: CFA Institute] Parameters ---------...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:columnId; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_st...
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; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 14, 23; 16, 24; 16, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 26, 38; 26, 39; 28, 40; 28, 41; 31, 42; 31, 43; 32,...
def sort(self, columnId, order=Qt.AscendingOrder): """ Sorts the model column After sorting the data in ascending or descending order, a signal `layoutChanged` is emitted. :param: columnId (int) the index of the column to sort on. :param: order (Qt::SortOrde...
0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, identifier:clf; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# obtain a 3D array with accuracy numbers; 14, exp...
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; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 12, 27; 14, 28; 16, 29; 17, 30; 18, 31; 18, 32; 19, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 44; ...
def run(self, clf): """ run activity-based voxel selection Sort the voxels based on the cross-validation accuracy of their activity vectors within the searchlight Parameters ---------- clf: classification function the classifier to be used in cross validatio...
0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, identifier:clf; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""Run correlation-based voxel selection in master-worker model. Sort the voxels based on...
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; 14, 23; 15, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 32, 40; 33, 41; 33, 42; 36, 43; ...
def run(self, clf): """Run correlation-based voxel selection in master-worker model. Sort the voxels based on the cross-validation accuracy of their correlation vectors Parameters ---------- clf: classification function the classifier to be used in cross val...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column_or_label; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, assert_statement; 13, if_statement; 14, return_statement; 15, identif...
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; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 20, 29; 20, 30; 22, 31; 23, 32; 24, 33; 24, 34; 27, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 32, 41; 33, 42; 33, 43; 35, ...
def sort(self, column_or_label, descending=False, distinct=False): """Return a Table of rows sorted according to the values in a column. Args: ``column_or_label``: the column whose values are used for sorting. ``descending``: if True, sorting will be in descending, rather than ...
0, module; 1, function_definition; 2, function_name:_sub_expand; 3, parameters; 4, block; 5, identifier:self; 6, identifier:tags; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# name entities; 11, for_statement; 12, for_statement; 13, comment:"""This called by expand to find cli...
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; 11, 16; 11, 17; 11, 18; 12, 19; 12, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 18, 26; 20, 27; 20, 28; 21, 29; 21, 30; 21, 31; 21, 32; 25, 33; 25, 34; 26, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 30, 41; 30, 42; 30, 43; ...
def _sub_expand(self, tags): """This called by expand to find cliques Args: tags (list): a list of the tags used to get cliques Yields: list : list of sorted tags by start_token this is a clique """ entities = {} graph = self._build_graph(tags) ...
0, module; 1, function_definition; 2, function_name:_rank_results; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, generic_type; 9, expression_statement; 10, comment:# https://stackoverflow.com/a/73050; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:results...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 11, 21; 12, 22; 12, 23; 13, 24; 15, 25; 17, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 23, 34; 25, 35; 25, 36; 27, 37; 29, 38; 29, 39; 30, 40; 30, 41; 32, 42; 33, 43; 34, 4...
def _rank_results(results: List[Dict], method: SimAlgorithm) -> List[Dict]: """ Ranks results - for phenodigm results are ranks but ties need to accounted for for other methods, results need to be reranked :param results: Results from search_by_attribute_set()['results']...
0, module; 1, function_definition; 2, function_name:sorted_source_files; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, assert_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Returns a list of targets in topologically sorted order."""; 12, attribute; ...
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; 9, 15; 9, 16; 9, 17; 10, 18; 12, 19; 12, 20; 13, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 18, 27; 18, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 26, 34; 28, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35...
def sorted_source_files(self): """Returns a list of targets in topologically sorted order.""" assert self.final, 'Call build() before using the graph.' out = [] for node in nx.topological_sort(self.graph): if isinstance(node, NodeSet): out.append(node.nodes) ...
0, module; 1, function_definition; 2, function_name:expand_source_files; 3, parameters; 4, block; 5, identifier:filenames; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:cwd; 12, None; 13, comment:"""Expand a list of filenames passed in as ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 14, 19; 14, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 22, 26; 22, 27; 23, 28; 23, 29; 23, 30; 23, 31; 25, 32; 28, 33; 28, 34; 30, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 35, 42; 36, 43; 38...
def expand_source_files(filenames, cwd=None): """Expand a list of filenames passed in as sources. This is a helper function for handling command line arguments that specify a list of source files and directories. Any directories in filenames will be scanned recursively for .py files. Any files tha...
0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# count before filtering; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14...
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; 4, 25; 4, 26; 4, 27; 6, 28; 7, 29; 9, 30; 10, 31; 11, 32; 12, 33; 13, 34; 15, 35; 16, 36; 18, 37; 20, 38; 21, 39; 21, 40; 21, 41; 21, 42; 22, 43; 24, 44; 26, 45;...
def run(self): """Launch filtering, sorting and paging to output results.""" query = self.query # count before filtering self.cardinality = query.add_columns(self.columns[0].sqla_expr).count() self._set_column_filter_expressions() self._set_global_filter_expression() ...
0, module; 1, function_definition; 2, function_name:poll_events; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, while_statement; 8, comment:"""Continuously polls all types of events from sl4a. Events are sorted by name and store in separate queues. If there are registered hand...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 9, 11; 9, 12; 10, 13; 10, 14; 10, 15; 10, 16; 10, 17; 10, 18; 10, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 16, 26; 16, 27; 18, 28; 18, 29; 19, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 24, 39; 25, 40; 26, 41; 26, 42; 27, 4...
def poll_events(self): """Continuously polls all types of events from sl4a. Events are sorted by name and store in separate queues. If there are registered handlers, the handlers will be called with corresponding event immediately upon event discovery, and the event won't be sto...
0, module; 1, function_definition; 2, function_name:pop_events; 3, parameters; 4, block; 5, identifier:self; 6, identifier:regex_pattern; 7, identifier:timeout; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, while_statement; 12, if_statement; 13, return_statement; 14, comment:"""Pop events whos...
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; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 12, 22; 13, 23; 15, 24; 16, 25; 17, 26; 17, 27; 20, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 27, 39; 27, 40; 28, 41; 29, 42; 29, 43; 3...
def pop_events(self, regex_pattern, timeout): """Pop events whose names match a regex pattern. If such event(s) exist, pop one event from each event queue that satisfies the condition. Otherwise, wait for an event that satisfies the condition to occur, with timeout. Results are...
0, module; 1, function_definition; 2, function_name:children; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:""" The list of child messages and actions sorted by task level, excluding the start and end messages. """; 9, call; 10, identifier:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 12, 13; 12, 14; 14, 15; 14, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 23, 27; 24, 28; 24, 29
def children(self): """ The list of child messages and actions sorted by task level, excluding the start and end messages. """ return pvector( sorted(self._children.values(), key=lambda m: m.task_level))
0, module; 1, function_definition; 2, function_name:_get_last_child_with_lineno; 3, parameters; 4, block; 5, identifier:node; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# The fields of ast.Call are in the wrong order.; 10, if_statement; 11, for_statement; 12, 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; 6, 13; 7, 14; 8, 15; 10, 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; 19, 29; 19, 30; 20, 31; 20, 32; 20, 33; 20, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 27, 40; 28, 41; 30, 42; 31, 43; ...
def _get_last_child_with_lineno(node): """ Return the last direct child of `node` that has a lineno attribute, or None if `node` has no such children. Almost all node._field lists are sorted by the order in which they appear in source code. For some nodes however, we have to skip some fields th...
0, module; 1, function_definition; 2, function_name:get_patched_ast; 3, parameters; 4, block; 5, identifier:source; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:sorted_children; 10, False; 11, comment:"""Adds ``region`` and ``sorted_children`` fields to nodes Adds ``sorted_chil...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 12, 13; 12, 14; 14, 15; 14, 16; 14, 17; 15, 18; 15, 19; 18, 20; 18, 21; 19, 22
def get_patched_ast(source, sorted_children=False): """Adds ``region`` and ``sorted_children`` fields to nodes Adds ``sorted_children`` field only if `sorted_children` is True. """ return patch_ast(ast.parse(source), source, sorted_children)
0, module; 1, function_definition; 2, function_name:patch_ast; 3, parameters; 4, block; 5, identifier:node; 6, identifier:source; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:sorted_children; 14, False; 15, comme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 22, 28; 22, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 29, 37; 32, 38; 32, 39; 39, 40; 39, 41
def patch_ast(node, source, sorted_children=False): """Patches the given node After calling, each node in `node` will have a new field named `region` that is a tuple containing the start and end offsets of the code that generated it. If `sorted_children` is true, a `sorted_children` field will ...
0, module; 1, function_definition; 2, function_name:write_ast; 3, parameters; 4, block; 5, identifier:patched_ast_node; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Extract source form a patched AST node with `sorted_children` field If the node is patched ...
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; 15, 21; 15, 22; 20, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 23, 29; 23, 30; 24, 31; 25, 32; 30, 33; 30, 34; 31, 35; 32, 36; 34, 37; 34, 38; 35, 39; 35, 40; 36, 41; 39, 42; 39, 43; ...
def write_ast(patched_ast_node): """Extract source form a patched AST node with `sorted_children` field If the node is patched with sorted_children turned off you can use `node_region` function for obtaining code using module source code. """ result = [] for child in patched_ast_node.sorted_chi...
0, module; 1, function_definition; 2, function_name:sorted_proposals; 3, parameters; 4, block; 5, identifier:proposals; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:scopepref; 12, None; 13, identifier:typepref; 14, None; 15, comment:"...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 16, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 23, 26; 23, 27; 23, 28
def sorted_proposals(proposals, scopepref=None, typepref=None): """Sort a list of proposals Return a sorted list of the given `CodeAssistProposal`\s. `scopepref` can be a list of proposal scopes. Defaults to ``['parameter_keyword', 'local', 'global', 'imported', 'attribute', 'builtin', 'keyword']...
0, module; 1, function_definition; 2, function_name:get_sorted_proposal_list; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Return a list of `CodeAssistProposal`"""; 13, as...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 13, 22; 13, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 19, 29; 19, 30; 20, 31; 20, 32; 20, 33; 20, 34; 26, 35; 31, 36; 32, 37; 33, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43; 37...
def get_sorted_proposal_list(self): """Return a list of `CodeAssistProposal`""" proposals = {} for proposal in self.proposals: proposals.setdefault(proposal.scope, []).append(proposal) result = [] for scope in self.scopepref: scope_proposals = proposals.ge...
0, module; 1, function_definition; 2, function_name:get_rank; 3, parameters; 4, block; 5, identifier:self; 6, identifier:entity; 7, identifier:criteria; 8, default_parameter; 9, expression_statement; 10, comment:# If entity is for instance 'person.household', we get the reference entity 'household' behind the projector...
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; 4, 23; 4, 24; 4, 25; 8, 26; 8, 27; 9, 28; 11, 29; 12, 30; 13, 31; 14, 32; 15, 33; 17, 34; 21, 35; 23, 36; 25, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32, 44; 32, 4...
def get_rank(self, entity, criteria, condition = True): """ Get the rank of a person within an entity according to a criteria. The person with rank 0 has the minimum value of criteria. If condition is specified, then the persons who don't respect it are not taken into account and their r...
0, module; 1, function_definition; 2, function_name:value_nth_person; 3, parameters; 4, block; 5, identifier:self; 6, identifier:n; 7, identifier:array; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_s...
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; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 17, 27; 18, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 29, 41; 29, 42; 30, 43; 32, 44...
def value_nth_person(self, n, array, default = 0): """ Get the value of array for the person whose position in the entity is n. Note that this position is arbitrary, and that members are not sorted. If the nth person does not exist, return ``default`` instead. ...
0, module; 1, function_definition; 2, function_name:create_query_index; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, return_stat...
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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 12, 26; 12, 27; 12, 28; 13, 29; 14, 30; 20, 31; 25, 32; 25, 33; 26, 34; 27, 35; 27, 36; 28, 37; 29, 38; 29, 39; 34, 40; 35, 41; 35, 42; 36, 43; 37, 44;...
def create_query_index( self, design_document_id=None, index_name=None, index_type='json', partitioned=False, **kwargs ): """ Creates either a JSON or a text query index in the remote database. :param str index_type: Th...
0, module; 1, function_definition; 2, function_name:get_search_result; 3, parameters; 4, block; 5, identifier:self; 6, identifier:ddoc_id; 7, identifier:index_name; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:query_params; 13, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 11, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 24, 28; 24, 29; 25, 30; 28, 31; 28, 32; 29, 33; 31, 34; 33, 35; 33, 36; 33, 37; 35, 38; 35, 39; 36, 40
def get_search_result(self, ddoc_id, index_name, **query_params): """ Retrieves the raw JSON content from the remote database based on the search index on the server, using the query_params provided as query parameters. A ``query`` parameter containing the Lucene query syntax is ...
0, module; 1, function_definition; 2, function_name:predict_log_proba; 3, parameters; 4, block; 5, identifier:self; 6, identifier:X; 7, expression_statement; 8, expression_statement; 9, comment:# normalize by P(x) = P(f_1, ..., f_n); 10, expression_statement; 11, comment:# return shape = (2,); 12, return_statement; 13,...
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; 10, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 26, 32; 26, 33; 27, 34; 27, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40
def predict_log_proba(self, X): """ Return log-probability estimates for the test vector X. Parameters ---------- X : array-like, shape = [n_samples, n_features] Returns ------- C : array-like, shape = [n_samples, n_classes] Returns the log-p...
0, module; 1, function_definition; 2, function_name:_get_sorting_key_values; 3, parameters; 4, block; 5, identifier:self; 6, identifier:array1; 7, identifier:array2; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""return the sorting key values as a series...
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; 10, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 24, 32; 24, 33; 25, 34; 31, 35; 31, 36
def _get_sorting_key_values(self, array1, array2): """return the sorting key values as a series""" concat_arrays = numpy.concatenate([array1, array2]) unique_values = numpy.unique(concat_arrays) return numpy.sort(unique_values)
0, module; 1, function_definition; 2, function_name:sortedneighbourhood; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:args; 13, identifier:kwargs; 14, comm...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 27, 29; 28, 30
def sortedneighbourhood(self, *args, **kwargs): """Add a Sorted Neighbourhood Index. Shortcut of :class:`recordlinkage.index.SortedNeighbourhood`:: from recordlinkage.index import SortedNeighbourhood indexer = recordlinkage.Index() indexer.add(SortedNeighbourhood()...
0, module; 1, function_definition; 2, function_name:_build_bst_from_sorted_values; 3, parameters; 4, block; 5, identifier:sorted_values; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Re...
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; 9, 17; 10, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 21, 32; 21, 33; 23, 34; 25, 35; 25, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 30...
def _build_bst_from_sorted_values(sorted_values): """Recursively build a perfect BST from odd number of sorted values. :param sorted_values: Odd number of sorted values. :type sorted_values: [int | float] :return: Root node of the BST. :rtype: binarytree.Node """ if len(sorted_values) == 0:...
0, module; 1, function_definition; 2, function_name:holm; 3, parameters; 4, block; 5, identifier:pvals; 6, default_parameter; 7, expression_statement; 8, comment:# Convert to array and save original shape; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, 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; 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; 6, 27; 6, 28; 7, 29; 9, 30; 10, 31; 11, 32; 12, 33; 14, 34; 15, 35; 16, 36; 17, 37; 19, 38; 20, 39; 21, 40; 23, 41; 24, 42; 25, 43; 25, 44; 26, 45;...
def holm(pvals, alpha=.05): """P-values correction with Holm method. Parameters ---------- pvals : array_like Array of p-values of the individual tests. alpha : float Error rate (= alpha level). Returns ------- reject : array, bool True if a hypothesis is reject...
0, module; 1, function_definition; 2, function_name:sort_reverse_chronologically; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:""" Sorts the measurements of this buffer in reverse chronological order """; 9, call; 10, attribute; 11, argument_...
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; 14, 18; 14, 19; 15, 20; 15, 21; 19, 22; 19, 23; 22, 24; 23, 25; 23, 26
def sort_reverse_chronologically(self): """ Sorts the measurements of this buffer in reverse chronological order """ self.measurements.sort(key=lambda m: m.timestamp, reverse=True)
0, module; 1, function_definition; 2, function_name:sorted_dependencies; 3, parameters; 4, block; 5, identifier:dist; 6, default_parameter; 7, expression_statement; 8, import_from_statement; 9, expression_statement; 10, comment:# create DAG as list of nodes and edges:; 11, expression_statement; 12, 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; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 6, 23; 6, 24; 7, 25; 8, 26; 8, 27; 9, 28; 11, 29; 12, 30; 13, 31; 14, 32; 14, 33; 16, 34; 17, 35; 18, 36; 18, 37; 18, 38; 20, 39; 20, 40; 21, 41; 21, 42; 22, 43; 26, 44; 27, 4...
def sorted_dependencies(dist, reverse=False): """ Extract all underlying dependencies from a distribution sorted topologically. Uses depth-first algorithm. See more here: Args: dist (Dist): Distribution to extract dependencies from. reverse (bool): If True, ...
0, module; 1, function_definition; 2, function_name:orth_ttr; 3, parameters; 4, block; 5, identifier:order; 6, identifier:dist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, dictionary_splat_pattern; 12, expression_statement; 13, expression_statement; 14, if_statement; 15,...
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; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 10, 27; 11, 28; 12, 29; 13, 30; 14, 31; 14, 32; 15, 33; 16, 34; 16, 35; 16, 36; 17, 37; 18, 38; 18, 39; 19, 40; 30, 41; 30, 42; 32, 43; 32, 44; 33...
def orth_ttr( order, dist, normed=False, sort="GR", retall=False, cross_truncation=1., **kws): """ Create orthogonal polynomial expansion from three terms recursion formula. Args: order (int): Order of polynomial expansion. dist (Dist): Distribution s...
0, module; 1, function_definition; 2, function_name:orth_chol; 3, parameters; 4, block; 5, identifier:order; 6, identifier:dist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_st...
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; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 11, 37; 12, 38; 13, 39; 14, 40; 15, 41; 16, 42; 17, 43; 17, 44; 18, 45; 19, ...
def orth_chol(order, dist, normed=True, sort="GR", cross_truncation=1., **kws): """ Create orthogonal polynomial expansion from Cholesky decomposition. Args: order (int): Order of polynomial expansion dist (Dist): Distribution space where polynomials are orthogonal ...
0, module; 1, function_definition; 2, function_name:sort_key; 3, parameters; 4, block; 5, identifier:val; 6, expression_statement; 7, return_statement; 8, comment:"""Sort key for sorting keys in grevlex order."""; 9, call; 10, attribute; 11, argument_list; 12, identifier:numpy; 13, identifier:sum; 14, binary_operator:(...
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; 14, 15; 14, 16; 15, 17; 15, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 21, 28; 22, 29; 22, 30; 26, 31; 26, 32; 27, 33; 28, 34; 30, 35; 31, 36; 31, 37; 37, 38
def sort_key(val): """Sort key for sorting keys in grevlex order.""" return numpy.sum((max(val)+1)**numpy.arange(len(val)-1, -1, -1)*val)
0, module; 1, function_definition; 2, function_name:orth_gs; 3, parameters; 4, block; 5, identifier:order; 6, identifier:dist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, if_statement; 1...
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; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 14, 30; 14, 31; 15, 32; 16, 33; 17, 34; 17, 35; 17, 36; 18, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, 44; 3...
def orth_gs(order, dist, normed=False, sort="GR", cross_truncation=1., **kws): """ Gram-Schmidt process for generating orthogonal polynomials. Args: order (int, Poly): The upper polynomial order. Alternative a custom polynomial basis can be used. dist (Dist): ...
0, module; 1, function_definition; 2, function_name:basis; 3, parameters; 4, block; 5, identifier:start; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, e...
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; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 11, 37; 11, 38; 12, 39; 13, 40; 14, 41; 15, 42; 16, 43; 16, 44; 16, 45; 17, ...
def basis(start, stop=None, dim=1, sort="G", cross_truncation=1.): """ Create an N-dimensional unit polynomial basis. Args: start (int, numpy.ndarray): the minimum polynomial to include. If int is provided, set as lowest total order. If array of int, set as lower order alon...
0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:key; 11, None; 12, identifier:reverse; 13, False; 14, comment:""" Uses python sort and its passed argu...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 15, 16; 15, 17; 16, 18; 16, 19; 17, 20; 20, 21; 20, 22; 21, 23; 21, 24; 22, 25; 22, 26; 25, 27; 25, 28; 26, 29; 26, 30
def sorted(self, key=None, reverse=False): """ Uses python sort and its passed arguments to sort the input. >>> seq([2, 1, 4, 3]).sorted() [1, 2, 3, 4] :param key: sort using key function :param reverse: return list reversed or not :return: sorted sequence ...
0, module; 1, function_definition; 2, function_name:GetCredentials; 3, parameters; 4, block; 5, identifier:package_name; 6, identifier:scopes; 7, identifier:client_id; 8, identifier:client_secret; 9, identifier:user_agent; 10, default_parameter; 11, default_parameter; 12, comment:# pylint: disable=unused-argument; 13, ...
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; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 10, 25; 10, 26; 11, 27; 11, 28; 13, 29; 13, 30; 15, 31; 15, 32; 16, 33; 17, 34; 18, 35; 19, 36; 20, 37; 20, 38; 20, 39; 21, 40; 22, 41; 23, 42; 23, 43; 24, 44; 3...
def GetCredentials(package_name, scopes, client_id, client_secret, user_agent, credentials_filename=None, api_key=None, # pylint: disable=unused-argument client=None, # pylint: disable=unused-argument oauth2client_args=None, ...
0, module; 1, function_definition; 2, function_name:get_sorted_graph; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, with_statement; 14, if_statement; 15, return_s...
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; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 14, 31; 14, 32; 15, 33; 27, 34; 28, 35; 29, 36; 30, 37; 30, 38; 30, 39; 30, 40; 32, 41; 34, 42; 34, 43; 35, 44; ...
def get_sorted_graph( self, start=0, stop=100, slices=100, include_inf=False, exact=False): """ Returns a graph of the distribution of jobs in a sorted set """ if not self.is_sorted: raise Exception("Not a sorted queue"...
0, module; 1, function_definition; 2, function_name:get_threads; 3, parameters; 4, block; 5, identifier:self; 6, identifier:querystring; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, assert_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statement; ...
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; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 14, 25; 16, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 25, 34; 25, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 33, 43; 33, ...
def get_threads(self, querystring, sort='newest_first', exclude_tags=None): """ asynchronously look up thread ids matching `querystring`. :param querystring: The query string to use for the lookup :type querystring: str. :param sort: Sort order. one of ['oldest_first', 'newest_f...
0, module; 1, function_definition; 2, function_name:nd_sort_samples; 3, parameters; 4, block; 5, identifier:samples; 6, expression_statement; 7, comment:# Check the shape of the sample list.; 8, assert_statement; 9, comment:# Build a KD-tree on the samples.; 10, expression_statement; 11, comment:# Compute the distances...
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; 8, 15; 10, 16; 12, 17; 13, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 19, 25; 19, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 26, 33; 28, 34; 31, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 37, 41; 37, 42; 38, 43; ...
def nd_sort_samples(samples): """ Sort an N-dimensional list of samples using a KDTree. :param samples: ``(nsamples, ndim)`` The list of samples. This must be a two-dimensional array. :returns i: ``(nsamples,)`` The list of indices into the original array that return the correctly ...
0, module; 1, function_definition; 2, function_name:GetVolumeIdentifiers; 3, parameters; 4, block; 5, identifier:self; 6, identifier:volume_system; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Retrieves the volume identifiers. Args: volume_system (V...
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; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 21, 25; 22, 26; 22, 27; 24, 28; 25, 29; 25, 30; 27, 31; 30, 32; 30, 33; 31, 34; 33, 35; 33, 36; 33, 37; 34, 38; 34, 39; 36, 40; 38, 41; 38, 42; 39, 43
def GetVolumeIdentifiers(self, volume_system): """Retrieves the volume identifiers. Args: volume_system (VolumeSystem): volume system. Returns: list[str]: sorted volume identifiers. """ volume_identifiers = [] for volume in volume_system.volumes: volume_identifier = getattr(v...
0, module; 1, function_definition; 2, function_name:topological_order_dfs; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Topological sorting by depth first search ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 17, 26; 17, 27; 18, 28; 19, 29; 19, 30; 21, 31; 21, 32; 25, 33; 25, 34; 27, 35; 28, 36; 28, 37; 30, 38; 32, 39; 33, 40; 36, 41; 36, 42; 37, 43; ...
def topological_order_dfs(graph): """Topological sorting by depth first search :param graph: directed graph in listlist format, cannot be listdict :returns: list of vertices in order :complexity: `O(|V|+|E|)` """ n = len(graph) order = [] times_seen = [-1] * n for start in range(n):...
0, module; 1, function_definition; 2, function_name:topological_order; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, return_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; 9, 20; 10, 21; 11, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 16, 28; 16, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 24, 35; 24, 36; 24, 37; 24, 38; 27, 39; 27, 40; 29, 41; 29, 42; 30, 43; 30, 4...
def topological_order(graph): """Topological sorting by maintaining indegree :param graph: directed graph in listlist format, cannot be listdict :returns: list of vertices in order :complexity: `O(|V|+|E|)` """ V = range(len(graph)) indeg = [0 for _ in V] for node in V: # com...
0, module; 1, function_definition; 2, function_name:interval_tree; 3, parameters; 4, block; 5, identifier:intervals; 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...
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; 6, 18; 7, 19; 7, 20; 8, 21; 9, 22; 10, 23; 11, 24; 12, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 17, 32; 19, 33; 19, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 27, 44;...
def interval_tree(intervals): """Construct an interval tree :param intervals: list of half-open intervals encoded as value pairs *[left, right)* :assumes: intervals are lexicographically ordered ``>>> assert intervals == sorted(intervals)`` :returns: the root of the ...
0, module; 1, function_definition; 2, function_name:get_type; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, expression_statement; 8, comment:# XXX FIXME uhm...how to do all the different types of hidden-services?; 9, if_statement; 10, return_statement; 11, comment:""" return the type of a ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 9, 12; 9, 13; 10, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 17, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 27, 29; 27, 30
def get_type(self, name): """ return the type of a config key. :param: name the key FIXME can we do something more-clever than this for client code to determine what sort of thing a key is? """ # XXX FIXME uhm...how to do all the different types of hidden-servi...
0, module; 1, function_definition; 2, function_name:schwarz; 3, parameters; 4, block; 5, identifier:A; 6, identifier:x; 7, identifier:b; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, expression_statem...
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; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 12, 33; 13, 34; 13, 35; 14, 36; 15, 37; 16, 38; 17, 39; 17, 40; 20, 41; 21, 42; 21, 43; 21, 44; 21, ...
def schwarz(A, x, b, iterations=1, subdomain=None, subdomain_ptr=None, inv_subblock=None, inv_subblock_ptr=None, sweep='forward'): """Perform Overlapping multiplicative Schwarz on the linear system Ax=b. Parameters ---------- A : csr_matrix, bsr_matrix Sparse NxN matrix x : ndar...
0, module; 1, function_definition; 2, function_name:get_stdlib_path; 3, parameters; 4, block; 5, expression_statement; 6, if_statement; 7, comment:"""Returns the path to the standard lib for the current path installation. This function can be dropped and "sysconfig.get_paths()" used directly once Python 2.6 suppor...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 5, 7; 6, 8; 6, 9; 6, 10; 8, 11; 8, 12; 9, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 14, 21; 15, 22; 20, 23; 21, 24; 21, 25; 22, 26; 24, 27; 24, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 30, 34; 30, 35; 31, 36; 31, 37; 34, 38; 34, 39; 36, 40; 36, 41; 37, 42
def get_stdlib_path(): """Returns the path to the standard lib for the current path installation. This function can be dropped and "sysconfig.get_paths()" used directly once Python 2.6 support is dropped. """ if sys.version_info >= (2, 7): import sysconfig return sysconfig.get_paths()['...
0, module; 1, function_definition; 2, function_name:exists_case_sensitive; 3, parameters; 4, block; 5, identifier:path; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:""" Returns if the given path exists and also matches the case on Windows. When finding fil...
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; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 16, 21; 16, 22; 17, 23; 17, 24; 19, 25; 20, 26; 21, 27; 21, 28; 22, 29; 23, 30; 23, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 30, 39; 30, 40; 32, 41; 33, 42; 33, 43;...
def exists_case_sensitive(path): """ Returns if the given path exists and also matches the case on Windows. When finding files that can be imported, it is important for the cases to match because while file os.path.exists("module.py") and os.path.exists("MODULE.py") both return True on Windows, Python ...
0, module; 1, function_definition; 2, function_name:_add_comments; 3, parameters; 4, block; 5, identifier:self; 6, identifier:comments; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:original_string; 11, string:""; 12, comment:""" Returns a string with comments added ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 7, 10; 7, 11; 8, 12; 9, 13; 13, 14; 13, 15; 14, 16; 14, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 29, 35
def _add_comments(self, comments, original_string=""): """ Returns a string with comments added """ return comments and "{0} # {1}".format(self._strip_comments(original_string)[0], "; ".join(comments)) or original_string
0, module; 1, function_definition; 2, function_name:_priority_key; 3, parameters; 4, block; 5, identifier:pep8_result; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, try_statement; 12, comment:"""Key for sorting PEP8 results. Global...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 18, 28; 18, 29; 20, 30; 20, 31; 20, 32; 20, 33; 20, 34; 20, 35; 20, 36; 20, 37; 20, 38; 20, 39; 20, 40; 24, 41; 24, 42; 24, 43; ...
def _priority_key(pep8_result): """Key for sorting PEP8 results. Global fixes should be done first. This is important for things like indentation. """ priority = [ # Fix multiline colon-based before semicolon based. 'e701', # Break multiline statements early. 'e702'...
0, module; 1, function_definition; 2, function_name:git_hook; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, comment:# Get list of files modified and staged; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:st...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 5, 13; 5, 14; 6, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 21, 29; 22, 30; 22, 31; 22, 32; 26, 33; 26, 34; 29, 35; 29, 36; 29, 37; 34, 38; 35, 39; 35, 40; 37, 41; 37, 42; 37, 43; 37...
def git_hook(strict=False): """ Git pre-commit hook to check staged files for isort errors :param bool strict - if True, return number of errors on exit, causing the hook to fail. If False, return zero so it will just act as a warning. :return number of errors if in strict mode, 0 othe...
0, module; 1, function_definition; 2, function_name:get_all_fix_names; 3, parameters; 4, block; 5, identifier:fixer_pkg; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:remove_prefix; 14, T...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 20, 29; 20, 30; 21, 31; 24, 32; 24, 33; 26, 34; 26, 35; 30, 36; 31, 37; 31, 38; 33, 39; 33, 40; 33, 41; 33, 42; 34, 43; 34...
def get_all_fix_names(fixer_pkg, remove_prefix=True): """Return a sorted list of all available fix names in the given package.""" pkg = __import__(fixer_pkg, [], [], ["*"]) fixer_dir = os.path.dirname(pkg.__file__) fix_names = [] for name in sorted(os.listdir(fixer_dir)): if name.startswith(...
0, module; 1, function_definition; 2, function_name:check; 3, parameters; 4, comment:# pragma: no cover; 5, block; 6, identifier:self; 7, expression_statement; 8, for_statement; 9, comment:"""re-sort any items in self that are not sorted"""; 10, identifier:unsorted; 11, call; 12, block; 13, identifier:iter; 14, generat...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 7, 9; 8, 10; 8, 11; 8, 12; 11, 13; 11, 14; 12, 15; 14, 16; 14, 17; 14, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 23, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 28, 33; 29, 34; 29, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 4...
def check(self): # pragma: no cover """re-sort any items in self that are not sorted""" for unsorted in iter(self[i] for i in range(len(self) - 2) if not operator.le(self[i], self[i + 1])): self.resort(unsorted)
0, module; 1, function_definition; 2, function_name:sort_by_list_order; 3, parameters; 4, block; 5, identifier:sortlist; 6, identifier:reflist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, function_definition; 12, if_statement; 13, return_statement; 14, identifier:reve...
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; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 22, 27; 23, 28; 23, 29; 25, 30; 26, 31; 26, 32; 28, 33; 28, 34; 29, 35; 29, 36; 29, 37; 29, 38; 30, 39; 30, 40; 30, 41; 32, 42; 32, 43; 32, ...
def sort_by_list_order(sortlist, reflist, reverse=False, fltr=False, slemap=None): """ Sort a list according to the order of entries in a reference list. Parameters ---------- sortlist : list List to be sorted reflist : list Reference list defining sorting ord...
0, module; 1, function_definition; 2, function_name:strategy; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:names; 12, identifier:kwargs; 13, comment:""" StrategyDict wrapping met...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 15, 18; 16, 19; 16, 20; 16, 21; 16, 22; 16, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 23, 30; 24, 31; 24, 32; 26, 33; 26, 34; 27, 35; 28, 36; 29, 37; 29, 38; 32, 39; 32, 40; 33, 41; 34, 42; 36, 43; 3...
def strategy(self, *names, **kwargs): """ StrategyDict wrapping method for adding a new strategy. Parameters ---------- *names : Positional arguments with all names (strings) that could be used to call the strategy to be added, to be used both as key items and as attribute names. ...
0, module; 1, function_definition; 2, function_name:humansort; 3, parameters; 4, block; 5, identifier:l; 6, expression_statement; 7, import_statement; 8, function_definition; 9, expression_statement; 10, return_statement; 11, comment:"""Sort in place a given list the way humans expect. E.g. ['file11', 'file1'] -> ...
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; 8, 15; 8, 16; 8, 17; 9, 18; 10, 19; 12, 20; 14, 21; 17, 22; 17, 23; 18, 24; 18, 25; 22, 26; 22, 27; 22, 28; 23, 29; 24, 30; 24, 31; 25, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 32, 38; 32, 39; 34, 40; 34, 41; 35, 42; 36, 43; 36,...
def humansort(l): """Sort in place a given list the way humans expect. E.g. ['file11', 'file1'] -> ['file1', 'file11'] """ import re def alphanum_key(s): # Turn a string into a list of string and number chunks. # e.g. "z23a" -> ["z", 23, "a"] def tryint(s): if s...
0, module; 1, function_definition; 2, function_name:add; 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, list_splat_pattern; 13, dictionary_splat_pattern; 14, expression_statement; 15, ...
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; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 10, 28; 11, 29; 11, 30; 12, 31; 13, 32; 14, 33; 15, 34; 17, 35; 17, 36; 18, 37; 30, 38; 34, 39; 34, 40; 36, 41; 37, 42; 37, 43; 40, 44; 40,...
def add(self, name='', type='', agent='', scanner='', location='', language='en', *args, **kwargs): """ Simplified add for the most common options. Parameters: name (str): Name of the library agent (str): Example com.plexapp.agents.imdb type (str): mo...
0, module; 1, function_definition; 2, function_name:all; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, identifier:kwarg...
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; 8, 16; 9, 17; 10, 18; 10, 19; 11, 20; 12, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 26, 31; 28, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 33, 41; 33, 42; 37, 43; 39...
def all(self, sort=None, **kwargs): """ Returns a list of media from this library section. Parameters: sort (string): The sort string """ sortStr = '' if sort is not None: sortStr = '?sort=' + sort key = '/library/sections/%s/...
0, module; 1, function_definition; 2, function_name:as_sorted_list; 3, parameters; 4, block; 5, identifier:options; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:""" Returns all options in a list sorted according to their option numbers. :return: the sorted list """;...
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; 13, 16; 13, 17; 15, 18; 17, 19; 18, 20; 18, 21; 21, 22; 21, 23; 23, 24; 23, 25; 25, 26; 25, 27; 27, 28; 27, 29; 28, 30; 29, 31; 29, 32
def as_sorted_list(options): """ Returns all options in a list sorted according to their option numbers. :return: the sorted list """ if len(options) > 0: options = sorted(options, key=lambda o: o.number) return options
0, module; 1, function_definition; 2, function_name:df_all; 3, parameters; 4, block; 5, identifier:self; 6, identifier:phot; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Subclasses may want to sort this """; 11, assignment; 12, identifier:df; 13, identifier:df; 14, call;...
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; 15, 17; 15, 18; 16, 19; 19, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 25, 29; 25, 30; 29, 31; 29, 32; 30, 33
def df_all(self, phot): """Subclasses may want to sort this """ df = pd.concat([self.to_df(f) for f in self.get_filenames(phot)]) return df
0, module; 1, function_definition; 2, function_name:searchsorted; 3, parameters; 4, block; 5, identifier:arr; 6, identifier:N; 7, identifier:x; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, while_statement; 14, return_statement; 15, c...
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; 13, 20; 13, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 21, 32; 21, 33; 21, 34; 26, 35; 26, 36; 30, 37; 30, 38; 32, 39; 32, 40; 32, 41; 32, 42; 33, 43; 3...
def searchsorted(arr, N, x): """N is length of arr """ L = 0 R = N-1 done = False m = (L+R)//2 while not done: if arr[m] < x: L = m + 1 elif arr[m] > x: R = m - 1 elif arr[m] == x: done = True m = (L+R)//2 if L>R: ...
0, module; 1, function_definition; 2, function_name:_plot_spectrogram; 3, parameters; 4, block; 5, identifier:G; 6, identifier:node_idx; 7, expression_statement; 8, import_from_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, express...
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; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 7, 29; 8, 30; 8, 31; 9, 32; 10, 33; 10, 34; 11, 35; 12, 36; 13, 37; 14, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 20, 44; 21, 45; 2...
def _plot_spectrogram(G, node_idx): r"""Plot the graph's spectrogram. Parameters ---------- node_idx : ndarray Order to sort the nodes in the spectrogram. By default, does not reorder the nodes. Notes ----- This function is only implemented for the pyqtgraph backend at the ...
0, module; 1, function_definition; 2, function_name:write_omega_scan_config; 3, parameters; 4, block; 5, identifier:channellist; 6, identifier:fobj; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, try_statement; 11, identifier:header; 12, True; 13, comment:"""Write a `ChannelList` to an Omega-pipeli...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 10, 18; 10, 19; 14, 20; 14, 21; 15, 22; 16, 23; 18, 24; 18, 25; 18, 26; 19, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 26, 38; 26, 39; 27, 40; 30, 41; 30, 42; 31, 43; 3...
def write_omega_scan_config(channellist, fobj, header=True): """Write a `ChannelList` to an Omega-pipeline scan configuration file This method is dumb and assumes the channels are sorted in the right order already """ if isinstance(fobj, FILE_LIKE): close = False else: fobj = op...
0, module; 1, function_definition; 2, function_name:coalesce; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, delete_statement; 12, return_statement; 13, comment:"""Merge contiguous elements of this...
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; 10, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 18, 31; 18, 32; 19, 33; 19, 34; 21, 35; 21, 36; 22, 37; 24, 38; 24, 39; 26, 40; 26, 41; 29, 42; 30, 43; 3...
def coalesce(self): """Merge contiguous elements of this list into single objects This method implicitly sorts and potentially shortens this list. """ self.sort(key=lambda ts: ts.t0.value) i = j = 0 N = len(self) while j < N: this = self[j] ...
0, module; 1, function_definition; 2, function_name:read_cache; 3, parameters; 4, block; 5, identifier:cachefile; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# open file; 11, if_statement; 12, comment:# read file; 13, expression_statement; 14, comment:# sieve a...
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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 11, 26; 11, 27; 13, 28; 15, 29; 15, 30; 16, 31; 16, 32; 18, 33; 26, 34; 27, 35; 28, 36; 28, 37; 30, 38; 32, 39; 34, 40; 34, 41; 35, 42; 35, 43; 37, 44; 37...
def read_cache(cachefile, coltype=LIGOTimeGPS, sort=None, segment=None): """Read a LAL- or FFL-format cache file as a list of file paths Parameters ---------- cachefile : `str`, `file` Input file or file path to read. coltype : `LIGOTimeGPS`, `int`, optional Type for GPS times. ...
0, module; 1, function_definition; 2, function_name:get_learned_skills; 3, parameters; 4, block; 5, identifier:self; 6, identifier:lang; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:""" Return the learned skill objects sorted by the order they were...
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; 10, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 20, 27; 20, 28; 21, 29; 23, 30; 23, 31; 28, 32; 28, 33; 29, 34; 29, 35; 31, 36; 31, 37; 33, 38; 33, 39; 35, 40; 36, 41; 36, 42; 37, 43...
def get_learned_skills(self, lang): """ Return the learned skill objects sorted by the order they were learned in. """ skills = [skill for skill in self.user_data.language_data[lang]['skills']] self._compute_dependency_order(skills) return [ski...
0, module; 1, function_definition; 2, function_name:combine_adjacent_lines; 3, parameters; 4, block; 5, identifier:line_numbers; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# Add a terminating value of `None` to list; 10, expression_statement; 11, expression_statement; 12, expr...
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; 8, 17; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 22, 36; 22, 37; 24, 38; 30, 39; 30, 40; 31, 41; 33, 42; 33, 43; 37...
def combine_adjacent_lines(line_numbers): """ Given a sorted collection of line numbers this will turn them to strings and combine adjacent values [1, 2, 5, 6, 100] -> ["1-2", "5-6", "100"] """ combine_template = "{0}-{1}" combined_list = [] # Add a term...
0, module; 1, function_definition; 2, function_name:sort_menus; 3, parameters; 4, block; 5, identifier:c; 6, expression_statement; 7, for_statement; 8, comment:""" sort_menus goes through the items and sorts them based on their weight """; 9, identifier:name; 10, attribute; 11, block; 12, identi...
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; 14, 15; 14, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 19, 23; 20, 24; 20, 25; 22, 26; 22, 27; 23, 28; 23, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 30, 35; 30, 36; 32, 37; 32, 38; 33, 39; 33, 40; 35, 41; 35, 42; 38, ...
def sort_menus(c): """ sort_menus goes through the items and sorts them based on their weight """ for name in c.items: if not c.sorted[name]: c.items[name].sort(key=lambda x: x.weight) c.sorted[name] = True
0, module; 1, function_definition; 2, function_name:_frequency_order_transform; 3, parameters; 4, block; 5, identifier:sets; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Transf...
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; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 3...
def _frequency_order_transform(sets): """Transform tokens to integers according to global frequency order. This step replaces all original tokens in the sets with integers, and helps to speed up subsequent prefix filtering and similarity computation. See Section 4.3.2 in the paper "A Primitive Operator ...
0, module; 1, function_definition; 2, function_name:to_numpy_vectors; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expressio...
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; 4, 19; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 11, 30; 12, 31; 13, 32; 14, 33; 15, 34; 16, 35; 17, 36; 18, 37; 18, 38; 18, 39; 19, 40; 19, 41; 19, 42; 20, 43; 24, 44; 24, 4...
def to_numpy_vectors(self, variable_order=None, dtype=np.float, index_dtype=np.int64, sort_indices=False): """Convert a binary quadratic model to numpy arrays. Args: variable_order (iterable, optional): If provided, labels the variables; otherwise, row/column indices are use...
0, module; 1, function_definition; 2, function_name:from_samples_bqm; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:samples_like; 7, identifier:bqm; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# more performant to do this once, here rather than again in bqm.energies; 11, comment:# and ...
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; 8, 15; 9, 16; 12, 17; 13, 18; 14, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 25, 34; 25, 35; 27, 36; 28, 37; 28, 38; 29, 39; 33, 40; 33, 41; 34, 42; 34, 43; 3...
def from_samples_bqm(cls, samples_like, bqm, **kwargs): """Build a SampleSet from raw samples using a BinaryQuadraticModel to get energies and vartype. Args: samples_like: A collection of raw samples. 'samples_like' is an extension of NumPy's array_like. See ...
0, module; 1, function_definition; 2, function_name:samples; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, identifier:n; 13, None; 14, identifier:sorted_by; 15, string; 16, comment:"""Return ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 15, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 21, 30; 22, 31; 22, 32; 26, 33; 29, 34; 30, 35; 30, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 36,...
def samples(self, n=None, sorted_by='energy'): """Return an iterable over the samples. Args: n (int, optional, default=None): Maximum number of samples to return in the view. sorted_by (str/None, optional, default='energy'): Selects the record fi...
0, module; 1, function_definition; 2, function_name:append_variables; 3, parameters; 4, block; 5, identifier:self; 6, identifier:samples_like; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# we don't handle multiple values; 12, if_statement; 13, comment:# ...
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; 7, 19; 7, 20; 8, 21; 9, 22; 10, 23; 12, 24; 12, 25; 12, 26; 12, 27; 12, 28; 14, 29; 15, 30; 15, 31; 16, 32; 17, 33; 18, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 26, 41; 27, 42; 27, 43; 28, 44;...
def append_variables(self, samples_like, sort_labels=True): """Create a new sampleset with the given variables with values added. Not defined for empty sample sets. Note that when `sample_like` is a :obj:`.SampleSet`, the data vectors and info are ignored. Args: samples_lik...
0, module; 1, function_definition; 2, function_name:slice; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, comment:# handle `sorted_by` kwarg with a default value in a python2-compatible way; 10, expression_statement; 11, if_statement; 12, com...
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; 7, 17; 8, 18; 10, 19; 11, 20; 11, 21; 11, 22; 13, 23; 13, 24; 13, 25; 14, 26; 14, 27; 14, 28; 15, 29; 19, 30; 19, 31; 22, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; 33,...
def slice(self, *slice_args, **kwargs): """Create a new SampleSet with rows sliced according to standard Python slicing syntax. Args: start (int, optional, default=None): Start index for `slice`. stop (int): Stop index for `slice`. ...
0, module; 1, function_definition; 2, function_name:describe_features; 3, parameters; 4, block; 5, identifier:self; 6, identifier:traj; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Generic method for describing features. Parameters ----...
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; 10, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 21, 26; 21, 27; 24, 28; 24, 29; 24, 30; 24, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43...
def describe_features(self, traj): """Generic method for describing features. Parameters ---------- traj : mdtraj.Trajectory Trajectory to use Returns ------- feature_descs : list of dict Dictionary describing each feature with the follow...
0, module; 1, function_definition; 2, function_name:_mapped_populations; 3, parameters; 4, block; 5, identifier:mdl1; 6, identifier:mdl2; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Method to get the populations for states in mdl 1 from populations i...
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; 14, 19; 14, 20; 15, 21; 18, 22; 18, 23; 20, 24; 21, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 24, 31; 24, 32; 26, 33; 26, 34; 26, 35; 27, 36; 30, 37; 30, 38; 33, 39; 34, 40; 35, 41; 36, 42; 39, 43; ...
def _mapped_populations(mdl1, mdl2): """ Method to get the populations for states in mdl 1 from populations inferred in mdl 2. Resorts to 0 if population is not present. """ return_vect = np.zeros(mdl1.n_states_) for i in range(mdl1.n_states_): try: #there has to be a bet...
0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:x; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:k; 14, integer:1; 15, identifier:p; 16, inte...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 11, 20; 12, 21; 18, 22; 18, 23; 20, 24; 20, 25; 21, 26; 21, 27; 24, 28; 24, 29; 25, 30; 25, 31; 27, 32; 27, 33; 30, 34; 30, 35; 31, 36; 31, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; 34,...
def query(self, x, k=1, p=2, distance_upper_bound=np.inf): """Query the kd-tree for nearest neighbors Parameters ---------- x : array_like, last dimension self.m An array of points to query. k : int, optional The number of nearest neighbors to return. ...
0, module; 1, function_definition; 2, function_name:sort_fn_list; 3, parameters; 4, block; 5, identifier:fn_list; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Sort input filename list by datetime """; 11, assignment; 12, assignment; 13, identifier:fn...
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; 17, 20; 17, 21; 19, 22; 21, 23; 21, 24; 23, 25; 23, 26; 24, 27; 24, 28; 28, 29; 29, 30; 29, 31; 31, 32; 31, 33
def sort_fn_list(fn_list): """Sort input filename list by datetime """ dt_list = get_dt_list(fn_list) fn_list_sort = [fn for (dt,fn) in sorted(zip(dt_list,fn_list))] return fn_list_sort
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:iterable; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:""" Given an IP address list, this function sorts the list. :type iterable: Iterator :param iterable: An IP address l...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 19, 24; 22, 25; 22, 26; 23, 27; 23, 28; 26, 29
def sort(iterable): """ Given an IP address list, this function sorts the list. :type iterable: Iterator :param iterable: An IP address list. :rtype: list :return: The sorted IP address list. """ ips = sorted(normalize_ip(ip) for ip in iterable) return [clean_ip(ip) for ip in ips]
0, module; 1, function_definition; 2, function_name:glob; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# Sort globbed files by tuple (filename, extension); 9, return_statement; 10, comment:"""Returns a sorted glob of files belonging to a given problem"""; 11,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 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; 23, 26; 23, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 27, 34; 27, 35; 28, 36; 29, 37; 29, 38; 32, 39; 33, 40; 33, 41; 34, 42; 35, 4...
def glob(self): """Returns a sorted glob of files belonging to a given problem""" file_glob = glob.glob(BASE_NAME.format('*', self.num, '*', '.*')) # Sort globbed files by tuple (filename, extension) return sorted(file_glob, key=lambda f: os.path.splitext(f))
0, module; 1, function_definition; 2, function_name:event; 3, parameters; 4, block; 5, identifier:self; 6, identifier:interface_id; 7, identifier:address; 8, identifier:value_key; 9, identifier:value; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statement; 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; 10, 15; 11, 16; 12, 17; 13, 18; 13, 19; 14, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 24, 35; 27, 36; 30, 37; 30, 38; 31, 39; 31, 40; 34, 41; 34, 42; 36, 43;...
def event(self, interface_id, address, value_key, value): """If a device emits some sort event, we will handle it here.""" LOG.debug("RPCFunctions.event: interface_id = %s, address = %s, value_key = %s, value = %s" % ( interface_id, address, value_key.upper(), str(value))) self.devic...
0, module; 1, function_definition; 2, function_name:get_isolated_cpus; 3, parameters; 4, block; 5, expression_statement; 6, comment:# The cpu/isolated sysfs was added in Linux 4.2; 7, comment:# (commit 59f30abe94bff50636c8cad45207a01fdcb2ee49); 8, expression_statement; 9, expression_statement; 10, if_statement; 11, 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; 5, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 12, 20; 12, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 18, 27; 19, 28; 19, 29; 21, 30; 21, 31; 24, 32; 24, 33; 26, 34; 26, 35; 27, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 33, 42; 35, 43; 3...
def get_isolated_cpus(): """Get the list of isolated CPUs. Return a sorted list of CPU identifiers, or return None if no CPU is isolated. """ # The cpu/isolated sysfs was added in Linux 4.2 # (commit 59f30abe94bff50636c8cad45207a01fdcb2ee49) path = sysfs_path('devices/system/cpu/isolated') ...
0, module; 1, function_definition; 2, function_name:framesToFrameRange; 3, parameters; 4, block; 5, identifier:frames; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, return_s...
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; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 13, 28; 13, 29; 14, 30; 14, 31; 15, 32; 24, 33; 25, 34; 25, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 31, 41; 32, 42; 32, 43; 33, 44;...
def framesToFrameRange(frames, sort=True, zfill=0, compress=False): """ Converts an iterator of frames into a frame range string. Args: frames (collections.Iterable): sequence of frames to process sort (bool): sort the sequence before processing zfill...
0, module; 1, function_definition; 2, function_name:_normalize_request_parameters; 3, parameters; 4, block; 5, identifier:self; 6, identifier:oauth_params; 7, identifier:req_kwargs; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, commen...
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; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 8, 26; 9, 27; 10, 28; 11, 29; 12, 30; 14, 31; 14, 32; 14, 33; 16, 34; 16, 35; 18, 36; 19, 37; 19, 38; 19, 39; 21, 40; 21, 41; 21, 42; 23, 43; 25, 44; 26, ...
def _normalize_request_parameters(self, oauth_params, req_kwargs): ''' This process normalizes the request parameters as detailed in the OAuth 1.0 spec. Additionally we apply a `Content-Type` header to the request of the `FORM_URLENCODE` type if the `Content-Type` was previously...
0, module; 1, function_definition; 2, function_name:do_summary; 3, parameters; 4, block; 5, identifier:self; 6, identifier:params; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# what slice do we want?; 11, if_statement; 12, expression_statement; 13, for_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; 11, 17; 11, 18; 11, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 19, 32; 19, 33; 20, 34; 21, 35; 21, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 2...
def do_summary(self, params): """ \x1b[1mNAME\x1b[0m summary - Prints summarized details of a path's children \x1b[1mSYNOPSIS\x1b[0m summary [path] [top] \x1b[1mDESCRIPTION\x1b[0m The results are sorted by name. \x1b[1mOPTIONS\x1b[0m * path: the path (default: cwd) * t...
0, module; 1, function_definition; 2, function_name:do_json_count_values; 3, parameters; 4, block; 5, identifier:self; 6, identifier:params; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, expression_statement; 11, for_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; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 8, 21; 8, 22; 9, 23; 10, 24; 11, 25; 11, 26; 11, 27; 12, 28; 13, 29; 15, 30; 15, 31; 15, 32; 15, 33; 16, 34; 16, 35; 17, 36; 17, 37; 17, 38; 19, 39; 19, 40; 21, 41; 22, 42; 22, 43; 23, 44; ...
def do_json_count_values(self, params): """ \x1b[1mNAME\x1b[0m json_count_values - Gets the frequency of the values associated with the given keys \x1b[1mSYNOPSIS\x1b[0m json_count_values <path> <keys> [top] [minfreq] [reverse] [report_errors] [print_path] \x1b[1mOPTIONS\x1b[0m * top: ...
0, module; 1, function_definition; 2, function_name:do_json_dupes_for_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:params; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, for_statement; 14, for_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; 9, 20; 10, 21; 11, 22; 11, 23; 11, 24; 12, 25; 13, 26; 13, 27; 13, 28; 14, 29; 14, 30; 14, 31; 16, 32; 16, 33; 18, 34; 19, 35; 19, 36; 20, 37; 20, 38; 21, 39; 21, 40; 22, 41; 22, 42; 23, 43; 23, 4...
def do_json_dupes_for_keys(self, params): """ \x1b[1mNAME\x1b[0m json_duples_for_keys - Gets the duplicate znodes for the given keys \x1b[1mSYNOPSIS\x1b[0m json_dupes_for_keys <path> <keys> [prefix] [report_errors] [first] \x1b[1mDESCRIPTION\x1b[0m Znodes with duplicated keys are sorte...
0, module; 1, function_definition; 2, function_name:add_property_orders; 3, parameters; 4, block; 5, identifier:query_proto; 6, list_splat_pattern; 7, expression_statement; 8, for_statement; 9, identifier:orders; 10, comment:"""Add ordering constraint for the given datastore.Query proto message. Args: query_prot...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 13, 14; 13, 15; 13, 16; 14, 17; 15, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 21, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 27, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 36, 43...
def add_property_orders(query_proto, *orders): """Add ordering constraint for the given datastore.Query proto message. Args: query_proto: datastore.Query proto message. orders: list of propertype name string, default to ascending order and set descending if prefixed by '-'. Usage: >>> add_proper...
0, module; 1, function_definition; 2, function_name:check_levels; 3, parameters; 4, block; 5, identifier:imls; 6, identifier:imt; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, identifier:min_iml; 11, float:1E-10; 12, comment:""" Raise a ValueError if the given levels are invalid. :param i...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 7, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 9, 16; 9, 17; 9, 18; 13, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 17, 28; 18, 29; 18, 30; 18, 31; 19, 32; 19, 33; 21, 34; 22, 35; 22, 36; 23, 37; 24, 38; 24, 39; 25, 40; 26, 41; 26, 42; 28, 43; 29,...
def check_levels(imls, imt, min_iml=1E-10): """ Raise a ValueError if the given levels are invalid. :param imls: a list of intensity measure and levels :param imt: the intensity measure type :param min_iml: minimum intensity measure level (default 1E-10) >>> check_levels([0.1, 0.2], 'PGA') # ...