nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:filter_sorted_apps; 3, parameters; 4, block; 5, identifier:admin_apps; 6, identifier:request; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, comment:"...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 9, 19; 9, 20; 10, 21; 11, 22; 11, 23; 11, 24; 12, 25; 13, 26; 15, 27; 15, 28; 17, 29; 17, 30; 20, 31; 20, 32; 20, 33; 20, 34; 20, 35; 21, 36; 21, 37; 24, 38; 25, 39; 25, 40; 31, 41; 33, 42; 35, 43; 35, 4...
def filter_sorted_apps(admin_apps, request): """ Filter admin_apps to show the ones in ``DASHBOARD_SORTED_APPS`` first, and remove them from the subsequent listings. """ sorted_apps = [] for orig_app_spec in appsettings.DASHBOARD_SORTED_APPS: # make a copy that we can write to, to fix ...
0, module; 1, function_definition; 2, function_name:render_stats; 3, parameters; 4, block; 5, identifier:stats; 6, identifier:sort; 7, identifier:format; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:""" Retu...
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; 10, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 22, 32; 22, 33; 24, 34; 24, 35; 25, 36; 26, 37; 26, 38; 27, 39; 28, 40; 28, 41; 36, 42; 36, 43; ...
def render_stats(stats, sort, format): """ Returns a StringIO containing the formatted statistics from _statsfile_. _sort_ is a list of fields to sort by. _format_ is the name of the method that pstats uses to format the data. """ output = StdoutWrapper() if hasattr(stats, "stream"): ...
0, module; 1, function_definition; 2, function_name:render_queries; 3, parameters; 4, block; 5, identifier:queries; 6, identifier:sort; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, print_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 15, for...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 13, 29; 13, 30; 14, 31; 15, 32; 15, 33; 15, 34; 16, 35; 18, 36; 18, 37; 19, 38; 19, 39; 20, 40; 20, 41; 20, 42; 21, 43; 21, 4...
def render_queries(queries, sort): """ Returns a StringIO containing the formatted SQL queries. _sort_ is a field to sort by. """ output = StringIO() if sort == 'order': print >>output, " time query" for query in queries: print >>output, " %8s %s" % (query["time"...
0, module; 1, function_definition; 2, function_name:process_request; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, expression_statement; 8, function_definition; 9, if_statement; 10, if_statement; 11, comment:""" Setup the profiler for a profiling run and clear the SQL query log. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 10, 18; 13, 19; 14, 20; 14, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 17, 27; 18, 28; 18, 29; 18, 30; 20, 31; 21, 32; 22, 33; 23, 34; 23, 35; 25, 36; 27, 37; 27, 38; 28, 39; 29, 40; 30, 41; 30, 42; 30, 43; 3...
def process_request(self, request): """ Setup the profiler for a profiling run and clear the SQL query log. If this is a resort of an existing profiling run, just return the resorted list. """ def unpickle(params): stats = unpickle_stats(b64decode(params.get(...
0, module; 1, function_definition; 2, function_name:dedupe_and_sort; 3, parameters; 4, block; 5, identifier:sequence; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Add items that should be sorted first.; 12, expression_statement; 13...
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; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 10, 26; 12, 27; 15, 28; 15, 29; 15, 30; 17, 31; 19, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 34, 44; 34...
def dedupe_and_sort(sequence, first=None, last=None): """ De-dupe and partially sort a sequence. The `first` argument should contain all the items that might appear in `sequence` and for which the order (relative to each other) is important. The `last` argument is the same, but matching items will...
0, module; 1, function_definition; 2, function_name:sortedSemver; 3, parameters; 4, block; 5, identifier:versions; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, identifier:sort; 10, string:"asc"; 11, comment:"""Semantically sort the list of version Numbers"""; 12, boolean_operator; 13, block; 14, e...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 12, 15; 12, 16; 13, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 17, 23; 18, 24; 20, 25; 20, 26; 22, 27; 23, 28; 24, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 36, 42; 38, 43;...
def sortedSemver(versions, sort="asc"): """Semantically sort the list of version Numbers""" if versions and isinstance(versions, (list, tuple)): if PY2: return sorted(versions, cmp=semver.compare, reverse=True if sort.upper() == "DESC" else False) else: from functools imp...
0, module; 1, function_definition; 2, function_name:unique; 3, parameters; 4, type; 5, block; 6, identifier:arr; 7, default_parameter; 8, attribute; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, return_statement; 14, identifier:tolerance; 15, float:1e-6; 16, ident...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 13, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 22, 32; 22, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 28, 39; 28, 40; 30, 41; 31, 42; 32, 43; 33,...
def unique(arr, tolerance=1e-6) -> np.ndarray: """Return unique elements in 1D array, within tolerance. Parameters ---------- arr : array_like Input array. This will be flattened if it is not already 1D. tolerance : number (optional) The tolerance for uniqueness. Returns --...
0, module; 1, function_definition; 2, function_name:_get_cache_key; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:""" The cache key is a string of concatenated ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 18, 26; 19, 27; 19, 28; 21, 29; 21, 30; 22, 31; 22, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 30, 39; 35, 40; 35, 41; 36, 42; 37, 43; ...
def _get_cache_key(self): """ The cache key is a string of concatenated sorted names and values. """ keys = list(self.params.keys()) keys.sort() cache_key = str() for key in keys: if key != "api_sig" and key != "api_key" and key != "sk": ...
0, module; 1, function_definition; 2, function_name:fast_float; 3, parameters; 4, block; 5, identifier:x; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, identifier:key; 14, lambda; 15, identifier:nan; 16, Non...
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; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 14, 27; 14, 28; 18, 29; 18, 30; 24, 31; 24, 32; 25, 33; 26, 34; 27, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 34, 42; 36, 43; 36, 4...
def fast_float( x, key=lambda x: x, nan=None, _uni=unicodedata.numeric, _nan_inf=NAN_INF, _first_char=POTENTIAL_FIRST_CHAR, ): """ Convert a string to a float quickly, return input as-is if not possible. We don't need to accept all input that the real fast_int accepts because na...
0, module; 1, function_definition; 2, function_name:fast_int; 3, parameters; 4, block; 5, identifier:x; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, identifier:key; 12, lambda; 13, identifier:_uni; 14, attribute; 15, identifier:_first_char; 16, identif...
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; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 12, 21; 12, 22; 14, 23; 14, 24; 18, 25; 18, 26; 19, 27; 20, 28; 21, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 32, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 37, 41; 38, 42; 39, 43; 39...
def fast_int( x, key=lambda x: x, _uni=unicodedata.digit, _first_char=POTENTIAL_FIRST_CHAR, ): """ Convert a string to a int quickly, return input as-is if not possible. We don't need to accept all input that the real fast_int accepts because natsort is controlling what is passed to thi...
0, module; 1, function_definition; 2, function_name:sort_and_print_entries; 3, parameters; 4, block; 5, identifier:entries; 6, identifier:args; 7, expression_statement; 8, comment:# Extract the proper number type.; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Pre-remove ent...
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; 7, 19; 9, 20; 10, 21; 11, 22; 15, 23; 16, 24; 16, 25; 18, 26; 18, 27; 18, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 25, 41; 25, 42; 25, 43; 27, 4...
def sort_and_print_entries(entries, args): """Sort the entries, applying the filters first if necessary.""" # Extract the proper number type. is_float = args.number_type in ("float", "real", "f", "r") signed = args.signed or args.number_type in ("real", "r") alg = ( natsort.ns.FLOAT * is_fl...
0, module; 1, function_definition; 2, function_name:natsort_key; 3, parameters; 4, block; 5, identifier:val; 6, identifier:key; 7, identifier:string_func; 8, identifier:bytes_func; 9, identifier:num_func; 10, expression_statement; 11, comment:# Apply key if needed; 12, if_statement; 13, comment:# Assume the input are s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 10, 15; 12, 16; 12, 17; 14, 18; 14, 19; 16, 20; 16, 21; 17, 22; 18, 23; 19, 24; 19, 25; 19, 26; 22, 27; 23, 28; 24, 29; 24, 30; 26, 31; 26, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 31, 39; 31, 40; 34, 41; 34, 42; 34, 43;...
def natsort_key(val, key, string_func, bytes_func, num_func): """ Key to sort strings and numbers naturally. It works by splitting the string into components of strings and numbers, and then converting the numbers into actual ints or floats. Parameters ---------- val : str | unicode | byte...
0, module; 1, function_definition; 2, function_name:parse_number_factory; 3, parameters; 4, block; 5, identifier:alg; 6, identifier:sep; 7, identifier:pre_sep; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, comment:# Return the function, possibly wrapping in tuple if PATH is selected.; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 12, 18; 12, 19; 12, 20; 12, 21; 12, 22; 14, 23; 14, 24; 16, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 24, 38; 24, 39; 24, 40; 26, 41; 26, 42; 27, 43;...
def parse_number_factory(alg, sep, pre_sep): """ Create a function that will format a number into a tuple. Parameters ---------- alg : ns enum Indicate how to format the *bytes*. sep : str The string character to be inserted before the number in the returned tuple. p...
0, module; 1, function_definition; 2, function_name:natsort_keygen; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, try_statement; 9, comment:# Add the NS_DUMB option if the locale library is broken.; 10, if_statement; 11, comment:# Set some variables that will be passed...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 5, 25; 5, 26; 6, 27; 6, 28; 7, 29; 8, 30; 8, 31; 10, 32; 10, 33; 12, 34; 12, 35; 12, 36; 13, 37; 15, 38; 16, 39; 17, 40; 19, 41; 20, 42; 20, 43; 21, 44; 22, 45; ...
def natsort_keygen(key=None, alg=ns.DEFAULT): """ Generate a key to sort strings and numbers naturally. This key is designed for use as the `key` argument to functions such as the `sorted` builtin. The user may customize the generated function with the arguments to `natsort_keygen`, including ...
0, module; 1, function_definition; 2, function_name:natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:key; 13, None; 14, identifier:reverse; 15, False; 16, ident...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 26, 29; 26, 30; 26, 31; 28, 32; 28, 33; 30, 34; 30, 35; 31, 36; 31, 37
def natsorted(seq, key=None, reverse=False, alg=ns.DEFAULT): """ Sorts an iterable naturally. Parameters ---------- seq : iterable The input to sort. key : callable, optional A key used to determine how to sort each element of the iterable. It is **not** applied recursi...
0, module; 1, function_definition; 2, function_name:humansorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:key; 12, None; 13, identifier:reverse; 14, False; 15, identifier:alg; 16, attribute...
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; 8, 16; 9, 17; 10, 18; 16, 19; 16, 20; 18, 21; 18, 22; 22, 23; 22, 24; 22, 25; 22, 26; 26, 27; 26, 28; 28, 29; 28, 30
def humansorted(seq, key=None, reverse=False, alg=ns.DEFAULT): """ Convenience function to properly sort non-numeric characters. This is a wrapper around ``natsorted(seq, alg=ns.LOCALE)``. Parameters ---------- seq : iterable The input to sort. key : callable, optional A k...
0, module; 1, function_definition; 2, function_name:realsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:key; 12, None; 13, identifier:reverse; 14, False; 15, identifier:alg; 16, attribute;...
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; 8, 16; 9, 17; 10, 18; 16, 19; 16, 20; 18, 21; 18, 22; 22, 23; 22, 24; 22, 25; 22, 26; 26, 27; 26, 28; 28, 29; 28, 30
def realsorted(seq, key=None, reverse=False, alg=ns.DEFAULT): """ Convenience function to properly sort signed floats. A signed float in a string could be "a-5.7". This is a wrapper around ``natsorted(seq, alg=ns.REAL)``. The behavior of :func:`realsorted` for `natsort` version >= 4.0.0 was th...
0, module; 1, function_definition; 2, function_name:index_natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, comment:# Pair the index and sequence together, then sort by element; 12, expression_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 10, 23; 10, 24; 12, 25; 13, 26; 14, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 24, 33; 25, 34; 25, 35; 26, 36; 26, 37; 27, 38; 27, 39; 32, 40; 33, 41; 35, 42; 35, 43; 36, 44...
def index_natsorted(seq, key=None, reverse=False, alg=ns.DEFAULT): """ Determine the list of the indexes used to sort the input sequence. Sorts a sequence naturally, but returns a list of sorted the indexes and not the sorted list itself. This list of indexes can be used to sort multiple lists by t...
0, module; 1, function_definition; 2, function_name:order_by_index; 3, parameters; 4, block; 5, identifier:seq; 6, identifier:index; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:iter; 11, False; 12, comment:""" Order a given sequence by an index sequence. The output of `in...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 7, 10; 7, 11; 8, 12; 9, 13; 13, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28
def order_by_index(seq, index, iter=False): """ Order a given sequence by an index sequence. The output of `index_natsorted` is a sequence of integers (index) that correspond to how its input sequence **would** be sorted. The idea is that this index can be used to reorder multiple sequences by ...
0, module; 1, function_definition; 2, function_name:find_records; 3, parameters; 4, block; 5, identifier:self; 6, identifier:collection_name; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, if_stateme...
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; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 13, 29; 14, 30; 14, 31; 15, 32; 16, 33; 16, 34; 17, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33, 44; ...
def find_records(self, collection_name, query={}, sort_by=None, sort_direction=None, start=0, limit=None): """ Return a cursor of records from the given MongoDB collection. :param collection_name: Name of the MongoDB collection to query. :param query: Standard Mongo...
0, module; 1, function_definition; 2, function_name:_apply_sort; 3, parameters; 4, block; 5, identifier:cursor; 6, identifier:sort_by; 7, identifier:sort_direction; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:""" Apply sort to a cursor. :param cursor: The cursor to apply...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 24, 32; 24, 33; 26, 34; 26, 35; 27, 36; 32, 37; 32, 38; 35, 39; 35, 40; 36, 41; 36, 42; 42, 43;...
def _apply_sort(cursor, sort_by, sort_direction): """ Apply sort to a cursor. :param cursor: The cursor to apply sort on. :param sort_by: The field name to sort by. :param sort_direction: The direction to sort, "asc" or "desc". :return: """ if sort_direc...
0, module; 1, function_definition; 2, function_name:get_runs; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, function_definition; 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; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 13, 29; 13, 30; 14, 31; 15, 32; 25, 33; 25, 34; 27, 35; 27, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33, 44; ...
def get_runs(self, sort_by=None, sort_direction=None, start=0, limit=None, query={"type": "and", "filters": []}): """ Return all runs in the file store. If a run is corrupt, e.g. missing files, it is skipped. :param sort_by: NotImplemented :param sort_direction: NotImplemented...
0, module; 1, function_definition; 2, function_name:get_runs; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 5, 21; 6, 22; 7, 23; 8, 24; 9, 25; 10, 26; 11, 27; 12, 28; 13, 29; 14, 30; 14, 31; 15, 32; 18, 33; 19, 34; 20, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44; 26...
def get_runs(): """Get all runs, sort it and return a response.""" data = current_app.config["data"] draw = parse_int_arg("draw", 1) start = parse_int_arg("start", 0) length = parse_int_arg("length", -1) length = length if length >= 0 else None order_column = request.args.get("order[0][colum...
0, module; 1, function_definition; 2, function_name:generate_querystring; 3, parameters; 4, block; 5, identifier:params; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, for_statement; 10, if_statement; 11, comment:""" Generate a querystring suitable for use in the v2 api. The Requests lib...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 10, 19; 12, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 19, 29; 21, 30; 27, 31; 28, 32; 28, 33; 28, 34; 29, 35; 31, 36; 31, 37; 32, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43; 36...
def generate_querystring(params): """ Generate a querystring suitable for use in the v2 api. The Requests library doesn't know how to generate querystrings that encode dictionaries using square brackets: https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD Note: we use `sort...
0, module; 1, function_definition; 2, function_name:filter_catalog; 3, parameters; 4, block; 5, identifier:catalog; 6, dictionary_splat_pattern; 7, expression_statement; 8, comment:# interpret input pars; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 7, 25; 9, 26; 10, 27; 11, 28; 12, 29; 14, 30; 15, 31; 16, 32; 17, 33; 17, 34; 19, 35; 20, 36; 22, 37; 23, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 29,...
def filter_catalog(catalog, **kwargs): """ Create a new catalog selected from input based on photometry. Parameters ---------- bright_limit : float Fraction of catalog based on brightness that should be retained. Value of 1.00 means full catalog. max_bright : int Maximum nu...
0, module; 1, function_definition; 2, function_name:sort_timeseries; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# the time series is sorted by default; 9, if_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statem...
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; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 13, 24; 14, 25; 18, 26; 18, 27; 19, 28; 20, 29; 20, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 27, 38; 27, 39; 32, 40; 33, 41; 34, 42; 34, 43; 35, ...
def sort_timeseries(self, ascending=True): """Sorts the data points within the TimeSeries according to their occurrence inline. :param boolean ascending: Determines if the TimeSeries will be ordered ascending or descending. If this is set to descending once, the ordered parameter defined in...
0, module; 1, function_definition; 2, function_name:sorted_timeseries; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, return_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 12, 24; 12, 25; 13, 26; 14, 27; 18, 28; 18, 29; 19, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 25, 36; 26, 37; 26, 38; 31, 39; 33, 40; 33, 41; 35, 42; 35, 43; 36, 4...
def sorted_timeseries(self, ascending=True): """Returns a sorted copy of the TimeSeries, preserving the original one. As an assumption this new TimeSeries is not ordered anymore if a new value is added. :param boolean ascending: Determines if the TimeSeries will be ordered ascending ...
0, module; 1, function_definition; 2, function_name:_calculate_values_to_forecast; 3, parameters; 4, block; 5, identifier:self; 6, identifier:timeSeries; 7, expression_statement; 8, comment:# do not set anything, if it is not required; 9, if_statement; 10, comment:# check the TimeSeries for correctness; 11, if_statemen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 9, 17; 9, 18; 11, 19; 11, 20; 12, 21; 12, 22; 13, 23; 14, 24; 15, 25; 17, 26; 17, 27; 18, 28; 19, 29; 20, 30; 21, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 29, 41; 29, 42; 30, 43; 31,...
def _calculate_values_to_forecast(self, timeSeries): """Calculates the number of values, that need to be forecasted to match the goal set in forecast_until. This sets the parameter "valuesToForecast" and should be called at the beginning of the :py:meth:`BaseMethod.execute` implementation. :pa...
0, module; 1, function_definition; 2, function_name:get_bucket; 3, parameters; 4, block; 5, identifier:self; 6, identifier:bucket; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement;...
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; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 15, 35; 15, 36; 16, 37; 17, 38; 18, 39; 19, 40; 27, 41; 27, 42; 28, 43; 28, 44; 29...
def get_bucket(self, bucket, marker=None, max_keys=None, prefix=None): """ Get a list of all the objects in a bucket. @param bucket: The name of the bucket from which to retrieve objects. @type bucket: L{unicode} @param marker: If given, indicate a position in the overall ...
0, module; 1, function_definition; 2, function_name:findunique; 3, parameters; 4, block; 5, identifier:lst; 6, identifier:key; 7, expression_statement; 8, return_statement; 9, comment:""" Find all unique key values for items in lst. Parameters ---------- lst: list A list of composite dictiona...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 12, 13; 13, 14; 13, 15; 15, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 18, 22; 20, 23; 20, 24; 23, 25; 23, 26
def findunique(lst, key): """ Find all unique key values for items in lst. Parameters ---------- lst: list A list of composite dictionaries e.g. ``layers``, ``classes`` key: string The key name to search each dictionary in the list Returns ------- list A ...
0, module; 1, function_definition; 2, function_name:make_input_dataframe_by_entity; 3, parameters; 4, block; 5, identifier:tax_benefit_system; 6, identifier:nb_persons; 7, identifier:nb_groups; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, 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; 4, 22; 4, 23; 4, 24; 8, 25; 9, 26; 10, 27; 11, 28; 12, 29; 13, 30; 14, 31; 16, 32; 17, 33; 20, 34; 21, 35; 22, 36; 22, 37; 22, 38; 23, 39; 23, 40; 23, 41; 24, 42; 26, 43; 26, 44; 27,...
def make_input_dataframe_by_entity(tax_benefit_system, nb_persons, nb_groups): """ Generate a dictionnary of dataframes containing nb_persons persons spread in nb_groups groups. :param TaxBenefitSystem tax_benefit_system: the tax_benefit_system to use :param int nb_persons: the number of pe...
0, module; 1, function_definition; 2, function_name:multi_sort; 3, parameters; 4, block; 5, identifier:remotes; 6, identifier:sort; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Convert name to int if alpha is in sort.; 11, if_statement; 12, comment:# Parse versions if semver ...
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; 7, 19; 8, 20; 9, 21; 11, 22; 11, 23; 13, 24; 13, 25; 15, 26; 16, 27; 16, 28; 16, 29; 18, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 26, 42; 26, 43; 27, 44...
def multi_sort(remotes, sort): """Sort `remotes` in place. Allows sorting by multiple conditions. This is needed because Python 3 no longer supports sorting lists of multiple types. Sort keys must all be of the same type. Problem: the user expects versions to be sorted latest first and timelogical to ...
0, module; 1, function_definition; 2, function_name:get_params; 3, parameters; 4, block; 5, identifier:self; 6, identifier:ctx; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Sort order of options before displaying. :param click.core.Context ctx: Click context. :...
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; 14, 19; 15, 20; 15, 21; 16, 22; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 26, 29; 26, 30; 28, 31; 28, 32
def get_params(self, ctx): """Sort order of options before displaying. :param click.core.Context ctx: Click context. :return: super() return value. """ self.params.sort(key=self.custom_sort) return super(ClickGroup, self).get_params(ctx)
0, module; 1, function_definition; 2, function_name:configure_switch_entries; 3, parameters; 4, block; 5, identifier:self; 6, identifier:switch_ip; 7, identifier:port_bindings; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 8, 31; 9, 32; 10, 33; 11, 34; 12, 35; 13, 36; 14, 37; 15, 38; 17, 39; 18, 40; 19, 41; 20, 42; 21, 43; 22, 44; 22, 45; 2...
def configure_switch_entries(self, switch_ip, port_bindings): """Create a nexus switch entry in Nexus. The port_bindings is sorted by vlan_id, vni, port_id. When there is a change in vlan_id or vni, then vlan data is configured in Nexus device. Otherwise we check if there is a c...
0, module; 1, function_definition; 2, function_name:_sort_resources_per_hosting_device; 3, parameters; 4, block; 5, identifier:resources; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""This function will sort the resources on hosting device. The sorting ...
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; 18, 21; 18, 22; 20, 23; 20, 24; 20, 25; 24, 26; 24, 27; 25, 28; 25, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 30, 37; 31, 38; 32, 39; 32, 40; 33, 41; 34, 42; 34, 43; ...
def _sort_resources_per_hosting_device(resources): """This function will sort the resources on hosting device. The sorting on hosting device is done by looking up the `hosting_device` attribute of the resource, and its `id`. :param resources: a dict with key of resource name :r...
0, module; 1, function_definition; 2, function_name:compute; 3, parameters; 4, block; 5, identifier:self; 6, identifier:t; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, if_statemen...
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; 7, 25; 7, 26; 8, 27; 8, 28; 9, 29; 9, 30; 10, 31; 10, 32; 11, 33; 11, 34; 12, 35; 13, 36; 14, 37; 14, 38; 15, 39; 15, 40; 16, 41; 17, 42; 18, 43; 19, 44; 20, 45;...
def compute(self, t, yerr=1.123e-12, check_sorted=True, A=None, U=None, V=None): """ Compute the extended form of the covariance matrix and factorize Args: x (array[n]): The independent coordinates of the data points. This array must be _sorted_ in as...
0, module; 1, function_definition; 2, function_name:group_dict; 3, parameters; 4, block; 5, identifier:items; 6, identifier:keyfunc; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Return a list defaultdict with ``items`` grouped by ``keyfunc``. >>> sorted(g...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 15, 19; 15, 20; 18, 21; 18, 22; 19, 23; 20, 24; 21, 25; 21, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 33, 37; 34, 38; 34, 39
def group_dict(items, keyfunc): """Return a list defaultdict with ``items`` grouped by ``keyfunc``. >>> sorted(group_dict('eggs', lambda x: x).items()) [('e', ['e']), ('g', ['g', 'g']), ('s', ['s'])] """ result = collections.defaultdict(list) for i in items: key = keyfunc(i) res...
0, module; 1, function_definition; 2, function_name:_split_dict; 3, parameters; 4, block; 5, identifier:dic; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, string; 10, assignment; 11, expression_list; 12, string_content:Split dict into sorted keys and values >>> _split_dict({'b': 2, 'a':...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 9, 12; 10, 13; 10, 14; 11, 15; 11, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 26, 28; 26, 29
def _split_dict(dic): '''Split dict into sorted keys and values >>> _split_dict({'b': 2, 'a': 1}) (['a', 'b'], [1, 2]) ''' keys = sorted(dic.keys()) return keys, [dic[k] for k in keys]
0, module; 1, function_definition; 2, function_name:monitor; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, function_definition; 13, comment:# FIXME: this will genera...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 27, 41; 27, 42; 28, 43; 28,...
def monitor(args): ''' Retrieve status of jobs submitted from a given workspace, as a list of TSV lines sorted by descending order of job submission date''' r = fapi.list_submissions(args.project, args.workspace) fapi._check_response_code(r, 200) statuses = sorted(r.json(), key=lambda k: k['subm...
0, module; 1, function_definition; 2, function_name:tcsort; 3, parameters; 4, comment:# FIXME SUCH WOW SO INEFFICIENT O_O; 5, block; 6, identifier:item; 7, expression_statement; 8, return_statement; 9, comment:""" get len of transitive closure assume type items is tree... """; 10, binary_operator:len(item[1]) + sum(tcs...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 23, 26; 25, 27; 25, 28; 27, 29; 27, 30; 29, 31; 29, 32
def tcsort(item): # FIXME SUCH WOW SO INEFFICIENT O_O """ get len of transitive closure assume type items is tree... """ return len(item[1]) + sum(tcsort(kv) for kv in item[1].items())
0, module; 1, function_definition; 2, function_name:sortProperties; 3, parameters; 4, comment:# modified to sort objects using their global rank; 5, block; 6, identifier:self; 7, identifier:properties; 8, expression_statement; 9, comment:# Sort object lists; 10, for_statement; 11, comment:# Make sorted list of properti...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 8, 13; 10, 14; 10, 15; 10, 16; 12, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 17, 23; 17, 24; 20, 25; 20, 26; 22, 27; 24, 28; 24, 29; 27, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 33, 37; 33, 38; 36, 39; 36, 40; 37, 41; 38, 42; 38, 43...
def sortProperties(self, properties): # modified to sort objects using their global rank """Take a hash from predicate uris to lists of values. Sort the lists of values. Return a sorted list of properties.""" # Sort object lists for prop, objects in properties.items(): o...
0, module; 1, function_definition; 2, function_name:getSubOrder; 3, parameters; 4, block; 5, identifier:existing; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, for_statement; 11, expression_statement; 12, function_definition; 13, return_statement; 14, comment:"""...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 15, 28; 15, 29; 16, 30; 16, 31; 18, 32; 19, 33; 22, 34; 23, 35; 23, 36; 25, 37; 26, 38; 27, 39; 27, 40; 29, 41; 29, 42; 33, 43; 33, ...
def getSubOrder(existing): """ Alpha sort by the full chain of parents. """ alpha = list(zip(*sorted(((k, v['rec']['label']) for k, v in existing.items()), key=lambda a: a[1])))[0] depths = {} def getDepth(id_): if id_ in depths: return depths[id_] else: if id_ in...
0, module; 1, function_definition; 2, function_name:insert_sort; 3, parameters; 4, block; 5, identifier:node; 6, identifier:target; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Insert node into sorted position in target tree. ...
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; 11, 17; 11, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 17, 26; 17, 27; 18, 28; 19, 29; 21, 30; 21, 31; 23, 32; 23, 33; 25, 34; 25, 35; 28, 36; 28, 37; 29, 38; 34, 39; 34, 40; 35, 41; 36, 42; 36, 43;...
def insert_sort(node, target): """Insert node into sorted position in target tree. Uses sort function and language from target""" sort = target.sort lang = target.lang collator = Collator.createInstance(Locale(lang) if lang else Locale()) for child in target.tree: if collator.compare(so...
0, module; 1, function_definition; 2, function_name:do_sort_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, identifier:decl; 8, identifier:pseudo; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 17, 30; 19, 31; 19, 32; 19, 33; 19, 34; 21, 35; 21, 36; 22, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 4...
def do_sort_by(self, element, decl, pseudo): """Implement sort-by declaration - pre-match.""" if ',' in decl.value: css, flags = split(decl.value, ',') else: css = decl.value flags = None sort = css_to_func(serialize(css), serialize(flags or ''), ...
0, module; 1, function_definition; 2, function_name:keys; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Returns a sorted list of keys """; 11, assignment; 12, identifier:n; 13, call; 14, comment:# onl...
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; 8, 15; 9, 16; 11, 17; 11, 18; 13, 19; 13, 20; 15, 21; 15, 22; 18, 23; 18, 24; 20, 25; 21, 26; 22, 27; 22, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 30, 35; 32, 36; 32, 37; 33, 38; 33, 39; 34, 40; 36, 41; 36, 42; 39, 43; 3...
def keys(self): """ Returns a sorted list of keys """ keys = list() for n in range(len(self)): # only append the valid keys key = self.get_value() if not key in ['', None]: keys.append(key) return keys
0, module; 1, function_definition; 2, function_name:set_item; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:value; 8, expression_statement; 9, expression_statement; 10, comment:# if it exists, update; 11, if_statement; 12, comment:""" Sets the item by key, and refills the table s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 11, 14; 11, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 17, 23; 19, 24; 19, 25; 22, 26; 23, 27; 23, 28; 25, 29; 26, 30; 26, 31; 27, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43...
def set_item(self, key, value): """ Sets the item by key, and refills the table sorted. """ keys = list(self.keys()) # if it exists, update if key in keys: self.set_value(1,keys.index(key),str(value)) # otherwise we have to add an element els...
0, module; 1, function_definition; 2, function_name:insert_ordered; 3, parameters; 4, block; 5, identifier:value; 6, identifier:array; 7, expression_statement; 8, expression_statement; 9, comment:# search for the last array item that value is larger than; 10, for_statement; 11, expression_statement; 12, return_statemen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 10, 15; 10, 16; 10, 17; 11, 18; 12, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 36, 40; 38, 41; 38, 42; 39, 43;...
def insert_ordered(value, array): """ This will insert the value into the array, keeping it sorted, and returning the index where it was inserted """ index = 0 # search for the last array item that value is larger than for n in range(0,len(array)): if value >= array[n]: index = n+1...
0, module; 1, function_definition; 2, function_name:remove_dataset; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, comment:# Let's avoid deleting ALL parameters from the matching contexts; 11, if_statement; 12, commen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 6, 36; 6, 37; 7, 38; 8, 39; 9, 40; 11, 41; 11, 42; 13, 43; 14, 44; 14, 45; 15, 46; 1...
def remove_dataset(self, dataset=None, **kwargs): """ Remove a dataset from the Bundle. This removes all matching Parameters from the dataset, model, and constraint contexts (by default if the context tag is not provided). You must provide some sort of filter or this will raise an Erro...
0, module; 1, function_definition; 2, function_name:calls_sorted; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, function_definition; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# TODO: ugh, this is ugly. Test to find the optimal way to sort; 12, co...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 13, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 23, 32; 23, 33; 23, 34; 23, 35; 25, 36; 25, 37; 27, 38; 27, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, ...
def calls_sorted(self): """ calls sorted in z """ def _z(call): if isinstance(call.z.value, np.ndarray): return np.mean(call.z.value.flatten()) elif isinstance(call.z.value, float) or isinstance(call.z.value, int): return call.z.val...
0, module; 1, function_definition; 2, function_name:_filter_library_state; 3, parameters; 4, block; 5, identifier:self; 6, identifier:items; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, comment:# If the hovered item is e.g. a connection, we need to get the parental state; 11, expression_statem...
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; 8, 17; 9, 18; 11, 19; 12, 20; 13, 21; 14, 22; 14, 23; 14, 24; 14, 25; 16, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 24, 38; 24, 39; 25, 40; 25, 41; 27, 42; 29, 43; 29,...
def _filter_library_state(self, items): """Filters out child elements of library state when they cannot be hovered Checks if hovered item is within a LibraryState * if not, the list is returned unfiltered * if so, STATE_SELECTION_INSIDE_LIBRARY_STATE_ENABLED is checked * if ...
0, module; 1, function_definition; 2, function_name:_filter_hovered_items; 3, parameters; 4, block; 5, identifier:self; 6, identifier:items; 7, identifier:event; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, comment:# States/Names take preced...
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; 8, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 15, 27; 16, 28; 17, 29; 17, 30; 17, 31; 19, 32; 19, 33; 20, 34; 22, 35; 22, 36; 23, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44;...
def _filter_hovered_items(self, items, event): """Filters out items that cannot be hovered :param list items: Sorted list of items beneath the cursor :param Gtk.Event event: Motion event :return: filtered items :rtype: list """ items = self._filter_library_state(...
0, module; 1, function_definition; 2, function_name:compare_variables; 3, parameters; 4, block; 5, identifier:tree_model; 6, identifier:iter1; 7, identifier:iter2; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# get key of first variable; 13, expression_s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 13, 24; 15, 25; 16, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44...
def compare_variables(tree_model, iter1, iter2, user_data=None): """Triggered upon updating the list of global variables Helper method to sort global variables alphabetically. :param tree_model: Tree model implementing the Gtk.TreeSortable interface. :param iter1: Points at a row. ...
0, module; 1, function_definition; 2, function_name:load_hook_files; 3, parameters; 4, block; 5, identifier:pathname; 6, expression_statement; 7, global_statement; 8, if_statement; 9, for_statement; 10, comment:""" Loads files either defined as a glob or a single file path sorted by filenames. """; 11, iden...
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; 9, 16; 9, 17; 12, 18; 12, 19; 13, 20; 14, 21; 17, 22; 17, 23; 17, 24; 17, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 21, 33; 22, 34; 25, 35; 25, 36; 26, 37; 27, 38; 27, 39; 27, 40; 28, 41; 28, 42; 30, 43; 30...
def load_hook_files(pathname): """ Loads files either defined as a glob or a single file path sorted by filenames. """ global hooks if sys.version_info[0] > 2 and sys.version_info[1] > 4: fsglob = sorted(glob.iglob(pathname, recursive=True)) else: fsglob = sorted(glob.iglob(...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:imports; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, if_statement; 11, if_statement; 12, comment:# Partition the imports; 13, expression_statement; 14, for_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 9, 23; 10, 24; 10, 25; 10, 26; 11, 27; 11, 28; 11, 29; 13, 30; 14, 31; 14, 32; 14, 33; 16, 34; 16, 35; 16, 36; 17, 37; 25, 38; 25, 39; 26, 40; 26, 41; 28, 42; 29, 43; 30, 44; ...
def sort(imports, separate=True, import_before_from=True, **classify_kwargs): """Sort import objects into groups. :param list imports: FromImport / ImportImport objects :param bool separate: Whether to classify and return separate segments of imports based on classification. :param bool import_...
0, module; 1, function_definition; 2, function_name:sort_recursive; 3, parameters; 4, block; 5, identifier:data; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Recursively sorts all elements in a dictionary Args: data (dict): The dictionary to s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 20, 25; 20, 26; 20, 27; 22, 28; 25, 29; 25, 30; 26, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 31, 37; 32, 38; 34, 39; 34, 40; 36, 41; 37, 42; 37, 43; ...
def sort_recursive(data): """ Recursively sorts all elements in a dictionary Args: data (dict): The dictionary to sort Returns: sorted_dict (OrderedDict): The sorted data dict """ newdict = {} for i in data.items(): if type(i[1]) is dict: newdict[i[0]]...
0, module; 1, function_definition; 2, function_name:names_to_abbreviations; 3, parameters; 4, block; 5, identifier:reporters; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Build a dict mapping names to their variations Something li...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 16, 25; 16, 26; 22, 27; 22, 28; 24, 29; 24, 30; 24, 31; 26, 32; 26, 33; 31, 34; 31, 35; 31, 36; 31, 37; 31, 38; 33, 39; 34, 40; 36, 41; 37, 42; 38, 43; 3...
def names_to_abbreviations(reporters): """Build a dict mapping names to their variations Something like: { "Atlantic Reporter": ['A.', 'A.2d'], } Note that the abbreviations are sorted by start date. """ names = {} for reporter_key, data_list in reporters.items(): ...
0, module; 1, function_definition; 2, function_name:flatten; 3, parameters; 4, block; 5, identifier:weights; 6, expression_statement; 7, comment:# NOQA; 8, if_statement; 9, return_statement; 10, comment:""" Flatten weights into a long DataFrame. Parameters ---------- weights: pandas.DataFrame or dict ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 8, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 17, 23; 17, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 21, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; ...
def flatten(weights): """ Flatten weights into a long DataFrame. Parameters ---------- weights: pandas.DataFrame or dict A DataFrame of instrument weights with a MultiIndex where the top level contains pandas. Timestamps and the second level is instrument names. The columns ...
0, module; 1, function_definition; 2, function_name:calc_trades; 3, parameters; 4, block; 5, identifier:current_contracts; 6, identifier:desired_holdings; 7, identifier:trade_weights; 8, identifier:prices; 9, identifier:multipliers; 10, dictionary_splat_pattern; 11, expression_statement; 12, if_statement; 13, expressio...
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; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 14, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 17, 34; 17, 35; 17, 36; 18, 37; 19, 38; 20, 39; 21, 40; 22, 41; 25, 42; 26, 43; 27, 44;...
def calc_trades(current_contracts, desired_holdings, trade_weights, prices, multipliers, **kwargs): """ Calculate the number of tradeable contracts for rebalancing from a set of current contract holdings to a set of desired generic notional holdings based on prevailing prices and mapping...
0, module; 1, function_definition; 2, function_name:get_multiplier; 3, parameters; 4, block; 5, identifier:weights; 6, identifier:root_generic_multiplier; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, expression_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 12, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 26,...
def get_multiplier(weights, root_generic_multiplier): """ Determine tradeable instrument multiplier based on generic asset multipliers and weights mapping from generics to tradeables. Parameters ---------- weights: pandas.DataFrame or dict A pandas.DataFrame of loadings of generic contr...
0, module; 1, function_definition; 2, function_name:roller; 3, parameters; 4, block; 5, identifier:timestamps; 6, identifier:contract_dates; 7, identifier:get_weights; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_state...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 13, 28; 16, 29; 17, 30; 18, 31; 19, 32; 20, 33; 20, 34; 20, 35; 21, 36; 22, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; 2...
def roller(timestamps, contract_dates, get_weights, **kwargs): """ Calculate weight allocations to tradeable instruments for generic futures at a set of timestamps for a given root generic. Paramters --------- timestamps: iterable Sorted iterable of of pandas.Timestamps to calculate wei...
0, module; 1, function_definition; 2, function_name:strictly_monotonic; 3, parameters; 4, block; 5, identifier:bb; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# subsequent equal entries have 0 in db; 11, expression_statement; 12, comment:# the first el...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 8, 17; 9, 18; 11, 19; 13, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 24, 35; 24, 36; 25, 37; 25, 38; 28, 39; 28, 40; 30, 41; 30, 42; 32, 43; 32,...
def strictly_monotonic(bb): ''' bb is an index array which may have numerous double or triple occurrences of indices, such as for example the decay_index_pointer. This method removes all entries <= -, then all dublicates and finally returns a sorted list of indices. ''' cc=bb[np.where(bb>=0...
0, module; 1, function_definition; 2, function_name:_sort_shared_logical_disks; 3, parameters; 4, block; 5, identifier:logical_disks; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# Separate logical disks based on share_physical_disks value.; 10, comment:# 'logical_disks_shared' ...
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; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 6, 36; 7, 37; 8, 38; 12, 39; 13, 40; 14, 41; 14, 42; 14, 43; 18, 44; 19, 45; 20, 46;...
def _sort_shared_logical_disks(logical_disks): """Sort the logical disks based on the following conditions. When the share_physical_disks is True make sure we create the volume which needs more disks first. This avoids the situation of insufficient disks for some logical volume request. For exampl...
0, module; 1, function_definition; 2, function_name:get_versions; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:bucket; 7, identifier:key; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:desc; 14, True; 15, comment:"""Fe...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 10, 16; 11, 17; 12, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 26, 37; 27, 38; 27, 39; 29, 40; 29, 41; 30, 42; 30, 43; ...
def get_versions(cls, bucket, key, desc=True): """Fetch all versions of a specific object. :param bucket: The bucket (instance or id) to get the object from. :param key: Key of object. :param desc: Sort results desc if True, asc otherwise. :returns: The query to execute to fetch...
0, module; 1, function_definition; 2, function_name:sort_by; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, comment:# Support sorting by file_ids or keys.; 9, expression_statement; 10, comment:# self.record['_files'] = [{'key': files.get(id_, id_)} for id_ in ids]; 11, 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; 6, 13; 7, 14; 9, 15; 11, 16; 12, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 24, 32; 24, 33; 25, 34; 25, 35; 29, 36; 32, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42; 38, 43; ...
def sort_by(self, *ids): """Update files order. :param ids: List of ids specifying the final status of the list. """ # Support sorting by file_ids or keys. files = {str(f_.file_id): f_.key for f_ in self} # self.record['_files'] = [{'key': files.get(id_, id_)} for id_ in...
0, module; 1, function_definition; 2, function_name:sorted_files_from_bucket; 3, parameters; 4, block; 5, identifier:bucket; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:keys; 14,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 34, 41; 36, 42; 37, 43; 37...
def sorted_files_from_bucket(bucket, keys=None): """Return files from bucket sorted by given keys. :param bucket: :class:`~invenio_files_rest.models.Bucket` containing the files. :param keys: Keys order to be used. :returns: Sorted list of bucket items. """ keys = keys or [] total =...
0, module; 1, function_definition; 2, function_name:sort_data; 3, parameters; 4, block; 5, identifier:x; 6, identifier:y; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Sort the data."""; 12, assignment; 13, assignment; 14, expression_list; 15, identifier...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 10, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 22, 27; 26, 28; 27, 29; 27, 30; 28, 31; 30, 32; 30, 33
def sort_data(x, y): """Sort the data.""" xy = sorted(zip(x, y)) x, y = zip(*xy) return x, y
0, module; 1, function_definition; 2, function_name:unsort_vector; 3, parameters; 4, block; 5, identifier:data; 6, identifier:indices_of_increasing; 7, expression_statement; 8, return_statement; 9, comment:"""Upermutate 1-D data that is sorted by indices_of_increasing."""; 10, call; 11, attribute; 12, argument_list; 13...
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; 15, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 25, 29; 29, 30; 29, 31; 31, 32
def unsort_vector(data, indices_of_increasing): """Upermutate 1-D data that is sorted by indices_of_increasing.""" return numpy.array([data[indices_of_increasing.index(i)] for i in range(len(data))])
0, module; 1, function_definition; 2, function_name:_compute_sorted_indices; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:# save in meaningful variable names; 10, expression_statement; 11, comment:# list (like self.y); 12, expression_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 8, 16; 8, 17; 10, 18; 12, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 22, 31; 23, 32; 23, 33; 24, 34; 25, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 30...
def _compute_sorted_indices(self): """ The smoothers need sorted data. This sorts it from the perspective of each column. if self._x[0][3] is the 9th-smallest value in self._x[0], then _xi_sorted[3] = 8 We only have to sort the data once. """ sorted_indices = [] ...
0, module; 1, function_definition; 2, function_name:specify_data_set; 3, parameters; 4, block; 5, identifier:self; 6, identifier:x_input; 7, identifier:y_input; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, identifier:sort_data; 14, False; 15, c...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 12, 20; 17, 21; 17, 22; 17, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 22, 32; 23, 33; 24, 34; 25, 35; 25, 36; 26, 37; 27, 38; 27, 39; 29, 40; 29, 41; 31, 42; 31, 43; ...
def specify_data_set(self, x_input, y_input, sort_data=False): """ Fully define data by lists of x values and y values. This will sort them by increasing x but remember how to unsort them for providing results. Parameters ---------- x_input : iterable list o...
0, module; 1, function_definition; 2, function_name:_aggregate; 3, parameters; 4, block; 5, identifier:data; 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, if_statement; 15, return_sta...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 10, 24; 10, 25; 11, 26; 12, 27; 12, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 19, 35; 22, 36; 24, 37; 24, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44;...
def _aggregate(data, norm=True, sort_by='value', keys=None): ''' Counts the number of occurances of each item in 'data'. Inputs data: a list of values. norm: normalize the resulting counts (as percent) sort_by: how to sort the retured data. Options are 'value' and 'count'. Output a non...
0, module; 1, function_definition; 2, function_name:list_files; 3, parameters; 4, block; 5, identifier:d; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, identifier:extension; 12, None; 13, string; 14, call; 15, block; 16, else_clause; 17, comparison_operator:e...
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; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 21, 30; 21, 31; 22, 32; 23, 33; 24, 34; 25, 35; 28, 36; 28, 37; 29, 38; 30, 39; 30, 40; 33, 41; 33, 42; 34, 43; 34,...
def list_files(d, extension=None): ''' Lists files in a given directory. Args: d (str): Path to a directory. extension (str): If supplied, only files that contain the specificied extension will be returned. Default is ``False``, which returns all files in ``d``. ...
0, module; 1, function_definition; 2, function_name:get_collections; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, return_statement; 15, identifier:...
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; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 21, 30; 22, 31; 22, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 27, 40; 28, 41; 29, 42; 29, 43; 33, 44...
def get_collections(db, collection=None, prefix=None, suffix=None): ''' Returns a sorted list of collection names found in ``db``. Arguments: db (Database): A pymongo Database object. Can be obtained with ``get_db``. collection (str): Name of a collection. If the collection is...
0, module; 1, function_definition; 2, function_name:leaf_nodes; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# Now contains all nodes that contain dependencies.; 8, expression_statement; 9, comment:# contains all nodes *without* any dependencies (leaf nodes); 10, return_statement; 11...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 8, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 15, 18; 15, 19; 15, 20; 16, 21; 16, 22; 19, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 27, 29; 27, 30; 29, 31; 29, 32
def leaf_nodes(self): """ Return an interable of nodes with no edges pointing at them. This is helpful to find all nodes without dependencies. """ # Now contains all nodes that contain dependencies. deps = {item for sublist in self.edges.values() for item in sublist} ...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, while_statement; 8, comment:""" Return an iterable of nodes, toplogically sorted to correctly import dependencies before leaf nodes. """; 9, attribute; 10, block; 11...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 9, 11; 9, 12; 10, 13; 10, 14; 10, 15; 13, 16; 14, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 19, 28; 20, 29; 21, 30; 24, 31; 24, 32; 26, 33; 27, 34; 28, 35; 30, 36; 33, 37; 33, 38; 34, 39; 34, 40; 35, 41; 36, 42; 36, 4...
def sort(self): """ Return an iterable of nodes, toplogically sorted to correctly import dependencies before leaf nodes. """ while self.nodes: iterated = False for node in self.leaf_nodes(): iterated = True self.prune_node(n...
0, module; 1, function_definition; 2, function_name:cycles; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, function_definition; 8, comment:# First, let's get a iterable of all known cycles.; 9, expression_statement; 10, expression_statement; 11, comment:# Now, let's go through and sift through...
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; 6, 17; 7, 18; 7, 19; 7, 20; 9, 21; 10, 22; 14, 23; 14, 24; 14, 25; 16, 26; 19, 27; 19, 28; 20, 29; 20, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 24, 37; 24, 38; 25, 39; 29, 40; 30, 41; 30, 42; 31, 43; 32, 44...
def cycles(self): """ Fairly expensive cycle detection algorithm. This method will return the shortest unique cycles that were detected. Debug usage may look something like: print("The following cycles were found:") for cycle in network.cycles(): print(" ...
0, module; 1, function_definition; 2, function_name:_prepare_imports; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dicts; 7, expression_statement; 8, comment:# all pseudo parent ids we've seen; 9, expression_statement; 10, comment:# pseudo matches; 11, expression_statement; 12, comment:# get prepared impo...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 7, 30; 9, 31; 11, 32; 13, 33; 15, 34; 15, 35; 15, 36; 17, 37; 19, 38; 19, 39; 19, 40; 19, 41; 21, 42; 22, 43; 23, 44; 24, 45; ...
def _prepare_imports(self, dicts): """ an override for prepare imports that sorts the imports by parent_id dependencies """ # all pseudo parent ids we've seen pseudo_ids = set() # pseudo matches pseudo_matches = {} # get prepared imports from parent prepared = di...
0, module; 1, function_definition; 2, function_name:initial; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, list_splat_pattern; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, assert_statement; 12, if_statement; 13, expression_statement; 14, identifier:args; 1...
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; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 12, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 24, 38; 25, 39; 26, 40; 26, 41; 26, 42; 27, 43; 3...
def initial(self, request, *args, **kwargs): """ Overrides DRF's `initial` in order to set the `_sorting_field` from corresponding property in view. Protected property is required in order to support overriding of `sorting_field` via `@property`, we do this after original `initial` has b...
0, module; 1, function_definition; 2, function_name:prepare_sorting_fields; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, comment:""" Determine sorting direction and sorting field based on request query parameters and sorting options of self ...
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; 8, 14; 8, 15; 10, 16; 10, 17; 12, 18; 13, 19; 13, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 21, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 27, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 36, 42; 36, 43; ...
def prepare_sorting_fields(self): """ Determine sorting direction and sorting field based on request query parameters and sorting options of self """ if self.sorting_parameter_name in self.request.query_params: # Extract sorting parameter from query string ...
0, module; 1, function_definition; 2, function_name:JSONList; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, try_statement; 10, return_statement; 11, identifier:args; 12, identifier:kwargs; 13, comment:"""Stores a list as JSON on databas...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 5, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 14, 18; 14, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 20, 25; 20, 26; 22, 27; 23, 28; 23, 29; 24, 30; 25, 31; 25, 32; 26, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 33, 39; 35, 40; 35, 41; 39, 42; 39, 43; 4...
def JSONList(*args, **kwargs): """Stores a list as JSON on database, with mutability support. If kwargs has a param `unique_sorted` (which evaluated to True), list values are made unique and sorted. """ type_ = JSON try: if kwargs.pop("unique_sorted"): type_ = JSONUniqueList...
0, module; 1, function_definition; 2, function_name:setup_coords; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, try_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 1...
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; 5, 18; 5, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 10, 26; 10, 27; 11, 28; 11, 29; 11, 30; 12, 31; 13, 32; 13, 33; 13, 34; 14, 35; 15, 36; 15, 37; 15, 38; 16, 39; 16, 40; 16, 41; 17, 42; 26, 43; 27, 44; 27...
def setup_coords(arr_names=None, sort=[], dims={}, **kwargs): """ Sets up the arr_names dictionary for the plot Parameters ---------- arr_names: string, list of strings or dictionary Set the unique array names of the resulting arrays and (optionally) dimensions. - if string...
0, module; 1, function_definition; 2, function_name:get_tdata; 3, parameters; 4, block; 5, identifier:t_format; 6, identifier:files; 7, expression_statement; 8, function_definition; 9, import_statement; 10, import_from_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, expression_stat...
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; 7, 21; 8, 22; 8, 23; 8, 24; 9, 25; 10, 26; 10, 27; 11, 28; 12, 29; 12, 30; 12, 31; 13, 32; 14, 33; 15, 34; 15, 35; 15, 36; 16, 37; 18, 38; 19, 39; 20, 40; 23, 41; 24, 42; 25, 43; 26, 44; 27...
def get_tdata(t_format, files): """ Get the time information from file names Parameters ---------- t_format: str The string that can be used to get the time information in the files. Any numeric datetime format string (e.g. %Y, %m, %H) can be used, but not non-numeric string...
0, module; 1, function_definition; 2, function_name:_set_and_filter; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, for_statement; 11, expression_statement; 12, for_statement; 13, expression_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; 6, 17; 7, 18; 8, 19; 9, 20; 9, 21; 9, 22; 10, 23; 10, 24; 10, 25; 11, 26; 12, 27; 12, 28; 12, 29; 13, 30; 14, 31; 15, 32; 16, 33; 18, 34; 18, 35; 19, 36; 19, 37; 21, 38; 21, 39; 22, 40; 23, 41; 23, 42; 24, 43; 24, 44;...
def _set_and_filter(self): """Filters the registered updates and sort out what is not needed This method filters out the formatoptions that have not changed, sets the new value and returns an iterable that is sorted by the priority (highest priority comes first) and dependencies ...
0, module; 1, function_definition; 2, function_name:_sorted_by_priority; 3, parameters; 4, block; 5, identifier:self; 6, identifier:fmtos; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, function_definition; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, exp...
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; 9, 21; 10, 22; 10, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 15, 30; 20, 31; 21, 32; 21, 33; 21, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44...
def _sorted_by_priority(self, fmtos, changed=None): """Sort the formatoption objects by their priority and dependency Parameters ---------- fmtos: list list of :class:`Formatoption` instances changed: list the list of formatoption keys that have changed ...
0, module; 1, function_definition; 2, function_name:sort_kwargs; 3, parameters; 4, block; 5, identifier:kwargs; 6, list_splat_pattern; 7, expression_statement; 8, return_statement; 9, identifier:param_lists; 10, comment:"""Function to sort keyword arguments and sort them into dictionaries This function returns dic...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 11, 12; 11, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 31, 38; 31, 39; 32, 40
def sort_kwargs(kwargs, *param_lists): """Function to sort keyword arguments and sort them into dictionaries This function returns dictionaries that contain the keyword arguments from `kwargs` corresponding given iterables in ``*params`` Parameters ---------- kwargs: dict Original dict...
0, module; 1, function_definition; 2, function_name:iterkeys; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, for_statement; 12, comment:"""Unsorted iterator over keys"""; 13, assignment; 14, assignme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 11, 20; 11, 21; 13, 22; 13, 23; 14, 24; 14, 25; 15, 26; 15, 27; 17, 28; 17, 29; 18, 30; 20, 31; 20, 32; 21, 33; 23, 34; 23, 35; 25, 36; 25, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 30, 43; ...
def iterkeys(self): """Unsorted iterator over keys""" patterns = self.patterns replace = self.replace seen = set() for key in six.iterkeys(self.base): for pattern in patterns: m = pattern.match(key) if m: ret = m.gro...
0, module; 1, function_definition; 2, function_name:keys; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Return sorted list of keys. """; 11, assignment; 12, call; 13, identifier:k; 14, identifi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 15, 18; 15, 19; 16, 20; 16, 21; 19, 22; 22, 23; 22, 24; 23, 25; 23, 26; 24, 27
def keys(self): """ Return sorted list of keys. """ k = list(dict.keys(self)) k.sort() return k
0, module; 1, function_definition; 2, function_name:get_reports_page; 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, comment:# expli...
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; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 13, 35; 15, 36; 15, 37; 15, 38; 16, 39; 16, 40; 17, 41; 18, 42; 19, 43; 21, 44; 35, 45...
def get_reports_page(self, is_enclave=None, enclave_ids=None, tag=None, excluded_tags=None, from_time=None, to_time=None): """ Retrieves a page of reports, filtering by time window, distribution type, enclave association, and tag. The results are sorted by updated time. ...
0, module; 1, function_definition; 2, function_name:hashify_targets; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, identifier:build_context; 8, identifier:list; 9, expression_statement; 10, return_statement; 11, identifier:targets; 12, type; 13, comment:"""Return sorted hashes of `targets`."""; 14, call; 15,...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 6, 11; 6, 12; 9, 13; 10, 14; 12, 15; 14, 16; 14, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 24, 29; 24, 30; 28, 31; 29, 32; 29, 33
def hashify_targets(targets: list, build_context) -> list: """Return sorted hashes of `targets`.""" return sorted(build_context.targets[target_name].hash(build_context) for target_name in listify(targets))
0, module; 1, function_definition; 2, function_name:stable_reverse_topological_sort; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, if_statement; 8, comment:# nonrecursive version; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Return a list of nodes in t...
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; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 18, 26; 18, 27; 19, 28; 19, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 28, 40; 28, 41; 29, 42; 31, 43; ...
def stable_reverse_topological_sort(graph): """Return a list of nodes in topological sort order. This topological sort is a **unique** permutation of the nodes such that an edge from u to v implies that u appears before v in the topological sort order. Parameters ---------- graph : Network...
0, module; 1, function_definition; 2, function_name:walk_target_deps_topological_order; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, identifier:target; 11, type; 12, comment:"""Generate all dependencies of `target` by topologica...
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; 9, 14; 9, 15; 9, 16; 11, 17; 13, 18; 13, 19; 15, 20; 15, 21; 16, 22; 19, 23; 19, 24; 21, 25; 22, 26; 22, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 34, 39; 39, 40; 40, 41; 40, 42; 41, 43; 4...
def walk_target_deps_topological_order(self, target: Target): """Generate all dependencies of `target` by topological sort order.""" all_deps = get_descendants(self.target_graph, target.name) for dep_name in topological_sort(self.target_graph): if dep_name in all_deps: ...
0, module; 1, function_definition; 2, function_name:_print_message; 3, parameters; 4, block; 5, identifier:self; 6, identifier:prefix; 7, identifier:message; 8, default_parameter; 9, expression_statement; 10, comment:# Load up the standard output.; 11, expression_statement; 12, comment:# We have some extra stuff for ve...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 8, 16; 8, 17; 9, 18; 11, 19; 13, 20; 13, 21; 15, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 21, 28; 21, 29; 21, 30; 21, 31; 21, 32; 21, 33; 21, 34; 21, 35; 21, 36; 21, 37; 21, 38; 21, 39; 21, 40; 21, 41; 21, 42; 22, 43; 22,...
def _print_message(self, prefix, message, verbose=True): 'Prints a message and takes care of all sorts of nasty code' # Load up the standard output. output = ['\n', prefix, message['message']] # We have some extra stuff for verbose mode. if verbose: verbose_output =...
0, module; 1, function_definition; 2, function_name:finish; 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, comment:# If we have any items, add them. Items are...
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; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 14, 35; 14, 36; 15, 37; 15, 38; 17, 39; 17, 40; 17, 41; 19, 42; 21, 43; 34, 44; 36, 45...
def finish(self, items=None, sort_methods=None, succeeded=True, update_listing=False, cache_to_disc=True, view_mode=None): '''Adds the provided items to the XBMC interface. :param items: an iterable of items where each item is either a dictionary with keys/values suitable for...
0, module; 1, function_definition; 2, function_name:followingPrefix; 3, parameters; 4, block; 5, identifier:prefix; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, while_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Re...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 9, 18; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 19, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 25, 38; 25, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29,...
def followingPrefix(prefix): """Returns a String that sorts just after all Strings beginning with a prefix""" prefixBytes = array('B', prefix) changeIndex = len(prefixBytes) - 1 while (changeIndex >= 0 and prefixBytes[changeIndex] == 0xff ): changeIndex = changeIndex - 1; ...
0, module; 1, function_definition; 2, function_name:sorted_maybe_numeric; 3, parameters; 4, block; 5, identifier:x; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, comment:""" Sorts x with numeric semantics if all keys are nonnegative integers. Otherwise uses standard string sorting. "...
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; 12, 16; 13, 17; 15, 18; 15, 19; 16, 20; 17, 21; 19, 22; 20, 23; 20, 24; 21, 25; 22, 26; 22, 27; 24, 28; 24, 29; 25, 30; 25, 31; 27, 32; 27, 33; 29, 34; 29, 35; 31, 36; 32, 37; 32, 38
def sorted_maybe_numeric(x): """ Sorts x with numeric semantics if all keys are nonnegative integers. Otherwise uses standard string sorting. """ all_numeric = all(map(str.isdigit, x)) if all_numeric: return sorted(x, key=int) else: return sorted(x)
0, module; 1, function_definition; 2, function_name:sort_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sf; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Determines how to sort search results. Available sorting methods are sort.SCORE, sort.COMMENTS, sort....
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 18, 22; 18, 23; 21, 24; 22, 25; 22, 26; 23, 27; 27, 28; 27, 29
def sort_by(self, sf): """ Determines how to sort search results. Available sorting methods are sort.SCORE, sort.COMMENTS, sort.HEIGHT, sort.RELEVANCE, sort.CREATED_AT, and sort.RANDOM; default is sort.CREATED_AT. """ params = join_params(self.parameters, {"sf": sf}) return self.__class__(*...
0, module; 1, function_definition; 2, function_name:get_contributor_sort_value; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""Generate display name for contributor."""; 12, assignment; 13, boolean_o...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 22, 32; 23, 33; 23, 34; 31, 35; 31, 36; 32, 37; 33, 38; 33, 39; 36, 40; 36, 41; 37, 42; 37, 43; ...
def get_contributor_sort_value(self, obj): """Generate display name for contributor.""" user = obj.contributor if user.first_name or user.last_name: contributor = user.get_full_name() else: contributor = user.username return contributor.strip().lower()
0, module; 1, function_definition; 2, function_name:_gen_cache_key_for_slice; 3, parameters; 4, block; 5, identifier:url_dict; 6, identifier:start_int; 7, identifier:total_int; 8, identifier:authn_subj_list; 9, expression_statement; 10, comment:# logging.debug('Gen key. result_record_count={}'.format(result_record_coun...
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; 11, 18; 12, 19; 13, 20; 14, 21; 15, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29...
def _gen_cache_key_for_slice(url_dict, start_int, total_int, authn_subj_list): """Generate cache key for the REST URL the client is currently accessing or is expected to access in order to get the slice starting at the given ``start_int`` of a multi-slice result set. When used for finding the key to ch...
0, module; 1, function_definition; 2, function_name:normalize; 3, parameters; 4, block; 5, identifier:rp_pyxb; 6, expression_statement; 7, comment:# noinspection PyMissingOrEmptyDocstring; 8, function_definition; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""Normalize a Rep...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 8, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 25, 33; 25, 34; 27, 35; 27, 36; 28, 37; 28, 38; 31, 39; 31, 40; 32, 41; 32, 42; 34, 43; 3...
def normalize(rp_pyxb): """Normalize a ReplicationPolicy PyXB type in place. The preferred and blocked lists are sorted alphabetically. As blocked nodes override preferred nodes, and any node present in both lists is removed from the preferred list. Args: rp_pyxb : ReplicationPolicy PyXB obj...
0, module; 1, function_definition; 2, function_name:normalize; 3, parameters; 4, block; 5, identifier:body_part_tup; 6, expression_statement; 7, return_statement; 8, comment:"""Normalize a tuple of BodyPart objects to a string. Normalization is done by sorting the body_parts by the Content- Disposition headers, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 12, 15; 14, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 20, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 24, 30; 26, 31; 26, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 36, 41; 36, 42; 39, ...
def normalize(body_part_tup,): """Normalize a tuple of BodyPart objects to a string. Normalization is done by sorting the body_parts by the Content- Disposition headers, which is typically on the form, ``form-data; name="name_of_part``. """ return '\n\n'.join( [ '{}\n\n{}'.form...
0, module; 1, function_definition; 2, function_name:save_json; 3, parameters; 4, block; 5, identifier:py_obj; 6, identifier:json_path; 7, expression_statement; 8, with_statement; 9, comment:"""Serialize a native object to JSON and save it normalized, pretty printed to a file. The JSON string is normalized by s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 10, 12; 11, 13; 12, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 19, 25; 21, 26; 21, 27; 21, 28; 25, 29; 25, 30; 27, 31; 28, 32; 28, 33; 30, 34; 33, 35
def save_json(py_obj, json_path): """Serialize a native object to JSON and save it normalized, pretty printed to a file. The JSON string is normalized by sorting any dictionary keys. Args: py_obj: object Any object that can be represented in JSON. Some types, such as datetimes are ...