nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:intersect_range_array; 3, parameters; 4, block; 5, identifier:bed1; 6, identifier:beds2; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, for_statement; 13, if_statement; 14, return_statement; 15, ide...
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; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 20, 29; 21, 30; 22, 31; 22, 32; 25, 33; 25, 34; 25, 35; 27, 36; 28, 37; 28, 38; 30, 39; 33, 40; 35, 41; 35, 42; 35, 43; 35, ...
def intersect_range_array(bed1,beds2,payload=None,is_sorted=False): """ Does not do a merge if the payload has been set :param bed1: :param bed2: :param payload: payload=1 return the payload of bed1 on each of the intersect set, payload=2 return the payload of bed2 on each of the union set, payload=3 return th...
0, module; 1, function_definition; 2, function_name:sort_genomic_ranges; 3, parameters; 4, block; 5, identifier:rngs; 6, expression_statement; 7, return_statement; 8, comment:"""sort multiple ranges"""; 9, call; 10, identifier:sorted; 11, argument_list; 12, identifier:rngs; 13, keyword_argument; 14, identifier:key; 15,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 17, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27
def sort_genomic_ranges(rngs): """sort multiple ranges""" return sorted(rngs, key=lambda x: (x.chr, x.start, x.end))
0, module; 1, function_definition; 2, function_name:topological_sort; 3, parameters; 4, block; 5, identifier:dependencies; 6, identifier:start_nodes; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, function_definition; 11, function_definition; 12, while_statement; 13, 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; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 14, 30; 14, 31; 16, 32; 16, 33; 18, 34; 19, 35; 21, 36; 22, 37; 24, 38; 25, 39; 27, 40; 27, 41; 27, 42; 28, 43; 28, ...
def topological_sort(dependencies, start_nodes): """ Perform a topological sort on the dependency graph `dependencies`, starting from list `start_nodes`. """ retval = [] def edges(node): return dependencies[node][1] def in_degree(node): return dependencies[node][0] def remove_incoming(no...
0, module; 1, function_definition; 2, function_name:_do_parse; 3, parameters; 4, block; 5, identifier:inp; 6, identifier:fmt; 7, identifier:encoding; 8, identifier:force_types; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# make sure it's all unicode and all...
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; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 12, 23; 12, 24; 12, 25; 12, 26; 12, 27; 16, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25...
def _do_parse(inp, fmt, encoding, force_types): """Actually parse input. Args: inp: bytes yielding file-like object fmt: format to use for parsing encoding: encoding of `inp` force_types: if `True`, integers, floats, booleans and none/null are recogni...
0, module; 1, function_definition; 2, function_name:_do_serialize; 3, parameters; 4, block; 5, identifier:struct; 6, identifier:fmt; 7, identifier:encoding; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""Actually serialize input. A...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 11, 18; 11, 19; 11, 20; 11, 21; 11, 22; 12, 23; 14, 24; 14, 25; 15, 26; 15, 27; 16, 28; 16, 29; 17, 30; 17, 31; 17, 32; 18, 33; 18, 34; 18, 35; 18, 36; 18, 37; 19, 38; 19, 39; 20, 40; 20, 41; 20, 42; 21, 43;...
def _do_serialize(struct, fmt, encoding): """Actually serialize input. Args: struct: structure to serialize to fmt: format to serialize to encoding: encoding to use while serializing Returns: encoded serialized structure Raises: various sorts of errors raised by ...
0, module; 1, function_definition; 2, function_name:sort_header; 3, parameters; 4, block; 5, identifier:header_text; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:"""so...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 16, 28; 16, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 24, 36; 27, 37; 27, 38; 30, 39; 31, 40; 31, 41; 36, 42; 36, 43; 36, ...
def sort_header(header_text): """sort the chromosomes in a header text""" lines = header_text.rstrip().split("\n") rlens = {} for ln in lines: m = re.match('@SQ\tSN:(\S+)\tLN:(\S+)',ln) if m: rlens[m.group(1)] = m.group(2) output = '' done_lens = False for ln in lines: if re.match('@SQ\t...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, identifier:direction; 13, string:"asc"; 14, comment:""" Adds sort criteria. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 10, 18; 11, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 23, 30; 23, 31; 24, 32; 25, 33; 25, 34; 26, 35; 28, 36; 28, 37; 29, 38; 29, 39; 32, 40; 32, 41; 33, 42; 33, 43; 3...
def sort(self, field, direction="asc"): """ Adds sort criteria. """ if not isinstance(field, basestring): raise ValueError("Field should be a string") if direction not in ["asc", "desc"]: raise ValueError("Sort direction should be `asc` or `desc`") ...
0, module; 1, function_definition; 2, function_name:remove_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field_name; 7, expression_statement; 8, expression_statement; 9, comment:""" Clears sorting criteria affecting ``field_name``. """; 10, assignment; 11, attribute; 12, list_comprehe...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 12, 16; 12, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31
def remove_sort(self, field_name): """ Clears sorting criteria affecting ``field_name``. """ self.sorts = [dict(field=value) for field, value in self.sorts if field is not field_name]
0, module; 1, function_definition; 2, function_name:aggregate_registry_timers; 3, parameters; 4, block; 5, expression_statement; 6, import_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Returns a list of aggregate timing info...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 5, 12; 6, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 11, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 18, 32; 18, 33; 18, 34; 18, 35; 19, 36; 19, 37; 20, 38; 20, 39; 23, 40; 23, 41; 28, 42; 28, 43; 29,...
def aggregate_registry_timers(): """Returns a list of aggregate timing information for registered timers. Each element is a 3-tuple of - timer description - aggregate elapsed time - number of calls The list is sorted by the first start time of each aggregate timer. """ im...
0, module; 1, function_definition; 2, function_name:spread; 3, parameters; 4, block; 5, identifier:iterable; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Returns the maximal spread of a sorted list of numbers. ...
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; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 21, 30; 23, 31; 23, 32; 24, 33; 24, 34; 27, 35; 27, 36; 29, 37; 31, 38; 31, 39; 36, 40; 36, 41; 40, 42; 40, 43; 4...
def spread(iterable): """Returns the maximal spread of a sorted list of numbers. Parameters ---------- iterable A list of numbers. Returns ------- max_diff The maximal difference when the iterable is sorted. Examples ------- >>> spread([1, 11, 13, 15]) 10 ...
0, module; 1, function_definition; 2, function_name:sort_transcripts; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:"""Sort the transcripts stored here"""; 10, assignment; 11, assignment; 12, identifier:txs; 13, call; 14, attribute; 15...
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; 17, 20; 17, 21; 20, 22; 20, 23; 21, 24; 21, 25; 25, 26; 25, 27; 26, 28; 27, 29; 27, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 34, 40; 34, 41; 36, 42; 36, ...
def sort_transcripts(self): """Sort the transcripts stored here""" txs = sorted(self.transcripts,key=lambda x: (x.range.chr, x.range.start, x.range.end)) self._transcripts = txs
0, module; 1, function_definition; 2, function_name:in1d_events; 3, parameters; 4, block; 5, identifier:ar1; 6, identifier:ar2; 7, expression_statement; 8, expression_statement; 9, comment:# change memory alignement for c++ library; 10, expression_statement; 11, comment:# change memory alignement for c++ library; 12, e...
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; 7, 15; 8, 16; 10, 17; 12, 18; 14, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; 3...
def in1d_events(ar1, ar2): """ Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted and the c++ library. Is therefore much much faster. """ ar1 = np.ascontiguousarray(ar1) # change memory alignement for c++ library ar2 = np.ascontiguousarray(ar2) # change memory alignement for...
0, module; 1, function_definition; 2, function_name:sort_by_priority; 3, parameters; 4, block; 5, identifier:iterable; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:reverse; 11, False; 12, identifier:default_priority; 13, integer:10; 14, comment:""" Return ...
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; 17, 18; 17, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24; 24, 25; 24, 26; 25, 27; 26, 28; 26, 29; 29, 30; 29, 31; 29, 32; 31, 33
def sort_by_priority(iterable, reverse=False, default_priority=10): """ Return a list or objects sorted by a priority value. """ return sorted(iterable, reverse=reverse, key=lambda o: getattr(o, 'priority', default_priority))
0, module; 1, function_definition; 2, function_name:apply; 3, parameters; 4, block; 5, identifier:self; 6, identifier:func; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, identifier:mapping; 13, None; 14, identifier:new_dtype; 15, None; 16, ident...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 11, 21; 18, 22; 18, 23; 19, 24; 20, 25; 20, 26; 21, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 26, 34; 26, 35; 26, 36; 26, 37; 27, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; 3...
def apply(self, func, mapping=None, new_dtype=None, **kwargs): """Apply an element-wise UDF to the Series. There are currently 6 options for using a UDF. First 4 are lazy, other 2 are eager and require the use of the raw decorator: - One of the predefined functions in baloo.functions. ...
0, module; 1, function_definition; 2, function_name:weld_sort; 3, parameters; 4, block; 5, identifier:arrays; 6, identifier:weld_types; 7, identifier:readable_text; 8, default_parameter; 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; 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; 8, 20; 8, 21; 9, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 17, 30; 18, 31; 19, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44;...
def weld_sort(arrays, weld_types, readable_text, ascending=True): """Sort the arrays. Parameters ---------- arrays : list of (numpy.ndarray or WeldObject) Arrays to put in a struct. weld_types : list of WeldType The Weld types of the arrays in the same order. readable_text : str...
0, module; 1, function_definition; 2, function_name:chooseBestDuplicates; 3, parameters; 4, block; 5, identifier:tped; 6, identifier:samples; 7, identifier:oldSamples; 8, identifier:completion; 9, identifier:concordance_all; 10, identifier:prefix; 11, expression_statement; 12, comment:# The output files; 13, expression...
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; 11, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 17, 34; 17, 35; 18, 36; 18, 37; 20, 38; 21, 39; 22, 40; 22, 41; 22, 42; 22, 43; 24, 44; 25,...
def chooseBestDuplicates(tped, samples, oldSamples, completion, concordance_all, prefix): """Choose the best duplicates according to the completion rate. :param tped: the ``tped`` containing the duplicated samples. :param samples: the updated position of the samples in the tped con...
0, module; 1, function_definition; 2, function_name:order_qc_dir; 3, parameters; 4, block; 5, identifier:dirnames; 6, expression_statement; 7, return_statement; 8, comment:"""Order the QC directory names according to their date. :param dirnames: the list of directories to merge data from. :type dirnames: list...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 17, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24; 23, 25; 23, 26; 25, 27; 25, 28; 26, 29; 27, 30; 27, 31; 28, 32; 30, 33; 30, 34; 32, 35; 32, 36; 35, 37; 35, 38; 36, 39
def order_qc_dir(dirnames): """Order the QC directory names according to their date. :param dirnames: the list of directories to merge data from. :type dirnames: list :returns: the sorted list of directories :rtype: list """ return sorted( dirnames, key=lambda dn: time.strptime( ...
0, module; 1, function_definition; 2, function_name:fetch; 3, parameters; 4, block; 5, identifier:self; 6, identifier:webfonts; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:""" Store every defined webfonts. Webfont are stored with sort on their name. Args: ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 9, 13; 9, 14; 11, 15; 11, 16; 14, 17; 16, 18; 16, 19; 17, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 29, 32; 29, 33
def fetch(self, webfonts): """ Store every defined webfonts. Webfont are stored with sort on their name. Args: webfonts (dict): Dictionnary of webfont settings from ``settings.ICOMOON_WEBFONTS``. """ sorted_keys = sorted(webfonts.keys()) ...
0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:ascending; 11, True; 12, comment:"""Sort the index of the DataFrame. Currently MultiIndex is not suppo...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 8, 14; 9, 15; 13, 16; 13, 17; 14, 18; 15, 19; 15, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 23, 30; 23, 31; 26, 32; 26, 33; 31, 34; 32, 35; 32, 36; 34, 37; 35, 38; 35, 39
def sort_index(self, ascending=True): """Sort the index of the DataFrame. Currently MultiIndex is not supported since Weld is missing multiple-column sort. Note this is an expensive operation (brings all data to Weld). Parameters ---------- ascending : bool, optional ...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, identifier:by; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 7, 22; 7, 23; 8, 24; 9, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 18, 35; 19, 36; 20, 37; 21, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44; 28...
def sort_values(self, by, ascending=True): """Sort the DataFrame based on a column. Unlike Pandas, one can sort by data from both index and regular columns. Currently possible to sort only on a single column since Weld is missing multiple-column sort. Note this is an expensive operatio...
0, module; 1, function_definition; 2, function_name:optimize_with_repeates; 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, expression_statement; 13, expression_statement; 14, if_statem...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 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; 11, 37; 12, 38; 13, 39; 14, 40; 14, 41; 15, 42; 16, 43; 18, 44; 18, 45; 18...
def optimize_with_repeates(self,fast=None,verbose=None,n_times=10,lambd=None,lambd_g=None,lambd_n=None): """ Train the model repeadly up to a number specified by the users with random restarts and return a list of all relative minima that have been found. This list is sorted according to ...
0, module; 1, function_definition; 2, function_name:sort_prefixes; 3, parameters; 4, block; 5, identifier:orig; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:prefixes; 12, string; 13, comment:"""Returns a sorted list of prefixes. Args...
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; 12, 19; 14, 20; 14, 21; 17, 22; 22, 23; 22, 24; 23, 25; 23, 26; 24, 27; 27, 28; 28, 29; 28, 30
def sort_prefixes(orig, prefixes='@+'): """Returns a sorted list of prefixes. Args: orig (str): Unsorted list of prefixes. prefixes (str): List of prefixes, from highest-priv to lowest. """ new = '' for prefix in prefixes: if prefix in orig: new += prefix ret...
0, module; 1, function_definition; 2, function_name:sort_children; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, identifier:attribute; 15,...
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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 19, 28; 19, 29; 21, 30; 21, 31; 21, 32; 21, 33; 21, 34; 22, 35; 23, 36; 23, 37; 25, 38; 25, 39; 26, 40; 30, 41; 31, 42; 32, 43; 32, ...
def sort_children(self, attribute=None, reverse_order=False): """ Sorts the children using either the given attribute or the Node name. :param attribute: Attribute name used for sorting. :type attribute: unicode :param reverse_order: Sort in reverse order. :type reverse_...
0, module; 1, function_definition; 2, function_name:_sort_kw_matches; 3, parameters; 4, block; 5, identifier:skw_matches; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:limit; 12, integer:0; 13, comment:"""Return a resized version of...
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; 10, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 21, 27; 21, 28; 24, 29; 26, 30; 26, 31; 28, 32; 28, 33; 29, 34; 29, 35; 31, 36; 31, 37; 33, 38; 34, 39; 34, 40; 37, 41
def _sort_kw_matches(skw_matches, limit=0): """Return a resized version of keywords to the given length.""" sorted_keywords = list(skw_matches.items()) sorted(sorted_keywords, key=cmp_to_key(_skw_matches_comparator)) return limit and sorted_keywords[:limit] or sorted_keywords
0, module; 1, function_definition; 2, function_name:trim; 3, parameters; 4, block; 5, identifier:self; 6, identifier:n_peaks; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:""" Sorts mass and intensities arrays in descending intensity order, then removes low-inten...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 16, 22; 21, 23; 21, 24
def trim(self, n_peaks): """ Sorts mass and intensities arrays in descending intensity order, then removes low-intensity peaks from the spectrum. :param n_peaks: number of peaks to keep """ self.sortByIntensity() ims.spectrum_trim(self.ptr, n_peaks)
0, module; 1, function_definition; 2, function_name:centroids; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:...
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; 6, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 26, 37; 26, 38; 28, 39; 28, 40; 30, 41; 30, 42; 32, 43; 32,...
def centroids(self, window_size=5): """ Detects peaks in raw data. :param mzs: sorted array of m/z values :param intensities: array of corresponding intensities :param window_size: size of m/z averaging window :returns: isotope pattern containing the centroids :...
0, module; 1, function_definition; 2, function_name:list_engines_by_priority; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, if_statement; 8, return_statement; 9, identifier:engines; 10, None; 11, comment:""" Return a list of engines supported sorted by each priority. """; 12, compar...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 5, 9; 5, 10; 6, 11; 7, 12; 7, 13; 8, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24; 22, 25; 22, 26; 26, 27; 26, 28; 27, 29; 27, 30; 28, 31
def list_engines_by_priority(engines=None): """ Return a list of engines supported sorted by each priority. """ if engines is None: engines = ENGINES return sorted(engines, key=operator.methodcaller("priority"))
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:dict1; 6, identifier:dict2; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Deep merge of dict2 into dict1. May be dictionaries or dictobj's. Values in dict2 will replace values in ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 17, 20; 17, 21; 19, 22; 19, 23; 19, 24; 22, 25; 22, 26; 23, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 32, 35; 32, 36; 33, 37; 33, 38; 34, 39; 37, 40; 37, 41; 38, 42; 38, 43;...
def union(dict1, dict2): """ Deep merge of dict2 into dict1. May be dictionaries or dictobj's. Values in dict2 will replace values in dict1 where they vary but have the same key. When lists are encountered, the dict2 list will replace the dict1 list. This will alter the first dictionary. The...
0, module; 1, function_definition; 2, function_name:_format_data; 3, parameters; 4, block; 5, identifier:self; 6, identifier:data; 7, expression_statement; 8, return_statement; 9, comment:""" Sort the data in blue wavelengths to red, and ignore any spectra that have entirely non-finite or negative fluxe...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 10, 13; 12, 14; 12, 15; 12, 16; 13, 17; 16, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 22, 29; 23, 30; 23, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 35, 42; 35,...
def _format_data(self, data): """ Sort the data in blue wavelengths to red, and ignore any spectra that have entirely non-finite or negative fluxes. """ return [spectrum for spectrum in \ sorted(data if isinstance(data, (list, tuple)) else [data], key=...
0, module; 1, function_definition; 2, function_name:get_sorting; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, identifier:resources; 14, 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; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 12, 19; 15, 20; 15, 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; 31, 36; 31, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42
def get_sorting(self, request, **resources): """ Get sorting options. :return list: sorting order """ sorting = [] if not request.GET: return sorting prefix = self._meta.dyn_prefix + 'sort' return request.GET.getlist(prefix)
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:sort_tuples; 12, string; 13, assignment; 14, pattern_list; 15, identifier:sort_tuples; 16...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 23, 25; 24, 26; 24, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 29, 37; 31, 38; 31, 39; 33, 40; 33, 41; 34, 42; 35, 43; 3...
def sort(self, *sort_tuples): ''' pymongo-style sorting. Accepts a list of tuples. :param sort_tuples: varargs of sort tuples. ''' query = self for name, direction in sort_tuples: field = resolve_name(self.type, name) if direction in (ASCENDING, 1): ...
0, module; 1, function_definition; 2, function_name:_has_bad_coords; 3, parameters; 4, block; 5, identifier:root; 6, identifier:stream; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:""" Predicate function encapsulating 'data ...
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; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 16, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 24, 32; 25, 33; 25, 34; 26, 35; 28, 36; 28, 37; 31, 38; 31, 39; 33, 40; 33, 41; 34, 42; 36, 43; 36...
def _has_bad_coords(root, stream): """ Predicate function encapsulating 'data clean up' filter code. Currently minimal, but these sort of functions tend to grow over time. Problem 1: Some of the GCN packets have an RA /Dec equal to (0,0) in the WhereWhen, and a flag in the What signify...
0, module; 1, function_definition; 2, function_name:sorted_chain; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, generic_type; 8, expression_statement; 9, return_statement; 10, list_splat_pattern; 11, type; 12, identifier:List; 13, type_parameter; 14, comment:"""Chain & sort ranges."""; 15, call; 16, identifi...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 13, 18; 15, 19; 15, 20; 17, 21; 17, 22; 18, 23; 20, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 27, 31; 27, 32; 28, 33; 28, 34; 29, 35; 30, 36; 30, 37; 31, 38; 32, 39; 35, 40; 37, 41; 37, 42; 41, 43; ...
def sorted_chain(*ranges: Iterable[Tuple[int, int]]) -> List[Tuple[int, int]]: """Chain & sort ranges.""" return sorted(itertools.chain(*ranges))
0, module; 1, function_definition; 2, function_name:partition_range; 3, parameters; 4, block; 5, identifier:stop; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# We loop over the range, only touching positions where levels potentia...
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; 6, 15; 6, 16; 7, 17; 8, 18; 9, 19; 10, 20; 13, 21; 13, 22; 13, 23; 14, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 23, 33; 23, 34; 23, 35; 23, 36; 23, 37; 26, 38; 26, 39; 29, 40; 29, 41; 30, 42; 30, 43; 32, ...
def partition_range(stop, annotations=None): """ Partition the range from 0 to `stop` based on annotations. >>> partition_range(50, annotations=[[(0, 21), (30, 35)], ... [(15, 32), (40, 46)]]) [(0, 15, {0}), (15, 21, {0, 1}), (21, 30, {...
0, module; 1, function_definition; 2, function_name:pprint_sequence; 3, parameters; 4, block; 5, identifier:sequence; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# The maximum length for...
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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 11, 28; 12, 29; 15, 30; 16, 31; 17, 32; 17, 33; 17, 34; 17, 35; 18, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 31, 44; 33,...
def pprint_sequence(sequence, annotations=None, block_length=10, blocks_per_line=6, format=PlaintextFormat): """ Pretty-print sequence for use with a monospace font. >>> sequence = 'MIMANQPLWLDSEVEMNHYQQSHIKSKSPYFPEDKHICWIKIFKAFGT' * 4 >>> print pprint_sequence(sequence, for...
0, module; 1, function_definition; 2, function_name:tabulate; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, express...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 6, 26; 6, 27; 7, 28; 7, 29; 8, 30; 8, 31; 9, 32; 9, 33; 10, 34; 10, 35; 11, 36; 11, 37; 12, 38; 12, 39; 13, 40; 13, 41; 14, 42; 14, 43; 15, 44; 16, 45; 17...
def tabulate( obj, v_level_indexes=None, h_level_indexes=None, v_level_visibility=None, h_level_visibility=None, v_level_sort_keys=None, h_level_sort_keys=None, v_level_titles=None, h_level_titles=None, empty="", ): """Render a nested data structure into a two-dimensional tab...
0, module; 1, function_definition; 2, function_name:get_ordered_entries; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, identifier:queryset; 12, False; 13, comment:""" Custom ordering. First we get the avera...
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; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 24, 30; 24, 31; 24, 32; 25, 33; 28, 34; 28, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 34,...
def get_ordered_entries(self, queryset=False): """ Custom ordering. First we get the average views and rating for the categories's entries. Second we created a rank by multiplying both. Last, we sort categories by this rank from top to bottom. Example: - Cat_1 ...
0, module; 1, function_definition; 2, function_name:parallel_progbar; 3, parameters; 4, block; 5, identifier:mapper; 6, identifier:iterable; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, dictionary_splat_pattern; 14, expression...
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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 31, 33; 31, 34; 32, 35; 32, 36; 34, 37; 34, 38; 36, 39; 36, 40; 38, 41; 38, 42; 38, 43; 38, 44;...
def parallel_progbar(mapper, iterable, nprocs=None, starmap=False, flatmap=False, shuffle=False, verbose=True, verbose_flatmap=None, **kwargs): """Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned :param mapper: The mapping function to apply...
0, module; 1, function_definition; 2, function_name:iparallel_progbar; 3, parameters; 4, block; 5, identifier:mapper; 6, identifier:iterable; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, dictionary_splat...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 12, 29; 13, 30; 13, 31; 14, 32; 15, 33; 16, 34; 17, 35; 31, 36; 34, 37; 34, 38; 35, 39; 35, 40; 38, 41; 38, 42; 40, 43; 40, 44; ...
def iparallel_progbar(mapper, iterable, nprocs=None, starmap=False, flatmap=False, shuffle=False, verbose=True, verbose_flatmap=None, max_cache=-1, **kwargs): """Performs a parallel mapping of the given iterable, reporting a progress bar as values get returned. Yields objects as soon as th...
0, module; 1, function_definition; 2, function_name:get_creation_date_tags; 3, parameters; 4, block; 5, identifier:url; 6, identifier:domain; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:as_dicts; 14, False; 15, ...
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; 10, 17; 11, 18; 11, 19; 12, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 19, 26; 20, 27; 20, 28; 22, 29; 22, 30; 24, 31; 24, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 32, 42; 32, 43; 3...
def get_creation_date_tags(url, domain, as_dicts=False): """ Put together all data sources in this module and return it's output. Args: url (str): URL of the web. With relative paths and so on. domain (str): Just the domain of the web. as_dicts (bool, default False): Convert output ...
0, module; 1, function_definition; 2, function_name:image_from_name; 3, parameters; 4, block; 5, identifier:name; 6, identifier:images; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Return an image from a list of images. If the name is...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 19, 29; 21, 30; 21, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 28, 38; 28, 39; 29, 40; 30, 41; 30, 42; 31, 43; ...
def image_from_name(name, images): """Return an image from a list of images. If the name is an exact match, return the last exactly matching image. Otherwise, sort images by 'natural' order, using decorate-sort-undecorate, and return the largest. see: http://code.activestate.com/recipes/2852...
0, module; 1, function_definition; 2, function_name:func_on_enter; 3, parameters; 4, block; 5, identifier:func; 6, expression_statement; 7, function_definition; 8, return_statement; 9, comment:""" Register the `func` as a callback reacting only to ENTER. Note: This function doesn't bind the key to the ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 8, 13; 11, 14; 12, 15; 12, 16; 12, 17; 15, 18; 17, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 25, 30; 30, 31; 30, 32; 32, 33
def func_on_enter(func): """ Register the `func` as a callback reacting only to ENTER. Note: This function doesn't bind the key to the element, just creates sort of filter, which ignores all other events. """ def function_after_enter_pressed(ev): ev.stopPropagation() ...
0, module; 1, function_definition; 2, function_name:prev_next_group; 3, parameters; 4, block; 5, identifier:project; 6, identifier:group; 7, expression_statement; 8, comment:# TODO: Profile and optimize this query if necessary; 9, expression_statement; 10, try_statement; 11, expression_statement; 12, expression_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 9, 15; 10, 16; 10, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 22, 32; 22, 33; 23, 34; 25, 35; 27, 36; 27, 37; 27, 38; 29, 39; 29, 40; 29, 41; 33, 42; 33, 43; ...
def prev_next_group(project, group): """Return adjacent group objects or None for the given project and group. The previous and next group objects are relative to sort order of the project's groups with respect to the passed in group. """ # TODO: Profile and optimize this query if necessary gr...
0, module; 1, function_definition; 2, function_name:do_minus; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parser; 7, identifier:group; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, return_statement; 14, string:'''This filter sorts nod...
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; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 12, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 19, 28; 20, 29; 20, 30; 22, 31; 25, 32; 25, 33; 28, 34; 28, 35; 28, 36; 31, 37; 32, 38; 32, 39; 34, 40; 34, 41; 35, 42; 35, 43; ...
def do_minus(self, parser, group): '''This filter sorts nodes in a flat group into "required", "default", and "banned" subgroups based on the presence of plus and minus nodes. ''' grouper = group.__class__() next_not = None for node in group: if isins...
0, module; 1, function_definition; 2, function_name:topological_sort; 3, parameters; 4, block; 5, identifier:dependency_pairs; 6, expression_statement; 7, expression_statement; 8, comment:# num arrows pointing in; 9, expression_statement; 10, comment:# list of arrows going out; 11, expression_statement; 12, comment:# u...
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; 9, 20; 11, 21; 13, 22; 13, 23; 13, 24; 14, 25; 15, 26; 15, 27; 15, 28; 16, 29; 17, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 24, 39; 24, 40; 25, 41; 25, 42; 28, 43; 29, 4...
def topological_sort(dependency_pairs): "Sort values subject to dependency constraints" num_heads = defaultdict(int) # num arrows pointing in tails = defaultdict(list) # list of arrows going out heads = [] # unique list of heads in order first seen for h, t in dependency_pairs: num_heads[...
0, module; 1, function_definition; 2, function_name:multisorted; 3, parameters; 4, block; 5, identifier:items; 6, list_splat_pattern; 7, expression_statement; 8, if_statement; 9, for_statement; 10, return_statement; 11, identifier:keys; 12, comment:"""Sort by multiple attributes. Args: items: An iterable s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 13, 19; 13, 20; 14, 21; 16, 22; 16, 23; 17, 24; 19, 25; 19, 26; 21, 27; 23, 28; 24, 29; 26, 30; 27, 31; 27, 32; 29, 33; 29, 34; 32, 35; 34, 36; 34, 37; 35, 38; 35, 39; 37, 40; 37, 41; 37, 42; 41, 43; 41...
def multisorted(items, *keys): """Sort by multiple attributes. Args: items: An iterable series to be sorted. *keys: Key objects which extract key values from the items. The first key will be the most significant, and the last key the least significant. If no key function...
0, module; 1, function_definition; 2, function_name:tuplesorted; 3, parameters; 4, block; 5, identifier:items; 6, list_splat_pattern; 7, expression_statement; 8, comment:# Transform the keys so each works on one item of the tuple; 9, expression_statement; 10, return_statement; 11, identifier:keys; 12, comment:"""Sort b...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 9, 13; 10, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 22, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 33, 38; 35, 39; 35, 40; 37, 41; 37, 42; 39, 43...
def tuplesorted(items, *keys): """Sort by tuples with a different key for each item. Args: items: An iterable series of sequences (typically tuples) *keys: Key objects which transform individual elements of each tuple into sort keys. The zeroth object transforms the zerot...
0, module; 1, function_definition; 2, function_name:list_formats; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:path; 15, tuple; 16,...
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; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 13, 25; 19, 26; 19, 27; 20, 28; 22, 29; 22, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 28, 36; 31, 37; 33, 38; 33, 39; 35, 40; 36, 41; 36, 42; 37, 43; 37,...
def list_formats(self, node, path=(), formats=None): """ Lists the object formats in sorted order. :param node: Root node to start listing the formats from. :type node: AbstractCompositeNode :param path: Walked paths. :type path: tuple :param formats: Formats. ...
0, module; 1, function_definition; 2, function_name:ls; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, if_statement; 11, identifier:root; 12, string:"."; 13, identifier:abspaths; 14, False; 15, identifier:recursive; 16, Fal...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 5, 11; 5, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 9, 19; 9, 20; 10, 21; 10, 22; 10, 23; 10, 24; 10, 25; 10, 26; 19, 27; 20, 28; 21, 29; 21, 30; 23, 31; 24, 32; 24, 33; 24, 34; 25, 35; 25, 36; 25, 37; 26, 38; 26, 39; 28, 40; 28, 41; 28, 42; 30, 43; 31, 4...
def ls(root=".", abspaths=False, recursive=False): """ Return a list of files in directory. Directory listings are sorted alphabetically. If the named directory is a file, return it's path. Examples: >>> fs.ls("foo") ["a", "b", "c"] >>> fs.ls("foo/a") ["foo/a"] ...
0, module; 1, function_definition; 2, function_name:list; 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, try_statement; 13, identifier:offset; 14, integer:0; 15, identifier:l...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 12, 24; 23, 25; 23, 26; 24, 27; 24, 28; 24, 29; 25, 30; 26, 31; 27, 32; 27, 33; 29, 34; 29, 35; 29, 36; 29, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32, 4...
def list(self, offset=0, limit=0, fields=None, sort=None, **kwargs): """Return filtered list of documents in a collection. For text-based search, we support searching on a name/string field by regex and text index. So strings passed in to a r=text search are used to filter collections b...
0, module; 1, function_definition; 2, function_name:_cursor; 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, expression_statement; 13, if_statement; 14, expression_statement; ...
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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 11, 27; 12, 28; 13, 29; 13, 30; 14, 31; 15, 32; 15, 33; 16, 34; 17, 35; 28, 36; 28, 37; 30, 38; 31, 39; 31, 40; 33, 41; 33, 42; 33, 43; 34, 44; 34...
def _cursor(self, offset=0, limit=0, fields=None, sort=None, **kwargs): """Return a cursor on a filtered list of documents in a collection. :param offset: for pagination, which record to start attribute :param limit: for pagination, how many records to return :param fields: list of fiel...
0, module; 1, function_definition; 2, function_name:insert; 3, parameters; 4, block; 5, identifier:self; 6, identifier:item; 7, identifier:low_value; 8, expression_statement; 9, return_statement; 10, comment:""" Create a new node and insert it into a sorted list. Calls the item duplicator, if any, on the item. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 11, 12; 11, 13; 13, 14; 14, 15; 14, 16; 15, 17; 15, 18; 16, 19; 16, 20; 16, 21; 19, 22; 19, 23
def insert(self, item, low_value): """ Create a new node and insert it into a sorted list. Calls the item duplicator, if any, on the item. If low_value is true, starts searching from the start of the list, otherwise searches from the end. Use the item comparator, if any, to find where to place the new n...
0, module; 1, function_definition; 2, function_name:reorder; 3, parameters; 4, block; 5, identifier:self; 6, identifier:handle; 7, identifier:low_value; 8, expression_statement; 9, return_statement; 10, comment:""" Move an item, specified by handle, into position in a sorted list. Uses the item comparator, if a...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 13, 17; 13, 18; 16, 19; 16, 20
def reorder(self, handle, low_value): """ Move an item, specified by handle, into position in a sorted list. Uses the item comparator, if any, to determine the new location. If low_value is true, starts searching from the start of the list, otherwise searches from the end. """ return lib...
0, module; 1, function_definition; 2, function_name:process_params; 3, parameters; 4, block; 5, identifier:request; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, for_statement; 15, if...
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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 15, 35; 16, 36; 16, 37; 17, 38; 25, 39; 26, 40; 27, 41; 27, 42; 29, 43; 30, 44; 3...
def process_params(request, standard_params=STANDARD_QUERY_PARAMS, filter_fields=None, defaults=None): """Parse query params. Parses, validates, and converts query into a consistent format. :keyword request: the bottle request :keyword standard_params: query params that are present ...
0, module; 1, function_definition; 2, function_name:_weave_dohist; 3, parameters; 4, block; 5, identifier:data; 6, identifier:s; 7, identifier:binsize; 8, identifier:hist; 9, identifier:rev; 10, default_parameter; 11, default_parameter; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, expressio...
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; 10, 17; 10, 18; 11, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 14, 25; 15, 26; 22, 27; 23, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 31, 35; 31, 36; 32, 37; 32, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 3...
def _weave_dohist(data, s, binsize, hist, rev, dorev=False, verbose=0): if dorev: dorev=1 else: dorev=0 """ Weave version of histogram with reverse_indices s is an index into data, sorted and possibly a subset """ code = """ int64_t nbin = hist.size(); ...
0, module; 1, function_definition; 2, function_name:loose_search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:asset_manager_id; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_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; 4, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 14, 26; 15, 27; 15, 28; 15, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, ...
def loose_search(self, asset_manager_id, query='', **kwargs): """ Asset search API. Possible kwargs: * threshold: int (default = 0) * page_no: int (default = 1) * page_size: int (default = 100) * sort_fields: list (default = []) * asset_typ...
0, module; 1, function_definition; 2, function_name:natural_sort; 3, parameters; 4, block; 5, identifier:item; 6, expression_statement; 7, if_statement; 8, function_definition; 9, return_statement; 10, comment:""" Sort strings that contain numbers correctly. >>> l = ['v1.3.12', 'v1.3.3', 'v1.2.5', 'v1.2.15', '...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 11, 17; 11, 18; 12, 19; 14, 20; 15, 21; 16, 22; 16, 23; 19, 24; 21, 25; 21, 26; 23, 27; 25, 28; 26, 29; 26, 30; 27, 31; 27, 32; 28, 33; 30, 34; 32, 35; 32, 36; 33, 37; 33, 38; 34, 39; 36, 40; 36, 41; 38, 42; 40, 43; 4...
def natural_sort(item): """ Sort strings that contain numbers correctly. >>> l = ['v1.3.12', 'v1.3.3', 'v1.2.5', 'v1.2.15', 'v1.2.3', 'v1.2.1'] >>> l.sort(key=natural_sort) >>> print l "['v1.2.1', 'v1.2.3', 'v1.2.5', 'v1.2.15', 'v1.3.3', 'v1.3.12']" """ if item is None: return 0...
0, module; 1, function_definition; 2, function_name:get_html_attrs; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, try_statement; 13, for_statement; 14, expression_statemen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 5, 18; 5, 19; 6, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 15, 33; 16, 34; 17, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 26, 44; ...
def get_html_attrs(kwargs=None): """Generate HTML attributes from the provided keyword arguments. The output value is sorted by the passed keys, to provide consistent output. Because of the frequent use of the normally reserved keyword `class`, `classes` is used instead. Also, all underscores are tran...
0, module; 1, function_definition; 2, function_name:sort_dependencies; 3, parameters; 4, block; 5, identifier:objects; 6, expression_statement; 7, import_from_statement; 8, comment:# Process the list of models, and get the list of dependencies; 9, expression_statement; 10, expression_statement; 11, expression_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 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; 6, 29; 7, 30; 7, 31; 9, 32; 10, 33; 11, 34; 12, 35; 13, 36; 13, 37; 13, 38; 14, 39; 14, 40; 14, 41; 15, 42; 24, 43; 25, 44; 25, 45; 2...
def sort_dependencies(objects): """ Sort a list of instances by their model dependancy graph. This is very similar to Django's sort_dependencies method except for two big differences: 1. We graph dependencies unrelated to natural_key. 2. We take a list of objects, and return a sorted list of o...
0, module; 1, function_definition; 2, function_name:sort_languages; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, identifier:order; 12, attribute; 13, comment:""" Sorts the Model languag...
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; 10, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 19, 25; 19, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 30, 33; 30, 34; 30, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 39, 42; 39, 43; ...
def sort_languages(self, order=Qt.AscendingOrder): """ Sorts the Model languages. :param order: Order. ( Qt.SortOrder ) """ self.beginResetModel() self.__languages = sorted(self.__languages, key=lambda x: (x.name), reverse=order) self.endResetModel()
0, module; 1, function_definition; 2, function_name:fmt_pairs; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statemen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 21, 29; 21, 30; 22, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 30, 41; 30, 42; 32, 43; 34, 44...
def fmt_pairs(obj, indent=4, sort_key=None): """Format and sort a list of pairs, usually for printing. If sort_key is provided, the value will be passed as the 'key' keyword argument of the sorted() function when sorting the items. This allows for the input such as [('A', 3), ('B', 5), ('Z', 1)] to...
0, module; 1, function_definition; 2, function_name:serialize; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, comment:# generate a list; 12, expression_statement; 13, if_statement; 14, return_statement; 15,...
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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 9, 20; 10, 21; 10, 22; 12, 23; 13, 24; 13, 25; 13, 26; 14, 27; 20, 28; 20, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 27, 38; 27, 39; 29, 40; 29, 41; 30, 42; 32, 43; 32, 4...
def serialize(self, as_dict=False, sort=None): """ Dump built files as a list or dictionary, for JSON or other serialization. sort: a key function to sort a list, or simply True """ files = getattr(self, 'files', self.run()) if as_dict: return dict((fn, ...
0, module; 1, function_definition; 2, function_name:iteritems; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:""" Sort and then iterate the dictionary """; 10, assignment; 11, pattern_list; 12, identifier:sorted_data; 13, block; 14, identifier...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 10, 14; 10, 15; 11, 16; 11, 17; 13, 18; 15, 19; 15, 20; 18, 21; 20, 22; 20, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 37, 39; 37, 40
def iteritems(self): """ Sort and then iterate the dictionary """ sorted_data = sorted(self.data.iteritems(), self.cmp, self.key, self.reverse) for k,v in sorted_data: yield k,v
0, module; 1, function_definition; 2, function_name:get_posts; 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, if_statement; 14, return_statement; 15, identifier:num;...
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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 22, 30; 22, 31; 23, 32; 24, 33; 26, 34; 28, 35; 31, 36; 31, 37; 33, 38; 34, 39; 35, 40; 38, 41; 38, 42; 39, 43; 39, 44...
def get_posts(self, num=None, tag=None, private=False): """ Get all the posts added to the blog. Args: num (int): Optional. If provided, only return N posts (sorted by date, most recent first). tag (Tag): Optional. If provided, only return posts that have a specific tag. private (bool): B...
0, module; 1, function_definition; 2, function_name:get_sort_function; 3, parameters; 4, block; 5, identifier:order; 6, expression_statement; 7, expression_statement; 8, function_definition; 9, return_statement; 10, comment:""" Returns a callable similar to the built-in `cmp`, to be used on objects. Takes a li...
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; 17, 22; 17, 23; 20, 24; 20, 25; 20, 26; 21, 27; 23, 28; 23, 29; 24, 30; 24, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; ...
def get_sort_function(order): """ Returns a callable similar to the built-in `cmp`, to be used on objects. Takes a list of dictionaries. In each, 'key' must be a string that is used to get an attribute of the objects to compare, and 'reverse' must be a boolean indicating whether the result should b...
0, module; 1, function_definition; 2, function_name:create_proxy_model; 3, parameters; 4, block; 5, identifier:self; 6, identifier:model; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Create a sort filter proxy model for the giv...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 24, 31; 28, 32; 28, 33; 30, 34; 30, 35
def create_proxy_model(self, model): """Create a sort filter proxy model for the given model :param model: the model to wrap in a proxy :type model: :class:`QtGui.QAbstractItemModel` :returns: a new proxy model that can be used for sorting and filtering :rtype: :class:`QtGui.QAb...
0, module; 1, function_definition; 2, function_name:sort_model; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, comment:# sort the identifier; 11, expression_statement; 12, comment:# sort the element; 13, expression_s...
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; 9, 19; 11, 20; 13, 21; 15, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 25, 35; 26, 36; 27, 37; 27, 38; 28, 39; 29, 40; 29, 41; 30, 42; 31, 43; 31, ...
def sort_model(self, *args, **kwargs): """Sort the proxy model :returns: None :rtype: None :raises: None """ self.proxy.sort(17) # sort the identifier self.proxy.sort(2) # sort the element self.proxy.sort(1) # sort the elementgrp self.proxy.sor...
0, module; 1, function_definition; 2, function_name:prepare_value; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:""" To avoid evaluating the lazysorted callable more than necessary to establish a potential ini...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 27, 35; 27, 36; 31, 37; 31, 38; 32, 39; 32, 40; 34, 41; 36, 42; 36, 43...
def prepare_value(self, value): """ To avoid evaluating the lazysorted callable more than necessary to establish a potential initial value for the field, we do it here. If there's - only one template choice, and - the field is required, and - there's no prior ini...
0, module; 1, function_definition; 2, function_name:_sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:""" Sort the response dictionaries priority levels for ordered iteration """; 11, call; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 20, 29; 20, 30; 22, 31; 26, 32; 32, 33; 32, 34; 34, 35; 34, 36; 35, 37; 35, 38; 36, 39; 36, 40; 38, 41; 41, 42; 41, 43...
def _sort(self): """ Sort the response dictionaries priority levels for ordered iteration """ self._log.debug('Sorting responses by priority') self._responses = OrderedDict(sorted(list(self._responses.items()), reverse=True)) self.sorted = True
0, module; 1, function_definition; 2, function_name:csv_row_to_transaction; 3, parameters; 4, block; 5, identifier:index; 6, identifier:row; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expressi...
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; 10, 26; 11, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 17, 33; 18, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 43; 32, 44; 3...
def csv_row_to_transaction(index, row, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses a row of strings to a ``Transaction`` object. Args: index: The index of this row in the original CSV file. Used for sorting...
0, module; 1, function_definition; 2, function_name:csv_to_transactions; 3, parameters; 4, block; 5, identifier:handle; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, return_stat...
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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 13, 26; 13, 27; 13, 28; 14, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 31, 39; 31, 40; 33, 41; 33, 42; 37, 43; 38, 44;...
def csv_to_transactions(handle, source_encoding="latin1", date_format="%d-%m-%Y", thousand_sep=".", decimal_sep=","): """ Parses CSV data from stream and returns ``Transactions``. Args: index: The index of this row in the original CSV file. Used for sorting `...
0, module; 1, function_definition; 2, function_name:filterAcceptsRow; 3, parameters; 4, block; 5, identifier:self; 6, identifier:row; 7, identifier:parentindex; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, comment:"""Return True, i...
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; 10, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 23, 36; 24, 37; 25, 38; 25, 39; 26, 40; 27, 41; 27, 42; 29, 43; 3...
def filterAcceptsRow(self, row, parentindex): """Return True, if the filter accepts the given row of the parent :param row: the row to filter :type row: :class:`int` :param parentindex: the parent index :type parentindex: :class:`QtCore.QModelIndex` :returns: True, if th...
0, module; 1, function_definition; 2, function_name:load_grid_data; 3, parameters; 4, block; 5, identifier:file_list; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# If there's only one file, we pretend it's a list; 11, if_statement; 12, expression_statement; 13,...
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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 11, 25; 11, 26; 11, 27; 12, 28; 14, 29; 16, 30; 16, 31; 16, 32; 17, 33; 25, 34; 26, 35; 27, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 32, 43; 32, 44; 3...
def load_grid_data(file_list, data_type="binary", sort=True, delim=" "): """ Loads data from one or multiple grid_task files. Arguments: file_list - either a string or a list of strings indicating files to load data from. Files are assumed to be in grid_task.dat ...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# Sort triggers by word and character length first; 8, for_statement; 9, comment:# Finally, sort triggers by priority; 10, expression_statement; 11, for_statement; 12, expression_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; 6, 13; 8, 14; 8, 15; 8, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 16, 28; 16, 29; 16, 30; 16, 31; 16, 32; 16, 33; 17, 34; 17, 35; 19, 36; 19, 37; 20, 38; 21, 39; 21, 40; 24, 41; 24, 42; 26, 43; 2...
def sort(self): """ Sort triggers and their associated responses """ # Sort triggers by word and character length first for priority, triggers in self._triggers.items(): self._log.debug('Sorting priority {priority} triggers'.format(priority=priority)) # G...
0, module; 1, function_definition; 2, function_name:log_message; 3, parameters; 4, block; 5, identifier:self; 6, identifier:user; 7, identifier:message; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, comment:"""Log a channel message. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 11, 18; 12, 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; 20, 32; 22, 33; 22, 34; 23, 35; 24, 36; 25, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 30, 43; 3...
def log_message(self, user, message): """Log a channel message. This log acts as a sort of cache so that recent activity can be searched by the bot and command modules without querying the database. """ if isinstance(user, SeshetUser): user = user.ni...
0, module; 1, function_definition; 2, function_name:add_item; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 7, identifier:name; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, if_statement; 15, expression_s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 10, 26; 11, 27; 11, 28; 12, 29; 12, 30; 13, 31; 14, 32; 14, 33; 15, 34; 16, 35; 17, 36; 17, 37; 17, 38; 18, 39; 19, 40; 20, 41; 20, 42; 20, 43; 32, 44; 3...
def add_item(self, path, name, icon=None, url=None, order=None, permission=None, active_regex=None): """ Add new menu item to menu :param path: Path of menu :param name: Display name :param icon: CSS icon :param url: link to page :param order: Sort order ...
0, module; 1, function_definition; 2, function_name:assist; 3, parameters; 4, block; 5, identifier:self; 6, identifier:project_path; 7, identifier:source; 8, identifier:position; 9, identifier:filename; 10, expression_statement; 11, return_statement; 12, comment:"""Return completion match and list of completion proposa...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 10, 12; 11, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 15, 20; 15, 21; 15, 22; 18, 23
def assist(self, project_path, source, position, filename): """Return completion match and list of completion proposals :param project_path: absolute project path :param source: unicode or byte string code source :param position: character or byte cursor position :param filename...
0, module; 1, function_definition; 2, function_name:sorted_key_list; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Returns list of keys sorted according to their absolute time."""; 12, not_ope...
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; 10, 16; 12, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 17, 23; 17, 24; 18, 25; 20, 26; 20, 27; 22, 28; 22, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; ...
def sorted_key_list(self): """Returns list of keys sorted according to their absolute time.""" if not self.is_baked: self.bake() key_value_tuple = sorted(self.dct.items(), key=lambda x: x[1]['__abs_time__']) skl = [k[0] for k in key_value_tupl...
0, module; 1, function_definition; 2, function_name:get_used_key_frames; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# each element in used_key_frames is a tuple (key_name, key_dict); 9, expression_statement; 10, for_statement; 11, return_statement; 12, comm...
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; 9, 14; 10, 15; 10, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 17, 23; 20, 24; 20, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 31, 35; 31, 36; 32, 37; 35, 38; 35, 39; 36, 40; 37, 41; 37, 42; 41, 43;...
def get_used_key_frames(self): """Returns a list of the keyframes used by this channel, sorted with time. Each element in the list is a tuple. The first element is the key_name and the second is the channel data at that keyframe.""" skl = self.key_frame_list.sorted_key_list() # ...
0, module; 1, function_definition; 2, function_name:flds_firstsort; 3, parameters; 4, block; 5, identifier:d; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, string; 11, assignment; 12, assignment; 13, expression_list; 14, string_content:Perform a lexsort and return t...
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; 10, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 16, 21; 16, 22; 18, 23; 18, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 26, 32; 28, 33; 28, 34; 28, 35; 31, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 34, 42; 35, 43...
def flds_firstsort(d): ''' Perform a lexsort and return the sort indices and shape as a tuple. ''' shape = [ len( np.unique(d[l]) ) for l in ['xs', 'ys', 'zs'] ]; si = np.lexsort((d['z'],d['y'],d['x'])); return si,shape;
0, module; 1, function_definition; 2, function_name:flds_sort; 3, parameters; 4, block; 5, identifier:d; 6, identifier:s; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, string; 13, assignment; 14, assignment; 15, identifier:l; 16, identifier:label...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 11, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 17, 24; 17, 25; 21, 26; 21, 27; 21, 28; 22, 29; 22, 30; 24, 31; 25, 32; 27, 33; 27, 34; 28, 35; 31, 36; 31, 37; 32, 38; 32, 39; 34, 40; 34, 41; 35, 42; 35, 43;...
def flds_sort(d,s): ''' Sort based on position. Sort with s as a tuple of the sort indices and shape from first sort. Parameters: ----------- d -- the flds/sclr data s -- (si, shape) sorting and shaping data from firstsort. ''' labels = [ key for key in d.keys() ...
0, module; 1, function_definition; 2, function_name:read; 3, parameters; 4, block; 5, identifier:fname; 6, dictionary_splat_pattern; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, with_statement; 11, return_statement; 12, identifier:kw; 13, string; 14, boolean_operator; 15, block; 16, assignment...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 13, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 18, 28; 18, 29; 18, 30; 18, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 25, 37; 25, 38; 25, 39; 26, 40; 27, 41; 27, 42; 27, 43; 2...
def read(fname,**kw): ''' Reads an lsp output file and returns a raw dump of data, sectioned into quantities either as an dictionary or a typed numpy array. Parameters: ----------- fname -- filename of thing to read Keyword Arguments: ------------------ vprint -- Verbose p...
0, module; 1, function_definition; 2, function_name:get_region_nt_counts; 3, parameters; 4, block; 5, identifier:region; 6, identifier:bam; 7, default_parameter; 8, expression_statement; 9, comment:# TODO: I should figure out what the different possible values are that; 10, comment:# pysam could give me back (so far I ...
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; 7, 20; 7, 21; 8, 22; 13, 23; 13, 24; 14, 25; 14, 26; 14, 27; 15, 28; 16, 29; 16, 30; 17, 31; 18, 32; 18, 33; 18, 34; 18, 35; 18, 36; 19, 37; 23, 38; 23, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 44;...
def get_region_nt_counts(region, bam, stranded=False): """ Get counts of each nucleotide from a bam file for a given region. If R1 and R2 reads both overlap a position, only one count will be added. If the R1 and R2 reads disagree at a position they both overlap, that read pair is not used for that ...
0, module; 1, function_definition; 2, function_name:nt_counts; 3, parameters; 4, block; 5, identifier:bam; 6, identifier:positions; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, for_statement; 15, expression_...
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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 11, 25; 12, 26; 12, 27; 12, 28; 13, 29; 14, 30; 14, 31; 14, 32; 15, 33; 16, 34; 24, 35; 24, 36; 25, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 31, 43; 31, 44;...
def nt_counts(bam, positions, stranded=False, vcf=False, bed=False): """ Find the number of nucleotides covered at all positions in a bed or vcf file. Parameters ---------- bam : str or pysam.calignmentfile.AlignmentFile Bam file opened with pysam or path to bam file (must be s...
0, module; 1, function_definition; 2, function_name:add_host; 3, parameters; 4, block; 5, identifier:self; 6, identifier:host; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Add in ansible's magic variables. Assign them here becaus...
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; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 10, 26; 11, 27; 15, 28; 16, 29; 17, 30; 18, 31; 19, 32; 20, 33; 20, 34; 20, 35; 26, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, 44; 30...
def add_host(self, host, group_names=None, host_vars=None): """ Used by deployers to add hosts to the inventory. :param str host: The host identifier (e.g. hostname, IP address) to use in the inventory. :param list group_names: A list of group names to which the host ...
0, module; 1, function_definition; 2, function_name:beds_to_boolean; 3, parameters; 4, block; 5, identifier:beds; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, expression...
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; 10, 28; 11, 29; 12, 30; 13, 31; 13, 32; 13, 33; 14, 34; 15, 35; 15, 36; 15, 37; 16, 38; 17, 39; 17, 40; 17, 41; 18, 42; 19, 43; 19, 44; 19, ...
def beds_to_boolean(beds, ref=None, beds_sorted=False, ref_sorted=False, **kwargs): """ Compare a list of bed files or BedTool objects to a reference bed file and create a boolean matrix where each row is an interval and each column is a 1 if that file has an interval that overlaps t...
0, module; 1, function_definition; 2, function_name:combine; 3, parameters; 4, block; 5, identifier:beds; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:# For some reason, doing the merging in the reduce statement doesn't work. I; 12, 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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 9, 24; 10, 25; 10, 26; 10, 27; 15, 28; 16, 29; 17, 30; 17, 31; 18, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 29, 44; 3...
def combine(beds, beds_sorted=False, postmerge=True): """ Combine a list of bed files or BedTool objects into a single BedTool object. Parameters ---------- beds : list List of paths to bed files or BedTool objects. beds_sorted : boolean Whether the bed files in beds are alread...
0, module; 1, function_definition; 2, function_name:sanitize_config_loglevel; 3, parameters; 4, block; 5, identifier:level; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, string; 13, boolean_operator; 14, block; 15, assignment; 16, call; 1...
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; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 14, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 18, 30; 19, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 28, 37; 28, 38; 29, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33...
def sanitize_config_loglevel(level): ''' Kinda sorta backport of loglevel sanitization for Python 2.6. ''' if sys.version_info[:2] != (2, 6) or isinstance(level, (int, long)): return level lvl = None if isinstance(level, basestring): lvl = logging._levelNames.get(level) if no...
0, module; 1, function_definition; 2, function_name:prt_js; 3, parameters; 4, block; 5, identifier:js; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, identifier:sort_keys; 11, True; 12, identifier:indent; 13, integer:4; 14, comment:"""Print Json in pretty format. T...
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; 17, 18; 18, 19; 18, 20; 20, 21; 20, 22; 20, 23
def prt_js(js, sort_keys=True, indent=4): """Print Json in pretty format. There's a standard module pprint, can pretty print python dict and list. But it doesn't support sorted key. That why we need this func. Usage:: >>> from weatherlab.lib.dataIO.js import prt_js >>> prt_js({"a": 1, ...
0, module; 1, function_definition; 2, function_name:find_field_names; 3, parameters; 4, block; 5, identifier:fields; 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, express...
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; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 15, 31; 15, 32; 16, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 32, 42; 32, 43; 35, 44; 3...
def find_field_names(fields, model=DEFAULT_MODEL, app=DEFAULT_APP, score_cutoff=50, pad_with_none=False): """Use fuzzy string matching to find similar model field names without consulting a synonyms list Returns: list: A list model field names (strings) sorted from most likely to least likely. []...
0, module; 1, function_definition; 2, function_name:lagged_in_date; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 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; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 5, 22; 5, 23; 6, 24; 6, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 12, 37; 13, 38; 13, 39; 14, 40; 14, 41; 15, 42; 16, 43; 18, 44; 18, 45; ...
def lagged_in_date(x=None, y=None, filter_dict=None, model='WikiItem', app=DEFAULT_APP, sort=True, limit=30000, lag=1, pad=0, truncate=True): """ Lag the y values by the specified number of samples. FIXME: sort has no effect when sequences provided in x, y instead of field names >>> lagged_in_date(x=[...
0, module; 1, function_definition; 2, function_name:percentile; 3, parameters; 4, block; 5, identifier:sorted_list; 6, identifier:percent; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, return_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 14, 27; 14, 28; 15, 29; 17, 30; 17, 31; 19, 32; 20, 33; 21, 34; 21, 35; 22, 36; 23, 37; 23, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, 4...
def percentile(sorted_list, percent, key=lambda x: x): """Find the percentile of a sorted list of values. Arguments --------- sorted_list : list A sorted (ascending) list of values. percent : float A float value from 0.0 to 1.0. key : function, optional An optional funct...
0, module; 1, function_definition; 2, function_name:tags; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# q = q.filter_by(state='active'); 11, expression_statement; 12, expression_statement; 13, return_statem...
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; 11, 18; 12, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 23, 32; 23, 33; 25, 34; 25, 35; 27, 36; 27, 37; 29, 38; 29, 39; 31, 40; 31, 41; 32, 42; 32, 43; 33...
def tags(self): '''Return a list of all tags that have this semantic tag, sorted by name. :rtype: list of ckan.model.tag.Tag objects ''' q = meta.Session.query(_tag.Tag) q = q.join(TagSemanticTag) q = q.filter_by(tag_id=self.id) # q = q.filter_by(state='active') q = q.order_by(_tag.Tag.name) tags = q...
0, module; 1, function_definition; 2, function_name:make_feature_bed; 3, parameters; 4, block; 5, identifier:gtf; 6, identifier:feature; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, with_statement; 11, expression_statement; 12, comment:# We'll sort so bedtools operations can be done faste...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 11, 22; 13, 23; 14, 24; 14, 25; 15, 26; 19, 27; 19, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 25, 36; 29, 37; 30, 38; 31, 39; 31, 40; 33, 41; 33, 42; 35, 43; 35, ...
def make_feature_bed(gtf, feature, out=None): """ Make a bed file with the start and stop coordinates for all of a particular feature in Gencode. Valid features are the features present in the third column of the Gencode GTF file. Parameters ---------- gtf : str Filename of the Genc...
0, module; 1, function_definition; 2, function_name:filter; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, with_statement; 11, identifier:order_by; 12, None; 13, identifier:limit; 14, integer:0; 15, identifier:kwargs; 16...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 17, 19; 18, 20; 18, 21; 19, 22; 20, 23; 20, 24; 21, 25; 21, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 25, 35; 25, 36; 25, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 2...
def filter(self, order_by=None, limit=0, **kwargs): """ Fetch a list of instances. :param order_by: column on which to order the results. \ To change the sort, prepend with < or >. :param limit: How many rows to fetch. :param kwargs: keyword args on w...
0, module; 1, function_definition; 2, function_name:all; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, with_statement; 10, identifier:order_by; 11, None; 12, identifier:limit; 13, integer:0; 14, comment:""" Fetch all items. ...
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; 9, 16; 15, 17; 16, 18; 17, 19; 18, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 20, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 23, 33; 23, 34; 24, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 29, 42; 30, 43; 3...
def all(self, order_by=None, limit=0): """ Fetch all items. :param limit: How many rows to fetch. :param order_by: column on which to order the results. \ To change the sort, prepend with < or >. """ with rconnect() as conn: try: ...
0, module; 1, function_definition; 2, function_name:safe_dump_js; 3, parameters; 4, block; 5, identifier:js; 6, identifier:abspath; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, comment:# try stringlize; 13, expression_statement; 14, expression...
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; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 13, 24; 14, 25; 15, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 30, 37; 30, 38; 32, 39; 32, 40; 32, 41; 32, 42; 32, 43; 32, 44...
def safe_dump_js(js, abspath, fastmode=False, compress=False, enable_verbose=True): """A stable version of dump_js, silently overwrite existing file. When your program been interrupted, you lose nothing. Typically if your program is interrupted by any reason, it only leaves a incomplete f...
0, module; 1, function_definition; 2, function_name:all_selectors; 3, parameters; 4, block; 5, identifier:Class; 6, identifier:fn; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, comment:"""return...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 19, 29; 19, 30; 19, 31; 20, 32; 21, 33; 21, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 31, 41; 32, 42; 34, 43; 3...
def all_selectors(Class, fn): """return a sorted list of selectors that occur in the stylesheet""" selectors = [] cssparser = cssutils.CSSParser(validate=False) css = cssparser.parseFile(fn) for rule in [r for r in css.cssRules if type(r)==cssutils.css.CSSStyleRule]: ...
0, module; 1, function_definition; 2, function_name:create_logger; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# Set up logging; 9, expression_statement; 10, expression_statement; 11, if_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; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 9, 25; 10, 26; 11, 27; 11, 28; 12, 29; 13, 30; 15, 31; 16, 32; 17, 33; 19, 34; 19, 35; 20, 36; 20, 37; 21, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44; 28...
def create_logger(self, args={}): """ Create and configure the program's logger object. Log levels: DEBUG - Log everything. Hidden unless --debug is used. INFO - information only ERROR - Critical error :param args: Object containing program's parsed command line ...
0, module; 1, function_definition; 2, function_name:get; 3, parameters; 4, block; 5, identifier:self; 6, identifier:slug; 7, expression_statement; 8, expression_statement; 9, comment:# check if is accessible from api; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, 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; 7, 22; 8, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 16, 30; 17, 31; 18, 32; 19, 33; 20, 34; 21, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, 44; ...
def get(self, slug): """Get KnwKB. Url parameters: - from: filter "mappings from" - to: filter "mappings to" - page - per_page - match_type: s=substring, e=exact, sw=startswith - sortby: 'from' or 'to' """ kb = api....