sequence
stringlengths
546
16.2k
code
stringlengths
108
19.3k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:text_search; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 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, d...
def text_search(self, text, sort=None, offset=100, page=1): """ Search in aquarius using text query. Given the string aquarius will do a full-text query to search in all documents. Currently implemented are the MongoDB and Elastic Search drivers. For a detailed guide on how to...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:query_search; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, identifier:search_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:1...
def query_search(self, search_query, sort=None, offset=100, page=1): """ Search using a query. Currently implemented is the MongoDB query model to search for documents according to: https://docs.mongodb.com/manual/tutorial/query-documents/ And an Elastic Search driver, which im...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:trunk_angles; 3, parameters; 3, 4; 3, 5; 4, identifier:nrn; 5, default_parameter; 5, 6; 5, 7; 6, identifier:neurite_type; 7, attribute; 7, 8; 7, 9; 8, identifier:NeuriteType; 9, identifier:all; 10, block; 10, 11; 10, 13; 10, 23; 10, 24; 10, 32...
def trunk_angles(nrn, neurite_type=NeuriteType.all): '''Calculates the angles between all the trunks of the neuron. The angles are defined on the x-y plane and the trees are sorted from the y axis and anticlock-wise. ''' vectors = trunk_vectors(nrn, neurite_type=neurite_type) # In order to avoid...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:resolve_symbols; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:tree; 6, identifier:database; 7, identifier:link_resolver; 8, block; 8, 9; 8, 11; 8, 21; 8, 27; 8, 53; 8, 84; 8, 110; 8, 140; 8, 141; 8, 153; 8, 164; 9, e...
def resolve_symbols(self, tree, database, link_resolver): """ When this method is called, the page's symbol names are queried from `database`, and added to lists of actual symbols, sorted by symbol class. """ self.typed_symbols = self.__get_empty_typed_symbols() a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_klass_parents; 3, parameters; 3, 4; 4, identifier:gi_name; 5, block; 5, 6; 5, 8; 5, 12; 5, 21; 5, 27; 5, 35; 6, expression_statement; 6, 7; 7, string:''' Returns a sorted list of qualified symbols representing the parents of the kla...
def get_klass_parents(gi_name): ''' Returns a sorted list of qualified symbols representing the parents of the klass-like symbol named gi_name ''' res = [] parents = __HIERARCHY_GRAPH.predecessors(gi_name) if not parents: return [] __get_parent_link_recurse(parents[0], res) r...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sorted_groupby; 3, parameters; 3, 4; 3, 5; 4, identifier:df; 5, identifier:groupby; 6, block; 6, 7; 6, 9; 6, 13; 6, 23; 6, 59; 6, 60; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11,...
def sorted_groupby(df, groupby): """ Perform a groupby on a DataFrame using a specific column and assuming that that column is sorted. Parameters ---------- df : pandas.DataFrame groupby : object Column name on which to groupby. This column must be sorted. Returns ------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:add_note; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:note; 6, default_parameter; 6, 7; 6, 8; 7, identifier:octave; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:dynamics; 11, dictionary; 12, block; 1...
def add_note(self, note, octave=None, dynamics={}): """Add a note to the container and sorts the notes from low to high. The note can either be a string, in which case you could also use the octave and dynamics arguments, or a Note object. """ if type(note) == str: i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 1, 18; 2, function_name:_sort_row_col; 3, parameters; 3, 4; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:qubits; 6, type; 6, 7; 7, generic_type; 7, 8; 7, 9; 8, identifier:Iterator; 9, type_parameter; 9, 10; 10, type; 10, 11; 11, identifier:GridQubit; 12, type...
def _sort_row_col(qubits: Iterator[GridQubit]) -> List[GridQubit]: """Sort grid qubits first by row then by column""" return sorted(qubits, key=lambda x: (x.row, x.col))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_cmp_bystrlen_reverse; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, identifier:b; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 19; 9, 23; 9, 36; 10, comparison_operator:>; 10, 11; 10, 15; 11, cal...
def _cmp_bystrlen_reverse(a, b): """A private "cmp" function to be used by the "sort" function of a list when ordering the titles found in a knowledge base by string- length - LONGEST -> SHORTEST. @param a: (string) @param b: (string) @return: (integer) - 0 if len(a) == len(b); 1 ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prof_main; 3, parameters; 3, 4; 4, identifier:main; 5, block; 5, 6; 5, 8; 5, 181; 6, expression_statement; 6, 7; 7, comment; 8, decorated_definition; 8, 9; 8, 14; 9, decorator; 9, 10; 10, call; 10, 11; 10, 12; 11, identifier:wraps; 12, argument...
def prof_main(main): """ Decorator for profiling main programs. Profiling is activated by prepending the command line options supported by the original main program with the keyword `prof`. Example: $ script.py arg --foo=1 becomes $ script.py prof arg --foo=1 The decorat...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_least_constraining_values_sorter; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:problem; 5, identifier:assignment; 6, identifier:variable; 7, identifier:domains; 8, block; 8, 9; 8, 11; 8, 12; 8, 32; 8, 56; 9, expression_statement; 9, 10...
def _least_constraining_values_sorter(problem, assignment, variable, domains): ''' Sort values based on how many conflicts they generate if assigned. ''' # the value that generates less conflicts def update_assignment(value): new_assignment = deepcopy(assignment) new_assignment[varia...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:reading_order; 3, parameters; 3, 4; 3, 5; 4, identifier:e1; 5, identifier:e2; 6, block; 6, 7; 6, 9; 6, 15; 6, 21; 6, 60; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:b...
def reading_order(e1, e2): """ A comparator to sort bboxes from top to bottom, left to right """ b1 = e1.bbox b2 = e2.bbox if round(b1[y0]) == round(b2[y0]) or round(b1[y1]) == round(b2[y1]): return float_cmp(b1[x0], b2[x0]) return float_cmp(b1[y0], b2[y0])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:xy_reading_order; 3, parameters; 3, 4; 3, 5; 4, identifier:e1; 5, identifier:e2; 6, block; 6, 7; 6, 9; 6, 15; 6, 21; 6, 46; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifie...
def xy_reading_order(e1, e2): """ A comparator to sort bboxes from left to right, top to bottom """ b1 = e1.bbox b2 = e2.bbox if round(b1[x0]) == round(b2[x0]): return float_cmp(b1[y0], b2[y0]) return float_cmp(b1[x0], b2[x0])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:column_order; 3, parameters; 3, 4; 3, 5; 4, identifier:b1; 5, identifier:b2; 6, block; 6, 7; 6, 9; 6, 19; 6, 20; 6, 21; 6, 22; 6, 23; 6, 62; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, ...
def column_order(b1, b2): """ A comparator that sorts bboxes first by "columns", where a column is made up of all bboxes that overlap, then by vertical position in each column. b1 = [b1.type, b1.top, b1.left, b1.bottom, b1.right] b2 = [b2.type, b2.top, b2.left, b2.bottom, b2.right] """ (top...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:merge_intervals; 3, parameters; 3, 4; 3, 5; 4, identifier:elems; 5, default_parameter; 5, 6; 5, 7; 6, identifier:overlap_thres; 7, float:2.0; 8, block; 8, 9; 8, 11; 8, 19; 8, 34; 8, 38; 8, 46; 8, 101; 8, 108; 8, 109; 9, expression_statement; 9,...
def merge_intervals(elems, overlap_thres=2.0): """ Project in x axis Sort by start Go through segments and keep max x1 Return a list of non-overlapping intervals """ overlap_thres = max(0.0, overlap_thres) ordered = sorted(elems, key=lambda e: e.x0) intervals = [] cur = [-overl...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:predict; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:X; 6, default_parameter; 6, 7; 6, 8; 7, identifier:cost_mat; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 14; 9, 46; 9, 47; 10, expression_statement; 10, 11; 11, comment;...
def predict(self, X, cost_mat=None): """Predict class for X. The predicted class of an input sample is computed as the class with the highest mean predicted probability. If base estimators do not implement a ``predict_proba`` method, then it resorts to voting. Parameters ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:predict_proba; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:X; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 43; 6, 44; 6, 59; 6, 136; 6, 137; 6, 214; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, comment; 11, if_statement...
def predict_proba(self, X): """Predict class probabilities for X. The predicted class probabilities of an input sample is computed as the mean predicted class probabilities of the base estimators in the ensemble. If base estimators do not implement a ``predict_proba`` method, th...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:to_param_dict; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 58; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:param_dict; 11, dictionary; 12, fo...
def to_param_dict(self): """ Sorts to ensure Order is consistent for Testing """ param_dict = {} for index, dictionary in enumerate(self.value): for key, value in dictionary.items(): param_name = '{param_name}[{index}][{key}]'.format( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:datetimes; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:sel...
def datetimes(self): """A sorted list of datetimes in this analysis period.""" if self._timestamps_data is None: self._calculate_timestamps() return tuple(DateTime.from_moy(moy, self.is_leap_year) for moy in self._timestamps_data)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:hoys; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12...
def hoys(self): """A sorted list of hours of year in this analysis period.""" if self._timestamps_data is None: self._calculate_timestamps() return tuple(moy / 60.0 for moy in self._timestamps_data)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:hoys_int; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self...
def hoys_int(self): """A sorted list of hours of year in this analysis period as integers.""" if self._timestamps_data is None: self._calculate_timestamps() return tuple(int(moy / 60.0) for moy in self._timestamps_data)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:doys_int; 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, 13; 8, 26; 9, not_operator; 9, 10; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifier:...
def doys_int(self): """A sorted list of days of the year in this analysis period as integers.""" if not self._is_reversed: return self._calc_daystamps(self.st_time, self.end_time) else: doys_st = self._calc_daystamps(self.st_time, DateTime.from_hoy(8759)) doys...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:months_int; 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, 13; 8, 33; 9, not_operator; 9, 10; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifie...
def months_int(self): """A sorted list of months of the year in this analysis period as integers.""" if not self._is_reversed: return list(xrange(self.st_time.month, self.end_time.month + 1)) else: months_st = list(xrange(self.st_time.month, 13)) months_end = ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:sorted; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:field_name; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ascending; 7, True; 8, default_parameter; 8, 9; 8, 10; 9, identifier:fields; 10, None; 11, default_parameter; 11, 12; 11,...
def sorted(field_name, ascending=True, fields=None, count=5): """Provides a sampling strategy that picks from an ordered set of rows. Args: field_name: the name of the field to sort the rows by. ascending: whether to sort in ascending direction or not. fields: an optional list of field names ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_auto; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:method; 5, identifier:fields; 6, identifier:count; 7, identifier:percent; 8, identifier:key_field; 9, identifier:ascending; 10, block; 10, 11; 10, 13; 11, expression_state...
def _auto(method, fields, count, percent, key_field, ascending): """Construct a sampling function according to the provided sampling technique, provided all its needed fields are passed as arguments Args: method: one of the supported sampling methods: {limit,random,hashed,sorted} fields: an opt...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:pair_SAM_alignments; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:alignments; 5, default_parameter; 5, 6; 5, 7; 6, identifier:bundle; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:primary_only; 10, False; 11, block; 11, 12; 11, ...
def pair_SAM_alignments( alignments, bundle=False, primary_only=False): '''Iterate over SAM aligments, name-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap bundle (bool): if True, bundle all alignments from one read pair into a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:pair_SAM_alignments_with_buffer; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:alignments; 5, default_parameter; 5, 6; 5, 7; 6, identifier:max_buffer_size; 7, integer:30000000; 8, default_parameter; 8, 9; 8, 10; 9, identifier:primary_only; 10...
def pair_SAM_alignments_with_buffer( alignments, max_buffer_size=30000000, primary_only=False): '''Iterate over SAM aligments with buffer, position-sorted paired-end Args: alignments (iterator of SAM/BAM alignments): the alignments to wrap max_buffer_size (int): maxmal n...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:local_maxima; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:vector; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_distance; 7, integer:4; 8, default_parameter; 8, 9; 8, 10; 9, identifier:brd_mode; 10, string:"wrap"; 11, block; 11, 12; 1...
def local_maxima(vector,min_distance = 4, brd_mode = "wrap"): """ Internal finder for local maxima . Returns UNSORTED indices of maxima in input vector. """ fits = gaussian_filter(numpy.asarray(vector,dtype=numpy.float32),1., mode=brd_mode) for ii in range(len(fits)): if fits[ii] == fits...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:local_minima; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:vector; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_distance; 7, integer:4; 8, default_parameter; 8, 9; 8, 10; 9, identifier:brd_mode; 10, string:"wrap"; 11, block; 11, 12; 1...
def local_minima(vector,min_distance = 4, brd_mode = "wrap"): """ Internal finder for local minima . Returns UNSORTED indices of minima in input vector. """ fits = gaussian_filter(numpy.asarray(vector,dtype=numpy.float32),1., mode=brd_mode) for ii in range(len(fits)): if fits[ii] == fits...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:find_valley_range; 3, parameters; 3, 4; 3, 5; 4, identifier:vector; 5, default_parameter; 5, 6; 5, 7; 6, identifier:min_distance; 7, integer:4; 8, block; 8, 9; 8, 11; 8, 12; 8, 13; 8, 17; 8, 26; 8, 35; 8, 79; 8, 209; 9, expression_statement; 9,...
def find_valley_range(vector, min_distance = 4): """ Internal finder peaks and valley ranges. Returns UNSORTED indices of maxima in input vector. Returns range of valleys before and after maximum """ # http://users.monash.edu.au/~dengs/resource/papers/icme08.pdf # find min and max with ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_snps; 3, parameters; 3, 4; 4, identifier:snps; 5, block; 5, 6; 5, 8; 5, 24; 5, 25; 5, 44; 5, 63; 5, 64; 5, 65; 5, 86; 5, 87; 5, 98; 5, 99; 5, 112; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, ...
def sort_snps(snps): """ Sort SNPs based on ordered chromosome list and position. """ sorted_list = sorted(snps["chrom"].unique(), key=_natural_sort_key) # move PAR and MT to the end of the dataframe if "PAR" in sorted_list: sorted_list.remove("PAR") sorted_list.append("PAR") if "...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_genetic_map_HapMapII_GRCh37; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 30; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, comparison_operator:is; 9, 10; 9, 13; 10, attribute; 10, 11; 10, ...
def get_genetic_map_HapMapII_GRCh37(self): """ Get International HapMap Consortium HapMap Phase II genetic map for Build 37. Returns ------- dict dict of pandas.DataFrame HapMapII genetic maps if loading was successful, else None """ if self._genetic_map_HapM...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:seperate_symbols; 3, parameters; 3, 4; 4, identifier:func; 5, block; 5, 6; 5, 8; 5, 12; 5, 16; 5, 88; 5, 132; 5, 146; 5, 160; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:...
def seperate_symbols(func): """ Seperate the symbols in symbolic function func. Return them in alphabetical order. :param func: scipy symbolic function. :return: (vars, params), a tuple of all variables and parameters, each sorted in alphabetical order. :raises TypeError: only symfit V...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:name; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 29; 5, 52; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:base_str; 11, call; 11, 12; 11, 15; 12, att...
def name(self): """ Save name which can be used for alphabetic sorting and can be turned into a kwarg. """ base_str = 'd{}{}_'.format(self.derivative_count if self.derivative_count > 1 else '', self.expr) for var, count in self.variable_count: base_str += '...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_init_from_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:model_dict; 6, block; 6, 7; 6, 9; 6, 18; 6, 45; 6, 46; 6, 47; 6, 59; 6, 74; 6, 92; 6, 111; 6, 112; 6, 134; 6, 150; 6, 192; 6, 193; 7, expression_statement; 7, 8; 8, c...
def _init_from_dict(self, model_dict): """ Initiate self from a model_dict to make sure attributes such as vars, params are available. Creates lists of alphabetically sorted independent vars, dependent vars, sigma vars, and parameters. Finally it creates a signature for this model so it...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:function_dict; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 14; 5, 47; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:func_dict; 11, call; 11, 12; 11, 1...
def function_dict(self): """ Equivalent to ``self.model_dict``, but with all variables replaced by functions if applicable. Sorted by the evaluation order according to ``self.ordered_symbols``, not alphabetical like ``self.model_dict``! """ func_dict = OrderedDict() ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:flatten_; 3, parameters; 3, 4; 4, identifier:structure; 5, block; 5, 6; 5, 8; 5, 50; 5, 79; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 14; 9, call; 9, 10; 9, 11; 10, identifier:isinstance; 11, argument_list; 11, 12; 11...
def flatten_(structure): """Combine all leaves of a nested structure into a tuple. The nested structure can consist of any combination of tuples, lists, and dicts. Dictionary keys will be discarded but values will ordered by the sorting of the keys. Args: structure: Nested structure. Returns: Fla...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:set_python; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:value; 6, block; 6, 7; 6, 9; 6, 30; 6, 36; 6, 42; 6, 61; 6, 70; 6, 88; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 14; 10, not_operator; 10, 11; ...
def set_python(self, value): """Expect list of record instances, convert to a SortedDict for internal representation""" if not self.multiselect: if value and not isinstance(value, list): value = [value] value = value or [] records = SortedDict() for...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:get_filetypes; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:filelist; 5, default_parameter; 5, 6; 5, 7; 6, identifier:path; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:size; 10, attribute; 10, 11; 10, 14; 11, attribute; 11, 12;...
def get_filetypes(filelist, path=None, size=os.path.getsize): """ Get a sorted list of file types and their weight in percent from an iterable of file names. @return: List of weighted file extensions (no '.'), sorted in descending order @rtype: list of (weight, filetype) """ path = ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:validate_sort_fields; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 21; 5, 34; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:sort_fields; 11, call; 11, ...
def validate_sort_fields(self): """ Take care of sorting. """ sort_fields = ','.join(self.options.sort_fields) if sort_fields == '*': sort_fields = self.get_output_fields() return formatting.validate_sort_fields(sort_fields or config.sort_fields)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:validate_sort_fields; 3, parameters; 3, 4; 4, identifier:sort_fields; 5, block; 5, 6; 5, 8; 5, 9; 5, 15; 5, 47; 5, 48; 5, 58; 5, 84; 5, 85; 5, 100; 5, 101; 5, 175; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; ...
def validate_sort_fields(sort_fields): """ Make sure the fields in the given list exist, and return sorting key. If field names are prefixed with '-', sort order is reversed for that field (descending). """ # Allow descending order per field by prefixing with '-' descending = set() def sort...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:load_data_source; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 12; 3, 17; 4, identifier:local_path; 5, identifier:remote_source_list; 6, identifier:open_method; 7, default_parameter; 7, 8; 7, 9; 8, identifier:open_method_kwargs; 9, call; 9, 10; 9...
def load_data_source(local_path, remote_source_list, open_method, open_method_kwargs=dict(), remote_kwargs=dict(), verbose=True): '''Flexible data retreiver to download and cache the data files locally. Usage example (this makes a local...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:grouped_mean; 3, parameters; 3, 4; 3, 5; 4, identifier:arr; 5, identifier:spike_clusters; 6, block; 6, 7; 6, 9; 6, 18; 6, 27; 6, 33; 6, 44; 6, 51; 6, 59; 6, 68; 6, 78; 6, 90; 6, 91; 6, 102; 7, expression_statement; 7, 8; 8, comment; 9, expressi...
def grouped_mean(arr, spike_clusters): """Compute the mean of a spike-dependent quantity for every cluster. The two arguments should be 1D array with `n_spikes` elements. The output is a 1D array with `n_clusters` elements. The clusters are sorted in increasing order. """ arr = np.asarray(arr...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort_by; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort_dir; 8, string:'asc'; 9, block; 9, 10; 9, 12; 9, 22; 10, expression_statement; 10, 11; 11, comment; 12, expre...
def sort_by(self, name, sort_dir='asc'): """Sort by a given variable.""" logger.log(5, "Sort by `%s` %s.", name, sort_dir) self.eval_js('table.sortBy("{}", "{}");'.format(name, sort_dir))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:find_column; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:search; 6, default_parameter; 6, 7; 6, 8; 7, identifier:data_type; 8, None; 9, block; 9, 10; 9, 12; 9, 24; 9, 28; 9, 98; 10, expression_statement; 10, 11; 11, comme...
def find_column(self, search, data_type=None): """ Aggresively search through your database's schema for a column. Parameters ----------- search: str glob pattern for what you're looking for data_type: str, list (optional) specify which data type(s)...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:to_linear; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:index; 7, None; 8, block; 8, 9; 8, 11; 8, 67; 8, 80; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12; 11, 15; 12, co...
def to_linear(self, index=None): """ Transforms the StepColormap into a LinearColormap. Parameters ---------- index : list of floats, default None The values corresponding to each color in the output colormap. It has to be sorted. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:regex_opt_inner; 3, parameters; 3, 4; 3, 5; 4, identifier:strings; 5, identifier:open_paren; 6, block; 6, 7; 6, 9; 6, 17; 6, 18; 6, 25; 6, 31; 6, 49; 6, 71; 6, 157; 6, 164; 6, 201; 6, 202; 6, 216; 6, 223; 6, 268; 6, 269; 6, 270; 7, expression_s...
def regex_opt_inner(strings, open_paren): """Return a regex that matches any string in the sorted list of strings.""" close_paren = open_paren and ')' or '' # print strings, repr(open_paren) if not strings: # print '-> nothing left' return '' first = strings[0] if len(strings) ==...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_substitutions_from_config; 3, parameters; 3, 4; 4, identifier:config; 5, block; 5, 6; 5, 8; 5, 12; 5, 21; 5, 27; 5, 64; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:re...
def get_substitutions_from_config(config): """ Return a list of Substitution objects from the config, sorted alphabetically by pattern name. Returns an empty list if no Substitutions are specified. If there are problems parsing the values, a help message will be printed and an error will be thrown. ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:next_sibling; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 104; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 8, 48; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, identifier:parent; 12, blo...
def next_sibling(self): """ Returns the next sibling of the current node. The next sibling is searched in the parent node if we are not considering a top-level node. Otherwise it is searched inside the list of nodes (which should be sorted by tree ID) that is associated with the conside...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:previous_sibling; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 95; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 8, 43; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, identifier:parent; 12, ...
def previous_sibling(self): """ Returns the previous sibling of the current node. The previous sibling is searched in the parent node if we are not considering a top-level node. Otherwise it is searched inside the list of nodes (which should be sorted by tree ID) that is associated with...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:delay_or_run; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 20; 9, 28; 9, 69; 10, expression_statement; ...
def delay_or_run(self, *args, **kwargs): """ Attempt to call self.delay, or if that fails, call self.run. Returns a tuple, (result, required_fallback). ``result`` is the result of calling delay or run. ``required_fallback`` is True if the broker failed we had to resort to `self....
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:arrange; 3, parameters; 3, 4; 4, list_splat_pattern; 4, 5; 5, identifier:args; 6, block; 6, 7; 6, 9; 6, 19; 6, 58; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:names; ...
def arrange(*args): """Sort DataFrame by the input column arguments. >>> diamonds >> sample_n(5) >> arrange(X.price) >> select(X.depth, X.price) Out: depth price 28547 61.0 675 35132 59.1 889 42526 61.3 1323 3468 61.6 3392 23829 62.0 11903 """ names = [column._name f...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:filenames; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:directory; 5, default_parameter; 5, 6; 5, 7; 6, identifier:tag; 7, string:''; 8, default_parameter; 8, 9; 8, 10; 9, identifier:sorted; 10, False; 11, default_parameter; 11, 12; 1...
def filenames(directory, tag='', sorted=False, recursive=False): """ Reads in all filenames from a directory that contain a specified substring. Parameters ---------- directory : :obj:`str` the directory to read from tag : :obj:`str` optional tag to match in the filenames sorted...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_iterargs; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:item; 6, block; 6, 7; 6, 9; 6, 10; 6, 11; 6, 21; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, comment; 11, expression_statement; 11, 12; 12, assignment; 12...
def get_iterargs(self, item): """ Returns a tuple of all iterags for item, sorted by name.""" # iterargs should always be mandatory, unless there's a good reason # not to, which I can't think of right now. args = self._get_aggregate_args(item, 'mandatoryArgs') return tuple(sorted([arg for arg in ar...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:merge_dict; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, identifier:b; 6, block; 6, 7; 6, 9; 6, 19; 6, 26; 6, 108; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 16; 10, not_operator; 10, 11; 11, call; 11, 12; 11, 13; 1...
def merge_dict(a, b): """ Recursively merges and returns dict a with dict b. Any list values will be combined and returned sorted. :param a: dictionary object :param b: dictionary object :return: merged dictionary object """ if not isinstance(b, dict): return b result = de...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:posthoc_mannwhitney; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:a; 5, default_parameter; 5, 6; 5, 7; 6, identifier:val_col; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:group_col; 10, None; 11, defa...
def posthoc_mannwhitney(a, val_col=None, group_col=None, use_continuity=True, alternative='two-sided', p_adjust=None, sort=True): '''Pairwise comparisons with Mann-Whitney rank test. Parameters ---------- a : array_like or pandas DataFrame object An array, any object exposing the array interfa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:posthoc_wilcoxon; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:a; 5, default_parameter; 5, 6; 5, 7; 6, identifier:val_col; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:group_col; 10, None; 11, default...
def posthoc_wilcoxon(a, val_col=None, group_col=None, zero_method='wilcox', correction=False, p_adjust=None, sort=False): '''Pairwise comparisons with Wilcoxon signed-rank test. It is a non-parametric version of the paired T-test for use with non-parametric ANOVA. Parameters ---------- a : array_l...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 28; 2, function_name:calendarplot; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:data; 5, default_parameter; 5, 6; 5, 7; 6, identifier:how; 7, string:'sum'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:yearlabels; 10,...
def calendarplot(data, how='sum', yearlabels=True, yearascending=True, yearlabel_kws=None, subplot_kws=None, gridspec_kws=None, fig_kws=None, **kwargs): """ Plot a timeseries as a calendar heatmap. Parameters ---------- data : Series Data for the plot. Must be indexed by a ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:tasks; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:pattern; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:negate; 10, False; 11, def...
def tasks(self, pattern=None, negate=False, state=None, limit=None, reverse=True, params=None, success=False, error=True): """Filters stored tasks and displays their current statuses. Note that, to be able to list the tasks sorted chronologically, celery retrieves tasks from the L...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:echo_headers; 3, parameters; 3, 4; 3, 5; 4, identifier:headers; 5, default_parameter; 5, 6; 5, 7; 6, identifier:file; 7, None; 8, block; 8, 9; 8, 11; 8, 44; 9, expression_statement; 9, 10; 10, comment; 11, for_statement; 11, 12; 11, 15; 11, 23;...
def echo_headers(headers, file=None): """Echo headers, sorted.""" for k, v in sorted(headers.items()): click.echo("{0}: {1}".format(k.title(), v), file=file) click.echo(file=file)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:by_own_time_per_call; 3, parameters; 3, 4; 4, identifier:stat; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, tuple; 9, 10; 9, 22; 10, conditional_expression:if; 10, 11; 10, 15; 10, 18; 11, unary_...
def by_own_time_per_call(stat): """Sorting by exclusive elapsed time per call in descending order.""" return (-stat.own_time_per_call if stat.own_hits else -stat.own_time, by_deep_time_per_call(stat))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:missing_labels; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 6, expression_statement; 6, 7; 7, comment; 8, return_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:np; 12, identifier:array; ...
def missing_labels(self): """ A 1D `~numpy.ndarray` of the sorted non-zero labels that are missing in the consecutive sequence from zero to the maximum label number. """ return np.array(sorted(set(range(0, self.max_label + 1)). difference(n...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 47; 1, 48; 1, 49; 1, 50; 1, 51; 2, function_name:fit_image; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 3, 41; 3, 44; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sma0; 7, None; 8, d...
def fit_image(self, sma0=None, minsma=0., maxsma=None, step=0.1, conver=DEFAULT_CONVERGENCE, minit=DEFAULT_MINIT, maxit=DEFAULT_MAXIT, fflag=DEFAULT_FFLAG, maxgerr=DEFAULT_MAXGERR, sclip=3., nclip=0, integrmode=BILINEAR, linear=False, maxrit=None):...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:values; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, for_statement; 9, 10; 9, 11; 9, 12; 10, identifier:level; 11, identifier:self; 12, block; 12, 13; 13,...
def sort(self, values): """Sort the values in-place based on the connectors in the network.""" for level in self: for wire1, wire2 in level: if values[wire1] > values[wire2]: values[wire1], values[wire2] = values[wire2], values[wire1]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:getWorkersName; 3, parameters; 3, 4; 4, identifier:data; 5, block; 5, 6; 5, 8; 5, 20; 5, 26; 5, 39; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:names; 11, list_comprehens...
def getWorkersName(data): """Returns the list of the names of the workers sorted alphabetically""" names = [fichier for fichier in data.keys()] names.sort() try: names.remove("broker") except ValueError: pass return names
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 1, 32; 2, function_name:parse_commit_message; 3, parameters; 3, 4; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:message; 6, type; 6, 7; 7, identifier:str; 8, type; 8, 9; 9, generic_type; 9, 10; 9, 11; 10, identifier:Tuple; 11, type_parameter; 11, 12; 11, 14; 1...
def parse_commit_message(message: str) -> Tuple[int, str, Optional[str], Tuple[str, str, str]]: """ Parses a commit message according to the 1.0 version of python-semantic-release. It expects a tag of some sort in the commit message and will use the rest of the first line as changelog content. :par...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:todos; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 25; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:result; 11, call; 11, 12; 11, 17; 12, attribute; ...
def todos(self): """ Returns a sorted and filtered list of todos in this view. """ result = self._sorter.sort(self.todolist.todos()) return self._apply_filters(result)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:group; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:p_todos; 6, block; 6, 7; 6, 9; 6, 10; 6, 20; 6, 21; 6, 31; 6, 135; 6, 136; 6, 157; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, expression_statement; 10, 11; 11, ...
def group(self, p_todos): """ Groups the todos according to the given group string. """ # preorder todos for the group sort p_todos = _apply_sort_functions(p_todos, self.pregroupfunctions) # initialize result with a single group result = OrderedDict([((), p_todos...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:process_other_set; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, identifier:hdf5_file; 5, identifier:which_set; 6, identifier:image_archive; 7, identifier:patch_archive; 8, identifier:groundtruth; 9, identifier:offset; 10, block; 10, 1...
def process_other_set(hdf5_file, which_set, image_archive, patch_archive, groundtruth, offset): """Process the validation or test set. Parameters ---------- hdf5_file : :class:`h5py.File` instance HDF5 file handle to which to write. Assumes `features`, `targets` an...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sorted_fancy_indexing; 3, parameters; 3, 4; 3, 5; 4, identifier:indexable; 5, identifier:request; 6, block; 6, 7; 6, 9; 6, 78; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 16; 9, 70; 10, comparison_operator:>; 10, 11; 1...
def sorted_fancy_indexing(indexable, request): """Safe fancy indexing. Some objects, such as h5py datasets, only support list indexing if the list is sorted. This static method adds support for unsorted list indexing by sorting the requested indices, accessing the corresponding...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:index_within_subset; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:indexable; 6, identifier:subset_request; 7, default_parameter; 7, 8; 7, 9; 8, identifier:sort_indices; 9, False; 10, block; 10, 11; 10, 13; 10, 14; 1...
def index_within_subset(self, indexable, subset_request, sort_indices=False): """Index an indexable object within the context of this subset. Parameters ---------- indexable : indexable object The object to index through. subset_request : ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 2, function_name:degree_circle; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 15; 3, 18; 3, 21; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:EdgeAttribute; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:network; 10, None; ...
def degree_circle(self,EdgeAttribute=None,network=None,NodeAttribute=None,\ nodeList=None,singlePartition=None,verbose=None): """ Execute the Degree Sorted Circle Layout on a network. :param EdgeAttribute (string, optional): The name of the edge column contai ning numeric values that will be used as weights...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 66; 2, function_name:import_url; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 9; 3, 12; 3, 15; 3, 16; 3, 19; 3, 22; 3, 23; 3, 26; 3, 29; 3, 32; 3, 33; 3, 36; 3, 39; 3, 40; 3, 43; 3, 46; 3, 49; 3, 50; 3, 53; 3, 56; 3, 59; 3, 60; 3, 63; 4, identifier:self; 5, default_paramet...
def import_url(self,caseSensitiveNetworkCollectionKeys=None,\ caseSensitiveNetworkKeys=None,dataTypeList=None,\ DataTypeTargetForNetworkCollection=None,DataTypeTargetForNetworkList=None,\ delimiters=None,delimitersForDataList=None,firstRowAsColumnNames=None,\ KeyColumnForMapping=None,Key...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 35; 2, function_name:fromtif; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ext; 7, string:'tif'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start;...
def fromtif(path, ext='tif', start=None, stop=None, recursive=False, nplanes=None, npartitions=None, labels=None, engine=None, credentials=None, discard_extra=False): """ Loads images from single or multi-page TIF files. Parameters ---------- path : str Path to data files or directory, spec...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:frompng; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ext; 7, string:'png'; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, None; 11,...
def frompng(path, ext='png', start=None, stop=None, recursive=False, npartitions=None, labels=None, engine=None, credentials=None): """ Load images from PNG files. Parameters ---------- path : str Path to data files or directory, specified as either a local filesystem path or in a U...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:list; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ext; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, None; 11, default_parameter; 11, 12; 11, 13; 12,...
def list(path, ext=None, start=None, stop=None, recursive=False): """ Get sorted list of file paths matching path and extension """ files = listflat(path, ext) if not recursive else listrecursive(path, ext) if len(files) < 1: raise FileNotFoundError('Cannot find files...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:list; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:filename; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, None; 11, default_parameter; 11, 12;...
def list(path, filename=None, start=None, stop=None, recursive=False, directories=False): """ List files specified by dataPath. Datapath may include a single wildcard ('*') in the filename specifier. Returns sorted list of absolute path strings. """ path = uri_to_path(p...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:list; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:filename; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:start; 11, None; 12...
def list(self, path, filename=None, start=None, stop=None, recursive=False, directories=False): """ List objects specified by path. Returns sorted list of 'gs://' or 's3n://' URIs. """ storageScheme, keys = self.getkeys( path, filename=filename, directories=directori...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:validate_v3_svc_catalog_endpoint_data; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:expected; 6, identifier:actual; 7, block; 7, 8; 7, 10; 7, 19; 7, 36; 7, 169; 8, expression_statement; 8, 9; 9, comment; 10, expression_sta...
def validate_v3_svc_catalog_endpoint_data(self, expected, actual): """Validate the keystone v3 catalog endpoint data. Validate a list of dictinaries that make up the keystone v3 service catalogue. It is in the form of: {u'identity': [{u'id': u'48346b01c6804b298cdd7349aadb732e...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:ordered; 3, parameters; 3, 4; 4, identifier:orderme; 5, block; 5, 6; 5, 8; 5, 21; 5, 27; 5, 73; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 15; 9, not_operator; 9, 10; 10, call; 10, 11; 10, 12; 11, identifier:isinstance...
def ordered(orderme): """Converts the provided dictionary into a collections.OrderedDict. The items in the returned OrderedDict will be inserted based on the natural sort order of the keys. Nested dictionaries will also be sorted in order to ensure fully predictable ordering. :param orderme: the d...
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:q; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identifier:num; 11, integer:10; 12, ...
def search(self, q, start=1, num=10, sortField="username", sortOrder="asc"): """ The User Search operation searches for users in the portal. The search index is updated whenever users are created, updated, or ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 55; 2, function_name:exportImage; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 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:self; 5, identifier:bbox; 6, identifier:imageSR; 7, identifier:bboxSR; 8,...
def exportImage(self, bbox, imageSR, bboxSR, size=[400,400], time=None, format="jpgpng", pixelType="UNKNOWN", noData=None, noDataInterpretat...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:measure; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, identifier:fromGeometry; 6, identifier:toGeometry; 7, identifier:measureOperation; 8, default_parameter; 8, 9; 8, 10; 9, identifier...
def measure(self,fromGeometry,toGeometry,measureOperation, geometryType="esriGeometryPoint",pixelSize=None,mosaicRule=None, linearUnit=None,angularUnit=None,areaUnit=None): """ The measure operation is performed on an image service resource. It lets a user measure...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:computeStatisticsHistograms; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 4, identifier:self; 5, identifier:geometry; 6, identifier:geometryType; 7, default_parameter; 7, 8; 7, 9; 8, identifier:mosaicRule; 9, None; 10, default_paramete...
def computeStatisticsHistograms(self,geometry,geometryType,mosaicRule=None, renderingRule=None,pixelSize=None): """ The computeStatisticsHistograms operation is performed on an image service resource. This operation is supported by any image service published ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:users; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:start; 7, integer:1; 8, default_parameter; 8, 9; 8, 10; 9, identifier:num; 10, integer:10; 11, default_parameter; ...
def users(self, start=1, num=10, sortField="fullName", sortOrder="asc", role=None): """ Lists all the members of the organization. The start and num paging parameters are supported. Inputs: start - The numb...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 36; 2, function_name:find; 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; 4, identifier:self; 5, identifier:text; 6, default_parameter; 6, 7; 6, 8; 7, identifier:magicKey; 8, None; 9, default_parameter; 9, 10; 9, 11;...
def find(self, text, magicKey=None, sourceCountry=None, bbox=None, location=None, distance=3218.69, outSR=102100, category=None, outFields="*", maxLocations=20, forStorage=False...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:search; 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:q; 6, default_parameter; 6, 7; 6, 8; 7, identifier:t; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:focus;...
def search(self, q, t=None, focus=None, bbox=None, start=1, num=10, sortField=None, sortOrder="asc", useSecurity=True): """ This operation searches for content items in the porta...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_models; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 32; 5, 40; 5, 47; 5, 51; 5, 55; 5, 141; 5, 150; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier...
def sort_models(self): """Sorts the database models appropriately based on their relationships so that we load our data in the appropriate order. Returns: A sorted list containing the names of the models. """ model_names = [ table.name for table in self.B...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:keyed_helper; 3, parameters; 3, 4; 4, identifier:helper; 5, block; 5, 6; 5, 8; 5, 139; 5, 145; 6, expression_statement; 6, 7; 7, comment; 8, decorated_definition; 8, 9; 8, 14; 9, decorator; 9, 10; 10, call; 10, 11; 10, 12; 11, identifier:wraps;...
def keyed_helper(helper): """ Decorator for helper functions that operate on direct values instead of model instances. A keyed helper is one that can be used normally in the view's own custom callbacks, but also supports direct access in the column declaration, such as in the example: datatabl...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:find_bin; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:x; 6, block; 6, 7; 6, 9; 6, 22; 6, 37; 6, 71; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:x; 12...
def find_bin(self, x): """ Sort input or inputs according to the current bin estimate Parameters ---------- x : array or numeric a value or array of values to fit within the estimated bins Returns ------- a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 24; 1, 30; 2, function_name:filter_by_size; 3, parameters; 3, 4; 3, 8; 3, 16; 3, 20; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:feat_dir; 6, type; 6, 7; 7, identifier:Path; 8, typed_parameter; 8, 9; 8, 10; 9, identifier:prefixes; 10, type; 10, 11; 11, generic_t...
def filter_by_size(feat_dir: Path, prefixes: List[str], feat_type: str, max_samples: int) -> List[str]: """ Sorts the files by their length and returns those with less than or equal to max_samples length. Returns the filename prefixes of those files. The main job of the method is to filte...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 1, 34; 2, function_name:sort_annotations; 3, parameters; 3, 4; 4, typed_parameter; 4, 5; 4, 6; 5, identifier:annotations; 6, type; 6, 7; 7, generic_type; 7, 8; 7, 9; 8, identifier:List; 9, type_parameter; 9, 10; 10, type; 10, 11; 11, generic_type; 11, 12; 11, ...
def sort_annotations(annotations: List[Tuple[int, int, str]] ) -> List[Tuple[int, int, str]]: """ Sorts the annotations by their start_time. """ return sorted(annotations, key=lambda x: x[0])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:default_sort_key; 3, parameters; 3, 4; 3, 5; 4, identifier:item; 5, default_parameter; 5, 6; 5, 7; 6, identifier:order; 7, None; 8, block; 8, 9; 8, 11; 8, 19; 8, 28; 8, 35; 8, 51; 8, 204; 9, expression_statement; 9, 10; 10, comment; 11, import_...
def default_sort_key(item, order=None): """Return a key that can be used for sorting. The key has the structure: (class_key, (len(args), args), exponent.sort_key(), coefficient) This key is supplied by the sort_key routine of Basic objects when ``item`` is a Basic object or an object (other than ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:uintersect1d; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:arr1; 5, identifier:arr2; 6, default_parameter; 6, 7; 6, 8; 7, identifier:assume_unique; 8, False; 9, block; 9, 10; 9, 12; 9, 25; 9, 35; 10, expression_statement; 10, 11; 11, comment;...
def uintersect1d(arr1, arr2, assume_unique=False): """Find the sorted unique elements of the two input arrays. A wrapper around numpy.intersect1d that preserves units. All input arrays must have the same units. See the documentation of numpy.intersect1d for full details. Examples -------- ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:argsort; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 12; 4, identifier:self; 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:kind; 11, string:"quicksort"...
def argsort(self, axis=-1, kind="quicksort", order=None): """ Returns the indices that would sort the array. See the documentation of ndarray.argsort for details about the keyword arguments. Example ------- >>> from unyt import km >>> data = [3, 8, 7]*km...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:serve; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:info; 5, identifier:host; 6, identifier:port; 7, identifier:reload; 8, identifier:debugger; 9, identifier:eager_loading; 10, identifier:with_threads; 11, block; 11,...
def serve(info, host, port, reload, debugger, eager_loading, with_threads): ''' Runs a local udata development server. This local server is recommended for development purposes only but it can also be used for simple intranet deployments. By default it will not support any sort of concurrency at a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:get_enabled_plugins; 3, parameters; 4, block; 4, 5; 4, 7; 4, 21; 4, 35; 4, 67; 5, expression_statement; 5, 6; 6, string:''' Returns enabled preview plugins. Plugins are sorted, defaults come last '''; 7, expression_statement; 7, 8;...
def get_enabled_plugins(): ''' Returns enabled preview plugins. Plugins are sorted, defaults come last ''' plugins = entrypoints.get_enabled('udata.preview', current_app).values() valid = [p for p in plugins if issubclass(p, PreviewPlugin)] for plugin in plugins: if plugin not in va...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:extract_sort; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:params; 6, block; 6, 7; 6, 9; 6, 19; 6, 31; 6, 55; 7, expression_statement; 7, 8; 8, string:'''Extract and build sort query from parameters'''; 9, expression_statement; ...
def extract_sort(self, params): '''Extract and build sort query from parameters''' sorts = params.pop('sort', []) sorts = [sorts] if isinstance(sorts, basestring) else sorts sorts = [(s[1:], 'desc') if s.startswith('-') else (s, 'asc') for s in sorts] ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:ancestors_objects; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 12; 5, 46; 5, 60; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:ancestors_objects; 11, ...
def ancestors_objects(self): """Ancestors objects sorted by name.""" ancestors_objects = [] for ancestor in self.ancestors: try: ancestor_object = GeoZone.objects.get(id=ancestor) except GeoZone.DoesNotExist: continue ancestors_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:check_for_territories; 3, parameters; 3, 4; 4, identifier:query; 5, block; 5, 6; 5, 8; 5, 24; 5, 32; 5, 40; 5, 48; 5, 55; 5, 219; 5, 226; 5, 227; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 21; 9, boolean_operator:or; 9...
def check_for_territories(query): """ Return a geozone queryset of territories given the `query`. Results are sorted by population and area (biggest first). """ if not query or not current_app.config.get('ACTIVATE_TERRITORIES'): return [] dbqs = db.Q() query = query.lower() is_...