nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:get_entries; 3, parameters; 4, block; 5, identifier:self; 6, identifier:chemsys_formula_id_criteria; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# TODO: This is a...
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; 4, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 15, 38; 16, 39; 17, 40; 17, 41; 18, 42; 18, 43; 19, 44; 19, 45; 2...
def get_entries(self, chemsys_formula_id_criteria, compatible_only=True, inc_structure=None, property_data=None, conventional_unit_cell=False, sort_by_e_above_hull=False): """ Get a list of ComputedEntries or ComputedStructureEntries corresponding to a che...
0, module; 1, function_definition; 2, function_name:aos_as_list; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, string; 9, call; 10, string_content:Returns a list of atomic orbitals, sorted from lowest to highest energy; 11, identifier:sorted; 12, argument_list; 13, call; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 8, 10; 9, 11; 9, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 18, 22; 18, 23; 21, 24; 21, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 29, 33; 29, 34; 30, 35; 30, 36; 32, 37; 32, 38; 33, 39; 33, 40; 36, 41; 41, 42; 41, 4...
def aos_as_list(self): ''' Returns a list of atomic orbitals, sorted from lowest to highest energy ''' return sorted(chain.from_iterable( [self.aos[el] * int(self.composition[el]) for el in self.elements] ), key=lambda x: x[2])
0, module; 1, function_definition; 2, function_name:get_dataframe; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, import_statement; 10, expression_statement; 11, for_statement; 12, comment:# Monkey patch; 13, expression_statement; 14, expressi...
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; 6, 21; 6, 22; 7, 23; 8, 24; 9, 25; 10, 26; 11, 27; 11, 28; 11, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 18, 35; 19, 36; 20, 37; 25, 38; 25, 39; 26, 40; 26, 41; 28, 42; 28, 43; 29, 44; 30...
def get_dataframe(self, sort_key="wall_time", **kwargs): """ Return a pandas DataFrame with entries sorted according to `sort_key`. """ import pandas as pd frame = pd.DataFrame(columns=AbinitTimerSection.FIELDS) for osect in self.order_sections(sort_key): fra...
0, module; 1, function_definition; 2, function_name:order_sections; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:reverse; 12, True; 13, comment:"""Sort sections according to the value of key."...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 17, 21; 19, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 26, 34; 26, 35
def order_sections(self, key, reverse=True): """Sort sections according to the value of key.""" fsort = lambda s: s.__dict__[key] return sorted(self.sections, key=fsort, reverse=reverse)
0, module; 1, function_definition; 2, function_name:sort_dict; 3, parameters; 4, block; 5, identifier:d; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# Sort kv_items according to key.; 11, if_statement; 12, comment:# Build ordered dict.; 13, return_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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 11, 20; 11, 21; 11, 22; 13, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 23, 30; 23, 31; 25, 32; 25, 33; 28, 34; 29, 35; 30, 36; 30, 37; 31, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 40, ...
def sort_dict(d, key=None, reverse=False): """ Sorts a dict by value. Args: d: Input dictionary key: Function which takes an tuple (key, object) and returns a value to compare and sort by. By default, the function compares the values of the dict i.e. key = lambda t :...
0, module; 1, function_definition; 2, function_name:sort_by_efficiency; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, identifier:reverse; 11, True; 12, comment:"""Sort the configurations in place. items with highest efficien...
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; 13, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 27, 29; 28, 30; 28, 31
def sort_by_efficiency(self, reverse=True): """Sort the configurations in place. items with highest efficiency come first""" self._confs.sort(key=lambda c: c.efficiency, reverse=reverse) return self
0, module; 1, function_definition; 2, function_name:sort_by_speedup; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, identifier:reverse; 11, True; 12, comment:"""Sort the configurations in place. items with highest speedup com...
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; 13, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 27, 29; 28, 30; 28, 31
def sort_by_speedup(self, reverse=True): """Sort the configurations in place. items with highest speedup come first""" self._confs.sort(key=lambda c: c.speedup, reverse=reverse) return self
0, module; 1, function_definition; 2, function_name:sort_by_mem_per_proc; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# Avoid sorting if mem_per_cpu is not available.; 9, if_statement; 10, return_statement; 11, identifier:reverse; 12, False; 13, comment:"""Sort...
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; 9, 14; 9, 15; 10, 16; 14, 17; 14, 18; 15, 19; 18, 20; 18, 21; 19, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 27, 31; 27, 32; 28, 33; 28, 34; 31, 35; 31, 36; 33, 37; 33, 38; 34, 39; 34, 40; 38, 41; 38, 42; 41, 43; ...
def sort_by_mem_per_proc(self, reverse=False): """Sort the configurations in place. items with lowest memory per proc come first.""" # Avoid sorting if mem_per_cpu is not available. if any(c.mem_per_proc > 0.0 for c in self): self._confs.sort(key=lambda c: c.mem_per_proc, reverse=rev...
0, module; 1, function_definition; 2, function_name:add_cohp_dict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:cohp_dict; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, for_statement; 11, identifier:key_sort_func; 12, None; 13, comment:""" Adds a dictionary of COHPs with an o...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 10, 18; 10, 19; 15, 20; 16, 21; 19, 22; 20, 23; 21, 24; 22, 25; 23, 26; 23, 27; 24, 28; 25, 29; 25, 30; 27, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 38, 43; 3...
def add_cohp_dict(self, cohp_dict, key_sort_func=None): """ Adds a dictionary of COHPs with an optional sorting function for the keys. Args: cohp_dict: dict of the form {label: Cohp} key_sort_func: function used to sort the cohp_dict keys. """ if...
0, module; 1, function_definition; 2, function_name:get_line_in_facet; 3, parameters; 4, block; 5, identifier:self; 6, identifier:facet; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, while_statement; 12, return_statement; 13, comment:""" Returns the sor...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 18, 32; 18, 33; 21, 34; 21, 35; 26, 36; 26, 37; 28, 38; 28, 39; 28, 40; 31, 41; 32, 42; 33, 43; ...
def get_line_in_facet(self, facet): """ Returns the sorted pts in a facet used to draw a line """ lines = list(facet.outer_lines) pt = [] prev = None while len(lines) > 0: if prev is None: l = lines.pop(0) else: ...
0, module; 1, function_definition; 2, function_name:get_classical_addresses_from_program; 3, parameters; 4, type; 5, block; 6, identifier:program; 7, generic_type; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Required to use the `classical_reg.address` int attribute.; 12, co...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 7, 17; 7, 18; 8, 19; 9, 20; 10, 21; 13, 22; 13, 23; 13, 24; 15, 25; 15, 26; 15, 27; 16, 28; 18, 29; 18, 30; 20, 31; 20, 32; 20, 33; 21, 34; 21, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 27, 43; 29, 4...
def get_classical_addresses_from_program(program) -> Dict[str, List[int]]: """ Returns a sorted list of classical addresses found in the MEASURE instructions in the program. :param Program program: The program from which to get the classical addresses. :return: A mapping from memory region names to lis...
0, module; 1, function_definition; 2, function_name:percolate_declares; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, identifier:Program; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 6, 15; 6, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 12, 23; 13, 24; 14, 25; 16, 26; 18, 27; 18, 28; 19, 29; 19, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 31, 42; 33, 43; 33,...
def percolate_declares(program: Program) -> Program: """ Move all the DECLARE statements to the top of the program. Return a fresh obejct. :param program: Perhaps jumbled program. :return: Program with DECLAREs all at the top and otherwise the same sorted contents. """ declare_program = Program...
0, module; 1, function_definition; 2, function_name:text_search; 3, parameters; 4, block; 5, identifier:conn; 6, identifier:search; 7, keyword_separator; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 4, 14; 4, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 15, 29; 17, 30; 29, 31; 29, 32; 32, 33; 33, 34; 33, 35; 34, 36; 35, 37
def text_search(conn, search, *, language='english', case_sensitive=False, diacritic_sensitive=False, text_score=False, limit=0, table=None): """Return all the assets that match the text search. The results are sorted by text score. For more information about the behavior of text search on ...
0, module; 1, function_definition; 2, function_name:get_utxoset_merkle_root; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# TODO Once ready, use the already pre-computed utxo_hash field.; 9, comment:# See common/transactions.py for details.; 10, 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; 7, 14; 10, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 23, 28; 23, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 30, 39; 30, 40; 31, 41; 31, 42; 36, 43;...
def get_utxoset_merkle_root(self): """Returns the merkle root of the utxoset. This implies that the utxoset is first put into a merkle tree. For now, the merkle tree and its root will be computed each time. This obviously is not efficient and a better approach that limits the re...
0, module; 1, function_definition; 2, function_name:log_time; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, generic_type; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:func; 12, type; 13, identifier:Callable; 14, type_parameter; 15, comment:"""Log the time it takes to ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 12, 20; 14, 21; 14, 22; 17, 23; 17, 24; 18, 25; 18, 26; 18, 27; 18, 28; 18, 29; 20, 30; 20, 31; 21, 32; 22, 33; 23, 34; 24, 35; 25, 36; 26, 37; 27, 38; 28, 39; 29, 40; 31, 41; 31, 42; 36, 43; 36,...
def log_time(func: Callable[..., Any]) -> Callable[..., Any]: """Log the time it takes to run a function. It's sort of like timeit, but prettier. """ def wrapper(*args, **kwargs): start_time = time.time() log.info("%s starting...", func.__name__.title()) ret = func(*args, **kwar...
0, module; 1, function_definition; 2, function_name:_get_mro; 3, parameters; 4, block; 5, identifier:cls; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:""" Returns the bases classes for cls sorted by the MRO. Works around an issue on Jython where inspect.getmro will not return all ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 10, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 26, 28; 27, 29; 27, 30
def _get_mro(cls): """ Returns the bases classes for cls sorted by the MRO. Works around an issue on Jython where inspect.getmro will not return all base classes if multiple classes share the same name. Instead, this function will return a tuple containing the class itself, and the contents of ...
0, module; 1, function_definition; 2, function_name:sorted_walk; 3, parameters; 4, block; 5, identifier:dir; 6, expression_statement; 7, for_statement; 8, comment:"""Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order """; 9, pattern_list; 10, call; 11, block; 12, identifie...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 9, 12; 9, 13; 9, 14; 10, 15; 10, 16; 11, 17; 11, 18; 11, 19; 15, 20; 15, 21; 16, 22; 17, 23; 18, 24; 19, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 28, 33; 28, 34; 30, 35; 30, 36; 30, 37
def sorted_walk(dir): """Do os.walk in a reproducible way, independent of indeterministic filesystem readdir order """ for base, dirs, files in os.walk(dir): dirs.sort() files.sort() yield base, dirs, files
0, module; 1, function_definition; 2, function_name:_get_all_ns_packages; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Return sorted list of all package namespaces"""; 10, assignment; 11, call; 12, identifier:pkgs; 13, boolean_operator...
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; 15, 18; 16, 19; 16, 20; 18, 21; 18, 22; 19, 23; 19, 24; 22, 25; 25, 26; 25, 27; 27, 28; 27, 29; 28, 30; 28, 31
def _get_all_ns_packages(self): """Return sorted list of all package namespaces""" pkgs = self.distribution.namespace_packages or [] return sorted(flatten(map(self._pkg_names, pkgs)))
0, module; 1, function_definition; 2, function_name:flatten_comments; 3, parameters; 4, block; 5, identifier:comments; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, while_statement; 12, return_statement; 13, identifier:root_level; 14, integer:0; ...
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; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 16, 24; 16, 25; 19, 26; 20, 27; 20, 28; 22, 29; 22, 30; 22, 31; 22, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 22, 39; 22, 40; 25, 41; 25, 42; 26, 43; 27, ...
def flatten_comments(comments, root_level=0): """ Flatten a PRAW comment tree while preserving the nested level of each comment via the `nested_level` attribute. There are a couple of different ways that the input comment list can be organized depending on its source: ...
0, module; 1, function_definition; 2, function_name:get_domain_listing; 3, parameters; 4, block; 5, identifier:self; 6, identifier:domain; 7, default_parameter; 8, default_parameter; 9, list_splat_pattern; 10, dictionary_splat_pattern; 11, expression_statement; 12, comment:# Verify arguments; 13, if_statement; 14, if_s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 17, 34; 17, 35; 18, 36; 18, 37; 18, 38; 19, 39; 21, 40; 27, 41; 27, 42; 28, 43; 29, 44; 2...
def get_domain_listing(self, domain, sort='hot', period=None, *args, **kwargs): """Return a get_content generator for submissions by domain. Corresponds to the submissions provided by ``https://www.reddit.com/domain/{domain}``. :param domain: The domain to ge...
0, module; 1, function_definition; 2, function_name:get_submission; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, return_statement; 15, identifi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 13, 28; 13, 29; 14, 30; 26, 31; 26, 32; 27, 33; 29, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 34, 42; 35, 43; 35, 44;...
def get_submission(self, url=None, submission_id=None, comment_limit=0, comment_sort=None, params=None): """Return a Submission object for the given url or submission_id. :param comment_limit: The desired number of comments to fetch. If <= 0 fetch the default number f...
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, list_splat_pattern; 12, dictionary_splat_pattern; 13, expression_statement; 14, expression_statement;...
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; 4, 21; 4, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 12, 32; 13, 33; 14, 34; 15, 35; 15, 36; 16, 37; 16, 38; 17, 39; 17, 40; 18, 41; 18, 42; 19, 43; 19, 44; 19, 4...
def search(self, query, subreddit=None, sort=None, syntax=None, period=None, *args, **kwargs): """Return a generator for submissions that match the search query. :param query: The query string to search for. If query is a URL only submissions which link to that URL will be re...
0, module; 1, function_definition; 2, function_name:_get_sorter; 3, parameters; 4, block; 5, default_parameter; 6, dictionary_splat_pattern; 7, expression_statement; 8, decorated_definition; 9, return_statement; 10, identifier:subpath; 11, string; 12, identifier:defaults; 13, comment:"""Return function to generate spec...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 5, 10; 5, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 14, 17; 15, 18; 15, 19; 15, 20; 17, 21; 17, 22; 19, 23; 19, 24; 19, 25; 20, 26; 20, 27; 20, 28; 20, 29; 20, 30; 20, 31; 22, 32; 24, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 28, 40; 29, 41; 31, 42; 32, 43; 3...
def _get_sorter(subpath='', **defaults): """Return function to generate specific subreddit Submission listings.""" @restrict_access(scope='read') def _sorted(self, *args, **kwargs): """Return a get_content generator for some RedditContentObject type. The additional parameters are passed dir...
0, module; 1, function_definition; 2, function_name:_draw_banner; 3, parameters; 4, block; 5, identifier:self; 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, e...
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; 6, 19; 7, 20; 8, 21; 9, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 17, 30; 17, 31; 18, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 44;...
def _draw_banner(self): """ Draw the banner with sorting options at the top of the page """ n_rows, n_cols = self.term.stdscr.getmaxyx() window = self.term.stdscr.derwin(1, n_cols, self._row, 0) window.erase() window.bkgd(str(' '), self.term.attr('OrderBar')) ...
0, module; 1, function_definition; 2, function_name:from_url; 3, parameters; 4, block; 5, identifier:reddit_session; 6, identifier:url; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 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; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 7, 28; 7, 29; 8, 30; 8, 31; 9, 32; 9, 33; 10, 34; 10, 35; 11, 36; 12, 37; 12, 38; 13, 39; 14, 40; 15, 41; 16, 42; 17, 43; 18, 44; 18, 45; 18...
def from_url(reddit_session, url, comment_limit=0, comment_sort=None, comments_only=False, params=None): """Request the url and return a Submission object. :param reddit_session: The session to make the request with. :param url: The url to build the Submission object from. ...
0, module; 1, function_definition; 2, function_name:set_suggested_sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:sort; 12, string; 13, comment:"""Set 'Suggested Sort' for the comment...
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; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 31, 41; 31, 42; 32, 43; ...
def set_suggested_sort(self, sort='blank'): """Set 'Suggested Sort' for the comments of the submission. Comments can be sorted in one of (confidence, top, new, hot, controversial, old, random, qa, blank). :returns: The json response from the server. """ url = self.redd...
0, module; 1, function_definition; 2, function_name:is_jump_back; 3, parameters; 4, block; 5, identifier:self; 6, identifier:offset; 7, identifier:extended_arg; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:""" Return True if the code at offset is some sort of jump back. Th...
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; 10, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 22, 29; 22, 30; 25, 31; 25, 32; 26, 33; 26, 34
def is_jump_back(self, offset, extended_arg): """ Return True if the code at offset is some sort of jump back. That is, it is ether "JUMP_FORWARD" or an absolute jump that goes forward. """ if self.code[offset] != self.opc.JUMP_ABSOLUTE: return False r...
0, module; 1, function_definition; 2, function_name:is_jump_forward; 3, parameters; 4, block; 5, identifier:self; 6, identifier:offset; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:""" Return True if the code at offset is some sort of jum...
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; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 18, 28; 20, 29; 20, 30; 22, 31; 23, 32; 25, 33; 26, 34; 28, 35; 28, 36; 29, 37; 29, 38; 35, 39; 35, 40; 36, 41; 37, 42; 37, 43; ...
def is_jump_forward(self, offset): """ Return True if the code at offset is some sort of jump forward. That is, it is ether "JUMP_FORWARD" or an absolute jump that goes forward. """ opname = self.get_inst(offset).opname if opname == 'JUMP_FORWARD': ret...
0, module; 1, function_definition; 2, function_name:show_grid; 3, parameters; 4, block; 5, identifier:data_frame; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_sta...
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; 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; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 15, 42; 16, 43; 16, 44; 16, 45; ...
def show_grid(data_frame, show_toolbar=None, precision=None, grid_options=None, column_options=None, column_definitions=None, row_edit_callback=None): """ Renders a DataFrame or Series as an interactive qgrid, represented by ...
0, module; 1, function_definition; 2, function_name:_eigsorted; 3, parameters; 4, block; 5, identifier:cov; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:asc; 13, True; 14, comment:""" Computes eigenvalues and ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 28, 40; 31, 41; 31, 42; 32, 43; 3...
def _eigsorted(cov, asc=True): """ Computes eigenvalues and eigenvectors of a covariance matrix and returns them sorted by eigenvalue. Parameters ---------- cov : ndarray covariance matrix asc : bool, default=True determines whether we are sorted smallest to largest (asc=Tr...
0, module; 1, function_definition; 2, function_name:sort_args; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Put flags at the end"""; 12, assignment; 13, assignment; 14, identifier:i; 15, ide...
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; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 16, 22; 17, 23; 17, 24; 19, 25; 19, 26; 21, 27; 21, 28; 21, 29; 22, 30; 25, 31; 25, 32; 28, 33; 28, 34; 29, 35; 30, 36; 30, 37; 35, 38; 35, 39; 36, 40; 36, 41; 37, 42; 38, 43; 3...
def sort_args(args): """Put flags at the end""" args = args.copy() flags = [i for i in args if FLAGS_RE.match(i[1])] for i in flags: args.remove(i) return args + flags
0, module; 1, function_definition; 2, function_name:plot_fracs; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, import_from_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_statement; 15, e...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 6, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 10, 31; 10, 32; 11, 33; 12, 34; 13, 35; 13, 36; 14, 37; 14, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 20, 44; 21, 45;...
def plot_fracs(self, Q=None, ax=None, fignum=None): """ Plot fractions of Eigenvalues sorted in descending order. """ from ..plotting import Tango Tango.reset() col = Tango.nextMedium() if ax is None: fig = pylab.figure(fignum) ax = fig.add...
0, module; 1, function_definition; 2, function_name:_distance_squared; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, generic_type; 9, expression_statement; 10, return_statement; 11, identifier:p2; 12, type; 13, identifier:Union; 14, type_parameter; 15, comment:""" Function used to not tak...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 12, 17; 14, 18; 14, 19; 16, 20; 16, 21; 18, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 24, 28; 26, 29; 28, 30; 28, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41
def _distance_squared(self, p2: "Point2") -> Union[int, float]: """ Function used to not take the square root as the distances will stay proportionally the same. This is to speed up the sorting process. """ return (self[0] - p2[0]) ** 2 + (self[1] - p2[1]) ** 2
0, module; 1, function_definition; 2, function_name:get_next_of_type; 3, parameters; 4, block; 5, identifier:self; 6, identifier:processor_type; 7, expression_statement; 8, with_statement; 9, comment:"""Get the next available processor of a particular type and increment its occupancy counter. Args: ...
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; 11, 14; 11, 15; 11, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 28, 34; 29, 35; 31, 36; 32, 37; 32, 38; 34, 39; 34, 40; 35, 41; 35, 42; 36, ...
def get_next_of_type(self, processor_type): """Get the next available processor of a particular type and increment its occupancy counter. Args: processor_type (ProcessorType): The processor type associated with a zmq identity. Returns: (Processor...
0, module; 1, function_definition; 2, function_name:wait_for_registration; 3, parameters; 4, block; 5, identifier:self; 6, identifier:processor_type; 7, expression_statement; 8, with_statement; 9, comment:"""Waits for a particular processor type to register or until is_cancelled is True. is_cancelled cannot be ...
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; 11, 14; 12, 15; 13, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 21, 26; 21, 27; 22, 28; 23, 29; 23, 30; 25, 31; 26, 32; 26, 33; 28, 34; 29, 35; 29, 36; 31, 37; 31, 38; 34, 39; 39, 40; 39, 41; 40, 42; 40, ...
def wait_for_registration(self, processor_type): """Waits for a particular processor type to register or until is_cancelled is True. is_cancelled cannot be part of this class since we aren't cancelling all waiting for a processor_type, but just this particular wait. Args: ...
0, module; 1, function_definition; 2, function_name:wait_for_vacancy; 3, parameters; 4, block; 5, identifier:self; 6, identifier:processor_type; 7, expression_statement; 8, with_statement; 9, comment:"""Waits for a particular processor type to have the capacity to handle additional transactions or until is_canc...
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; 11, 14; 11, 15; 11, 16; 12, 17; 13, 18; 14, 19; 14, 20; 15, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 21, 30; 21, 31; 25, 32; 25, 33; 26, 34; 27, 35; 27, 36; 29, 37; 31, 38; 31, 39; 32, 40; 32, 41; 34, 42; 35, ...
def wait_for_vacancy(self, processor_type): """Waits for a particular processor type to have the capacity to handle additional transactions or until is_cancelled is True. Args: processor_type (ProcessorType): The family, and version of the transaction processor. ...
0, module; 1, function_definition; 2, function_name:_get_sorting_message; 3, parameters; 4, block; 5, identifier:request; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""Parses the reverse query into a...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 20, 32; 20, 33; 25, 34; 25, 35; 28, 36; 29, 37; 29, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; ...
def _get_sorting_message(request, key): """Parses the reverse query into a list of ClientSortControls protobuf messages. """ control_list = [] reverse = request.url.query.get('reverse', None) if reverse is None: return control_list if reverse.lower() ...
0, module; 1, function_definition; 2, function_name:sort_resources; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:request; 7, identifier:resources; 8, identifier:fail_enum; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, function_definition; 14, return_stateme...
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; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 18, 25; 19, 26; 20, 27; 20, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 28, 38; 28, 39; 31, 40; 31, 41; 31, 42; 32, 43; 3...
def sort_resources(cls, request, resources, fail_enum, header_proto=None): """Sorts a list of resources based on a list of sort controls Args: request (object): The parsed protobuf request object resources (list of objects): The resources to be sorted fail_enum (int,...
0, module; 1, function_definition; 2, function_name:_get_handler_set; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:request; 7, identifier:fail_enum; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, identifier:hea...
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; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 21, 30; 24, 31; 24, 32; 29, 33; 30, 34; 30, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 37, 42; 37, 43; 4...
def _get_handler_set(cls, request, fail_enum, header_proto=None): """Goes through the list of ClientSortControls and returns a list of unique _ValueHandlers. Maintains order, but drops ClientSortControls that have already appeared to help prevent spamming. """ added = set() ...
0, module; 1, function_definition; 2, function_name:find_write_predecessors; 3, parameters; 4, block; 5, identifier:self; 6, identifier:address; 7, expression_statement; 8, comment:# A write operation must be preceded by:; 9, comment:# - The "enclosing writer", which is the writer at the address or; 10, comment:# ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 4, 40; 4, 41; 4, 42; 4, 43; 4, 44; 4, 45; 4, 46; 7, 47; ...
def find_write_predecessors(self, address): """Returns all predecessor transaction ids for a write of the provided address. Arguments: address (str): the radix address Returns: a set of transaction ids """ # A write operation must be preceded by: # ...
0, module; 1, function_definition; 2, function_name:_get_efron_values_single; 3, parameters; 4, block; 5, identifier:self; 6, identifier:X; 7, identifier:T; 8, identifier:E; 9, identifier:weights; 10, identifier:beta; 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; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 11, 28; 12, 29; 13, 30; 14, 31; 15, 32; 17, 33; 18, 34; 19, 35; 20, 36; 22, 37; 23, 38; 24, 39; 26, 40; 26, 41; 26, 42; 26, 43; 27, 44; 29, ...
def _get_efron_values_single(self, X, T, E, weights, beta): """ Calculates the first and second order vector differentials, with respect to beta. Note that X, T, E are assumed to be sorted on T! A good explanation for Efron. Consider three of five subjects who fail at the time. ...
0, module; 1, function_definition; 2, function_name:_get_efron_values_batch; 3, parameters; 4, comment:# pylint: disable=too-many-locals; 5, block; 6, identifier:self; 7, identifier:X; 8, identifier:T; 9, identifier:E; 10, identifier:weights; 11, identifier:beta; 12, expression_statement; 13, expression_statement; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 5, 20; 5, 21; 5, 22; 5, 23; 5, 24; 5, 25; 5, 26; 5, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 19, 33; 20, 34; 21, 35; 23, 36; 24, 37; 25, 38; 26, 39; 26, 40; 26, 41; 27, 42; 29, 43; 29, 44; 30, ...
def _get_efron_values_batch(self, X, T, E, weights, beta): # pylint: disable=too-many-locals """ Assumes sorted on ascending on T Calculates the first and second order vector differentials, with respect to beta. A good explanation for how Efron handles ties. Consider three of five subj...
0, module; 1, function_definition; 2, function_name:_treeify; 3, parameters; 4, block; 5, identifier:values; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, comment:# Tree indices work as follows:; 10, comment:# 0 is the root; 11, comment:# 2n+1 is the left child of n; 12, comment:# 2n+2 is the ri...
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; 6, 27; 7, 28; 7, 29; 7, 30; 8, 31; 15, 32; 16, 33; 17, 34; 17, 35; 22, 36; 23, 37; 24, 38; 25, 39; 25, 40; 26, 41; 28, 42; 28, 43; 30, 44; 31, 45; ...
def _treeify(values): """Convert the np.ndarray `values` into a complete balanced tree. Assumes `values` is sorted ascending. Returns a list `t` of the same length in which t[i] > t[2i+1] and t[i] < t[2i+2] for all i.""" if len(values) == 1: # this case causes problems later ...
0, module; 1, function_definition; 2, function_name:nearest_neighbors; 3, parameters; 4, block; 5, identifier:self; 6, identifier:word; 7, default_parameter; 8, expression_statement; 9, comment:#TODO(rmyeid): Use scikit ball tree, if scikit is available; 10, expression_statement; 11, expression_statement; 12, expressio...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 10, 18; 11, 19; 12, 20; 13, 21; 14, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 43; 32...
def nearest_neighbors(self, word, top_k=10): """Return the nearest k words to the given `word`. Args: word (string): single word. top_k (integer): decides how many neighbors to report. Returns: A list of words sorted by the distances. The closest is the first. Note: L2 metric ...
0, module; 1, function_definition; 2, function_name:find_range; 3, parameters; 4, block; 5, identifier:values; 6, default_parameter; 7, expression_statement; 8, try_statement; 9, identifier:soft_range; 10, list; 11, comment:""" Safely finds either the numerical min and max of a set of values, falling back to th...
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; 12, 14; 12, 15; 12, 16; 12, 17; 12, 18; 13, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 24, 35; 24, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 29, 42; 29, 43...
def find_range(values, soft_range=[]): """ Safely finds either the numerical min and max of a set of values, falling back to the first and the last value in the sorted list of values. """ try: values = np.array(values) values = np.squeeze(values) if len(values.shape) > 1 else val...
0, module; 1, function_definition; 2, function_name:dimension_sort; 3, parameters; 4, block; 5, identifier:odict; 6, identifier:kdims; 7, identifier:vdims; 8, identifier:key_index; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expres...
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; 13, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 16, 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; 25, 42; 26, 43; 26...
def dimension_sort(odict, kdims, vdims, key_index): """ Sorts data by key using usual Python tuple sorting semantics or sorts in categorical order for any categorical Dimensions. """ sortkws = {} ndims = len(kdims) dimensions = kdims+vdims indexes = [(dimensions[i], int(i not in range(nd...
0, module; 1, function_definition; 2, function_name:sort_topologically; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, function_definition; 11, for_statement; 12, return_statement; 13, comment:""" Stackless topolog...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 11, 23; 11, 24; 12, 25; 14, 26; 14, 27; 15, 28; 15, 29; 17, 30; 17, 31; 18, 32; 18, 33; 20, 34; 21, 35; 21, 36; 24, 37; 25, 38; 25, 39; 29, 40; 29, 41; 32, 42; 33, 43; 35,...
def sort_topologically(graph): """ Stackless topological sorting. graph = { 3: [1], 5: [3], 4: [2], 6: [4], } sort_topologically(graph) [[1, 2], [3, 4], [5, 6]] """ levels_by_name = {} names_by_level = defaultdict(list) def add_level_to_name(nam...
0, module; 1, function_definition; 2, function_name:layer_sort; 3, parameters; 4, block; 5, identifier:hmap; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Find a global ordering for layers in a HoloMap of CompositeOverlay types. """; 11, assignment; 12...
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; 14, 18; 14, 19; 15, 20; 15, 21; 15, 22; 18, 23; 19, 24; 19, 25; 19, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; ...
def layer_sort(hmap): """ Find a global ordering for layers in a HoloMap of CompositeOverlay types. """ orderings = {} for o in hmap: okeys = [get_overlay_spec(o, k, v) for k, v in o.data.items()] if len(okeys) == 1 and not okeys[0] in orderings: orderings[okeys[0]] = [] els...
0, module; 1, function_definition; 2, function_name:arglexsort; 3, parameters; 4, block; 5, identifier:arrays; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Returns the indices of the lexicographical sorting order of the suppli...
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; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 19, 29; 19, 30; 21, 31; 21, 32; 25, 33; 26, 34; 27, 35; 27, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 43; 3...
def arglexsort(arrays): """ Returns the indices of the lexicographical sorting order of the supplied arrays. """ dtypes = ','.join(array.dtype.str for array in arrays) recarray = np.empty(len(arrays[0]), dtype=dtypes) for i, array in enumerate(arrays): recarray['f%s' % i] = array ...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, identifier:by; 13, None; 14, identifier:reverse; 15, False; 16, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 11, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 24, 31; 25, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; 34, ...
def sort(self, by=None, reverse=False): """ Sorts the data by the values along the supplied dimensions. Args: by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order Returns: Sorted Dataset """ if by is None: ...
0, module; 1, function_definition; 2, function_name:glyph_order; 3, parameters; 4, block; 5, identifier:keys; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:draw_order; 12, list; 13, comment:""" Orders a set of glyph handles using...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 14, 19; 14, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 22, 28; 23, 29; 25, 30; 25, 31; 27, 32; 28, 33; 28, 34; 29, 35; 31, 36; 31, 37; 34, 38; 34, 39; 34, 40; 35, 41; 35, 42; 35, 43; 39...
def glyph_order(keys, draw_order=[]): """ Orders a set of glyph handles using regular sort and an explicit sort order. The explicit draw order must take the form of a list of glyph names while the keys should be glyph names with a custom suffix. The draw order may only match subset of the keys and a...
0, module; 1, function_definition; 2, function_name:_get_coords; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Determine global orderings of y-values using topological sort; 12, expressio...
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; 7, 18; 8, 19; 9, 20; 10, 21; 12, 22; 13, 23; 14, 24; 15, 25; 15, 26; 15, 27; 16, 28; 16, 29; 16, 30; 17, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 27, 4...
def _get_coords(self, obj): """ Get the coordinates of the 2D aggregate, maintaining the correct sorting order. """ xdim, ydim = obj.dimensions(label=True)[:2] xcoords = obj.dimension_values(xdim, False) ycoords = obj.dimension_values(ydim, False) # Deter...
0, module; 1, function_definition; 2, function_name:most_frequent_terms; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# sort terms by number of occurrences in descending order; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, identifier:c...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 27, 35; 28, 36; 28, 37; 29, 38; 30, 39; 32, 40; 32, 41; 34, 42; 34, 43; ...
def most_frequent_terms(self, count=0): """ Returns ``count`` of terms sorted by their frequency in descending order. :parameter int count: Max. number of returned terms. Value 0 means no limit (default). """ # sort terms by number of occurrences in descendin...
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, identifier:ascending; 10, False; 11, comment:""" Sorts the values of this series """; 12, comparison_operator:self.index_type is not N...
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; 13, 18; 13, 19; 13, 20; 13, 21; 13, 22; 14, 23; 15, 24; 15, 25; 17, 26; 18, 27; 19, 28; 20, 29; 21, 30; 22, 31; 23, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43;...
def sort_values(self, ascending=False): """ Sorts the values of this series """ if self.index_type is not None: index_expr = grizzly_impl.get_field(self.expr, 0) column_expr = grizzly_impl.get_field(self.expr, 1) zip_expr = grizzly_impl.zip_columns([index_exp...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, 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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 14, 33; 14, 34; 15, 35; 16, 36; 17, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; 2...
def sort(expr, field = None, keytype=None, ascending=True): """ Sorts the vector. If the field parameter is provided then the sort operators on a vector of structs where the sort key is the field of the struct. Args: expr (WeldObject) field (Int) """ weld_obj = WeldObject(en...
0, module; 1, function_definition; 2, function_name:expand_filename_pattern; 3, parameters; 4, block; 5, identifier:self; 6, identifier:pattern; 7, identifier:base_dir; 8, default_parameter; 9, expression_statement; 10, comment:# replace vars like ${benchmark_path},; 11, comment:# with converting to list and back, we 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; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 8, 21; 8, 22; 9, 23; 12, 24; 13, 25; 14, 26; 15, 27; 15, 28; 16, 29; 18, 30; 19, 31; 19, 32; 20, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 29, 43; 29, 44; ...
def expand_filename_pattern(self, pattern, base_dir, sourcefile=None): """ The function expand_filename_pattern expands a filename pattern to a sorted list of filenames. The pattern can contain variables and wildcards. If base_dir is given and pattern is not absolute, base_dir and patter...
0, module; 1, function_definition; 2, function_name:get_file_list; 3, parameters; 4, block; 5, identifier:shortFile; 6, expression_statement; 7, if_statement; 8, comment:# expand tilde and variables; 9, expression_statement; 10, comment:# expand wildcards; 11, expression_statement; 12, comment:# sort alphabetical,; 13,...
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; 6, 16; 7, 17; 7, 18; 7, 19; 9, 20; 11, 21; 14, 22; 14, 23; 14, 24; 15, 25; 17, 26; 17, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 24, 36; 28, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; 35, 4...
def get_file_list(shortFile): """ The function get_file_list expands a short filename to a sorted list of filenames. The short filename can contain variables and wildcards. """ if "://" in shortFile: # seems to be a URL return [shortFile] # expand tilde and variables expandedFile = ...
0, module; 1, function_definition; 2, function_name:FPS; 3, parameters; 4, block; 5, identifier:name; 6, identifier:sort; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:explicit_name; 12, None; 13, comment:""" Creates a floating-point symbol. :param...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 17, 21; 19, 22; 19, 23; 19, 24; 19, 25; 19, 26; 21, 27; 21, 28; 21, 29; 21, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 28, 40; 28, 41; 29, 42; 29, 43;...
def FPS(name, sort, explicit_name=None): """ Creates a floating-point symbol. :param name: The name of the symbol :param sort: The sort of the floating point :param explicit_name: If False, an identifier is appended to the name to ensure uniqueness. :return: ...
0, module; 1, function_definition; 2, function_name:to_fp; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sort; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:rm; 12, None; 13, comment:""" Convert this float to a different sort :param so...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 9, 15; 10, 16; 14, 17; 14, 18; 15, 19; 16, 20; 16, 21; 19, 22; 21, 23; 21, 24; 21, 25; 22, 26; 22, 27; 27, 28; 27, 29; 28, 30; 28, 31; 30, 32; 30, 33
def to_fp(self, sort, rm=None): """ Convert this float to a different sort :param sort: The sort to convert to :param rm: Optional: The rounding mode to use :return: An FP AST """ if rm is None: rm = fp.RM.default() return fpTo...
0, module; 1, function_definition; 2, function_name:val_to_fp; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sort; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, return_statement; 14, identifier:signed; 15, True; 16, id...
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; 12, 23; 13, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 27, 35; 30, 36; 32, 37; 32, 38; 32, 39; 34, 40; 34, 41; 34, 42; 35, 43; 35,...
def val_to_fp(self, sort, signed=True, rm=None): """ Interpret this bitvector as an integer, and return the floating-point representation of that integer. :param sort: The sort of floating point value to return :param signed: Optional: whether this value is a signed integer ...
0, module; 1, function_definition; 2, function_name:sort_orbitals; 3, parameters; 4, block; 5, identifier:element_pdos; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Sort the orbitals of an element's projected ...
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; 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; 21, 43; ...
def sort_orbitals(element_pdos): """Sort the orbitals of an element's projected density of states. Sorts the orbitals based on a standard format. E.g. s < p < d. Will also sort lm decomposed orbitals. This is useful for plotting/saving. Args: element_pdos (dict): An element's pdos. Should be f...
0, module; 1, function_definition; 2, function_name:find_vasprun_files; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Search for vasprun files from the current directory. The preced...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 5, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 14, 24; 17, 25; 17, 26; 17, 27; 20, 28; 20, 29; 22, 30; 22, 31; 22, 32; 25, 33; 26, 34; 27, 35; 27, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; 32...
def find_vasprun_files(): """Search for vasprun files from the current directory. The precedence order for file locations is: 1. First search for folders named: 'split-0*' 2. Else, look in the current directory. The split folder names should always be zero based, therefore easily sortable...
0, module; 1, function_definition; 2, function_name:feed; 3, parameters; 4, block; 5, identifier:self; 6, identifier:byts; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, return_statement; 12, string; 13, call; 14, assignment; 15, True; 16, block; 17, identifier:retn;...
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; 11, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 19, 24; 19, 25; 20, 26; 23, 27; 23, 28; 24, 29; 24, 30; 27, 31; 27, 32; 27, 33; 27, 34; 28, 35; 28, 36; 31, 37; 32, 38; 33, 39; 34, 40; 35, 41; 35, 42; 36, 43;...
def feed(self, byts): ''' Feed bytes to the unpacker and return completed objects. Args: byts (bytes): Bytes to unpack. Notes: It is intended that this function is called multiple times with bytes from some sort of a stream, as it will unpack and ret...
0, module; 1, function_definition; 2, function_name:maximum_consecutive_dry_days; 3, parameters; 4, block; 5, identifier:pr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:thresh; 13, string; 14, identifier:fre...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 13, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 34...
def maximum_consecutive_dry_days(pr, thresh='1 mm/day', freq='YS'): r"""Maximum number of consecutive dry days Return the maximum number of consecutive days within the period where precipitation is below a certain threshold. Parameters ---------- pr : xarray.DataArray Mean daily precipit...
0, module; 1, function_definition; 2, function_name:daily_downsampler; 3, parameters; 4, block; 5, identifier:da; 6, default_parameter; 7, expression_statement; 8, comment:# generate tags from da.time and freq; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# add tags...
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; 6, 18; 6, 19; 7, 20; 9, 21; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 12, 27; 12, 28; 12, 29; 12, 30; 12, 31; 14, 32; 15, 33; 17, 34; 19, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 25, 44; ...
def daily_downsampler(da, freq='YS'): r"""Daily climate data downsampler Parameters ---------- da : xarray.DataArray freq : string Returns ------- xarray.DataArray Note ---- Usage Example grouper = daily_downsampler(da_std, freq='YS') x2 = gr...
0, module; 1, function_definition; 2, function_name:identify_vertex_neighbours; 3, parameters; 4, block; 5, identifier:self; 6, identifier:vertex; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_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; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 31, 38; 31, 39; 32, 40; 33, 41; 33, 42; 40, 43; ...
def identify_vertex_neighbours(self, vertex): """ Find the neighbour-vertices in the triangulation for the given vertex Searches self.simplices for vertex entries and sorts neighbours """ simplices = self.simplices ridx, cidx = np.where(simplices == vertex) neighb...
0, module; 1, function_definition; 2, function_name:json_encode; 3, parameters; 4, block; 5, identifier:self; 6, identifier:out; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, identifier:limit; 15, No...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 24, 31; 24, 32; 25, 33; 28, 34; 28, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 33, 41; 34, 42; 34, 43; 35, ...
def json_encode(self, out, limit=None, sort_keys=False, indent=None): '''Encode the results of this paged response as JSON writing to the provided file-like `out` object. This function will iteratively read as many pages as present, streaming the contents out as JSON. :param file-like o...
0, module; 1, function_definition; 2, function_name:quick_search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:kw; 13, string; 14, assignment; 15, assignme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 24, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 36, 38; 36, 39; 37, 40; 38, 41; 38, 42; 40, 43;...
def quick_search(self, request, **kw): '''Execute a quick search with the specified request. :param request: see :ref:`api-search-request` :param **kw: See Options below :returns: :py:class:`planet.api.models.Items` :raises planet.api.exceptions.APIException: On API error. ...
0, module; 1, function_definition; 2, function_name:saved_search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sid; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:kw; 13, string; 14, assignment; 15, assignment; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 26, 31; 26, 32; 27, 33; 28, 34; 28, 35; 34, 36; 34, 37; 35, 38; 35, 39; 35, 40; 38, 41; 38, 42; 39, 43;...
def saved_search(self, sid, **kw): '''Execute a saved search by search id. :param sid string: The id of the search :returns: :py:class:`planet.api.models.Items` :raises planet.api.exceptions.APIException: On API error. :Options: * page_size (int): Size of response page...
0, module; 1, function_definition; 2, function_name:_sortValue_isItalic; 3, parameters; 4, block; 5, identifier:font; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:""" Returns 0 if the font is italic. Returns 1 if ...
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; 9, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 21, 30; 21, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43
def _sortValue_isItalic(font): """ Returns 0 if the font is italic. Returns 1 if the font is not italic. """ info = font.info styleMapStyleName = info.styleMapStyleName if styleMapStyleName is not None and "italic" in styleMapStyleName: return 0 if info.italicAngle not in (None, ...
0, module; 1, function_definition; 2, function_name:_sortValue_isMonospace; 3, parameters; 4, block; 5, identifier:font; 6, expression_statement; 7, if_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:""" Returns 0 if the font is monospace. Returns 1 if 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; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 13, 22; 13, 23; 14, 24; 15, 25; 16, 26; 17, 27; 17, 28; 20, 29; 22, 30; 22, 31; 24, 32; 25, 33; 25, 34; 26, 35; 29, 36; 29, 37; 29, 38; 34, 39; 36, 40; 36, 41; 37, 42; 38, 43; 42...
def _sortValue_isMonospace(font): """ Returns 0 if the font is monospace. Returns 1 if the font is not monospace. """ if font.info.postscriptIsFixedPitch: return 0 if not len(font): return 1 testWidth = None for glyph in font: if testWidth is None: tes...
0, module; 1, function_definition; 2, function_name:flair_template_sync; 3, parameters; 4, block; 5, identifier:self; 6, identifier:editable; 7, identifier:limit; 8, comment:# pylint: disable=R0912; 9, identifier:static; 10, identifier:sort; 11, identifier:use_css; 12, identifier:use_text; 13, expression_statement; 14,...
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; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 13, 30; 15, 31; 15, 32; 16, 33; 17, 34; 17, 35; 19, 36; 20, 37; 20, 38; 21, 39; 21, 40; 22, 41; 22, 42; 22, 43; 23, 44; 23, 45...
def flair_template_sync(self, editable, limit, # pylint: disable=R0912 static, sort, use_css, use_text): """Synchronize templates with flair that already exists on the site. :param editable: Indicates that all the options should be editable. :param limit: The minimu...
0, module; 1, function_definition; 2, function_name:props; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# Parse Inputs; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, if_statement; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 11, 35; 12, 36; 13, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 18, 44; 19, 45; 21,...
def props(self, element=None, mode='all', deep=False): r""" Returns a list containing the names of all defined pore or throat properties. Parameters ---------- element : string, optional Can be either 'pore' or 'throat' to specify what properties are ...
0, module; 1, function_definition; 2, function_name:set_residual; 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, expression_statement; 13, expression_statement; 14, expression_stat...
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; 6, 24; 6, 25; 7, 26; 7, 27; 8, 28; 9, 29; 10, 30; 10, 31; 11, 32; 12, 33; 13, 34; 14, 35; 15, 36; 16, 37; 17, 38; 18, 39; 18, 40; 18, 41; 19, 42; 23, 43; 23, 44; 23, 45...
def set_residual(self, pores=[], overwrite=False): r""" Method to start invasion in a network w. residual saturation. Called after inlets are set. Parameters ---------- pores : array_like The pores locations that are to be filled with invader at the ...
0, module; 1, function_definition; 2, function_name:results; 3, parameters; 4, block; 5, identifier:self; 6, identifier:Pc; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:r""" ...
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; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 22, 31; 22, 32; 24, 33; 24, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 3...
def results(self, Pc): r""" This method determines which pores and throats are filled with invading phase at the specified capillary pressure, and creates several arrays indicating the occupancy status of each pore and throat for the given pressure. Parameters --...
0, module; 1, function_definition; 2, function_name:folderitems; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# Fill empty positions from the layout with fake rows. The worksheet; 9, comment:# can be generated by making use of a WorksheetTemplate, so there is...
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; 6, 21; 7, 22; 12, 23; 14, 24; 19, 25; 20, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; 34, 44;...
def folderitems(self): """Returns an array of dictionaries, each dictionary represents an analysis row to be rendered in the list. The array returned is sorted in accordance with the layout positions set for the analyses this worksheet contains when the analyses were added in the workshe...
0, module; 1, function_definition; 2, function_name:resort_client_actions; 3, parameters; 4, block; 5, identifier:portal; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Sort the actions; 12, expression_statement; 13, if_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; 4, 13; 4, 14; 4, 15; 6, 16; 7, 17; 8, 18; 9, 19; 10, 20; 12, 21; 13, 22; 13, 23; 13, 24; 15, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 24, 36; 25, 37; 25, 38; 27, 39; 27, 40; 27, 41; 27, 42; 27, 43; 27, ...
def resort_client_actions(portal): """Resorts client action views """ sorted_actions = [ "edit", "contacts", "view", # this redirects to analysisrequests "analysisrequests", "batches", "samplepoints", "profiles", "templates", "specs", ...
0, module; 1, function_definition; 2, function_name:reindex_sortable_title; 3, parameters; 4, block; 5, identifier:portal; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:"""Reindex sortable_title from some catalogs """; 10, assignment; 11, identifier:catalog_name; 12, identifier:cata...
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; 13, 16; 13, 17; 13, 18; 13, 19; 13, 20; 15, 21; 15, 22; 15, 23; 16, 24; 17, 25; 18, 26; 19, 27; 20, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 32, 42; 32, 43...
def reindex_sortable_title(portal): """Reindex sortable_title from some catalogs """ catalogs = [ "bika_catalog", "bika_setup_catalog", "portal_catalog", ] for catalog_name in catalogs: logger.info("Reindexing sortable_title for {} ...".format(catalog_name)) h...
0, module; 1, function_definition; 2, function_name:folderitems; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statement...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 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; 11, 22; 12, 23; 13, 24; 13, 25; 13, 26; 14, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 26, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 4...
def folderitems(self, full_objects=False, classic=True): """Sort by Categories """ bsc = getToolByName(self.context, "bika_setup_catalog") self.an_cats = bsc( portal_type="AnalysisCategory", sort_on="sortable_title") self.an_cats_order = dict([ ...
0, module; 1, function_definition; 2, function_name:to_display_list; 3, parameters; 4, block; 5, identifier:pairs; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, comment:# add the empty option; 13, if_statement; 14, comment:# sort b...
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; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 11, 27; 11, 28; 13, 29; 13, 30; 15, 31; 15, 32; 15, 33; 16, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 28, 40; 28, 41; 28, 42; 30, 43; 31, 44;...
def to_display_list(pairs, sort_by="key", allow_empty=True): """Create a Plone DisplayList from list items :param pairs: list of key, value pairs :param sort_by: Sort the items either by key or value :param allow_empty: Allow to select an empty value :returns: Plone DisplayList """ dl = Dis...
0, module; 1, function_definition; 2, function_name:sortable_title; 3, parameters; 4, block; 5, identifier:instance; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""Uses the default Plone sortable_text index lower-case """; 11, assignment; 12, call; 13, block; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 14, 20; 14, 21; 16, 22; 16, 23; 18, 24; 19, 25; 20, 26; 20, 27; 23, 28; 25, 29; 25, 30; 30, 31; 30, 32
def sortable_title(instance): """Uses the default Plone sortable_text index lower-case """ title = plone_sortable_title(instance) if safe_callable(title): title = title() return title.lower()
0, module; 1, function_definition; 2, function_name:sortable_sortkey_title; 3, parameters; 4, block; 5, identifier:instance; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""Returns a sortable title as a mxin of sortkey + ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 21, 32; 21, 33; 23, 34; 24, 35; 26, 36; 26, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 33, 43; 3...
def sortable_sortkey_title(instance): """Returns a sortable title as a mxin of sortkey + lowercase sortable_title """ title = sortable_title(instance) if safe_callable(title): title = title() sort_key = instance.getSortKey() if sort_key is None: sort_key = 999999 return "{:...
0, module; 1, function_definition; 2, function_name:sorted_analyses; 3, parameters; 4, block; 5, identifier:self; 6, identifier:analyses; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, comment:# Now, we need the analyses within a request ID to be sorted by; 11, comment:# sortkey (sortable...
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; 9, 23; 9, 24; 9, 25; 13, 26; 14, 27; 15, 28; 16, 29; 16, 30; 16, 31; 18, 32; 19, 33; 20, 34; 22, 35; 22, 36; 24, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 31...
def sorted_analyses(self, analyses): """Sort the analyses by AR ID ascending and subsorted by priority sortkey within the AR they belong to """ analyses = sorted(analyses, key=lambda an: an.getRequestID()) def sorted_by_sortkey(objs): return sorted(objs, key=lambda a...
0, module; 1, function_definition; 2, function_name:get_sorted_attachments; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, return_statement; 13, comment:"""Returns a s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 18, 28; 18, 29; 19, 30; 19, 31; 19, 32; 19, 33; 19, 34; 20, 35; 20, 36; 23, 37; 23, 38; 25, 39; 25, 40; 27, 41; 27, 42; 30, 43; 3...
def get_sorted_attachments(self): """Returns a sorted list of analysis info dictionaries """ inf = float("inf") order = self.get_attachments_order() attachments = self.get_attachments() def att_cmp(att1, att2): _n1 = att1.get('UID') _n2 = att2.get...
0, module; 1, function_definition; 2, function_name:get_analyses_at; 3, parameters; 4, block; 5, identifier:self; 6, identifier:slot; 7, expression_statement; 8, comment:# ensure we have an integer; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, ret...
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; 9, 16; 10, 17; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 23, 34; 23, 35; 23, 36; 23, 37; 26, 38; 26, 39; 29, 40; 31, 41; 31, 42; 33, 43; 3...
def get_analyses_at(self, slot): """Returns the list of analyses assigned to the slot passed in, sorted by the positions they have within the slot. :param slot: the slot where the analyses are located :type slot: int :return: a list of analyses """ # ensure we h...
0, module; 1, function_definition; 2, function_name:rejectionOptionsList; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# RejectionReasons will return something like:; 10, comment:# [{'checkbox': u'on', 'textfield-2': u'b', 'textfield-...
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; 8, 20; 11, 21; 11, 22; 11, 23; 12, 24; 13, 25; 13, 26; 15, 27; 16, 28; 16, 29; 16, 30; 17, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 4...
def rejectionOptionsList(self): "Return a sorted list with the options defined in bikasetup" plone = getSite() settings = plone.bika_setup # RejectionReasons will return something like: # [{'checkbox': u'on', 'textfield-2': u'b', 'textfield-1': u'c', 'textfield-0': u'a'}] ...
0, module; 1, function_definition; 2, function_name:_get_sorted_cond_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys_list; 7, expression_statement; 8, comment:# The names can be found in reflexrulewidget.pt inside the; 9, comment:# conditionscontainer div.; 10, expression_statement; 11, for_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; 7, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 18, 23; 19, 24; 19, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 30, 33; 30, 34; 31, 35; 32, 36; 35, 37; 36, 38; 36, 39; 38, 40; 38, 41; 39, 42
def _get_sorted_cond_keys(self, keys_list): """ This function returns only the elements starting with 'analysisservice-' in 'keys_list'. The returned list is sorted by the index appended to the end of each element """ # The names can be found in reflexrulewidget.pt inside...
0, module; 1, function_definition; 2, function_name:_get_sorted_action_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys_list; 7, expression_statement; 8, comment:# The names can be found in reflexrulewidget.pt inside the; 9, comment:# Reflex action rules list section.; 10, expression_statement; 11,...
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; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 18, 23; 19, 24; 19, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 30, 33; 30, 34; 31, 35; 32, 36; 35, 37; 36, 38; 36, 39; 38, 40; 38, 41; 39, 42
def _get_sorted_action_keys(self, keys_list): """ This function returns only the elements starting with 'action-' in 'keys_list'. The returned list is sorted by the index appended to the end of each element """ # The names can be found in reflexrulewidget.pt inside the ...
0, module; 1, function_definition; 2, function_name:getLinkedRequests; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# fetch the objects by UID and handle nonexisting UIDs gracefully; 10, expression_statement; 11, comment:# filter out ...
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; 10, 20; 12, 21; 16, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 32, 41; 32, 42; 32, 43; 33, ...
def getLinkedRequests(self): """Lookup linked Analysis Requests :returns: sorted list of ARs, where the latest AR comes first """ rc = api.get_tool("reference_catalog") refs = rc.getBackReferences(self, "AnalysisRequestAttachment") # fetch the objects by UID and handle n...
0, module; 1, function_definition; 2, function_name:getLinkedAnalyses; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# Fetch the linked Analyses UIDs; 8, expression_statement; 9, comment:# fetch the objects by UID and handle nonexisting UIDs gracefully; 10, expression_statement; 11, c...
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; 8, 18; 10, 19; 12, 20; 16, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 27, 34; 27, 35; 29, 36; 29, 37; 29, 38; 31, 39; 31, 40; 33, 41; 33, 42; 35, 43; 35,...
def getLinkedAnalyses(self): """Lookup linked Analyses :returns: sorted list of ANs, where the latest AN comes first """ # Fetch the linked Analyses UIDs refs = get_backreferences(self, "AnalysisAttachment") # fetch the objects by UID and handle nonexisting UIDs graceful...
0, module; 1, function_definition; 2, function_name:get_sorted_fields; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, return_statement; 11, comment:"""Return the sorted fields """; 12, assignment; 13, assignment...
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; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 16, 26; 16, 27; 16, 28; 17, 29; 17, 30; 19, 31; 19, 32; 21, 33; 21, 34; 24, 35; 25, 36; 26, 37; 27, 38; 28, 39; 30, 40; 30, 41; 32, 42; 33, 43; 3...
def get_sorted_fields(self): """Return the sorted fields """ inf = float("inf") order = self.get_field_order() def field_cmp(field1, field2): _n1 = field1.getName() _n2 = field2.getName() _i1 = _n1 in order and order.index(_n1) + 1 or inf ...
0, module; 1, function_definition; 2, function_name:resolve_sorting; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, expression_statement; 8, expression_statement; 9, comment:# Sort on; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_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; 10, 17; 11, 18; 12, 19; 13, 20; 13, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 21, 32; 21, 33; 21, 34; 21, 35; 21, 36; 21, 37; 21, 38; 26, 39; 26, 40; 28, 41; 28, 42; 30, 43; 3...
def resolve_sorting(self, query): """Resolves the sorting criteria for the given query """ sorting = {} # Sort on sort_on = query.get("sidx", None) sort_on = sort_on or query.get("sort_on", None) sort_on = sort_on == "Title" and "sortable_title" or sort_on ...
0, module; 1, function_definition; 2, function_name:is_sortable_index; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index_name; 7, identifier:catalog; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""Returns whether the index is sortable """;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33
def is_sortable_index(self, index_name, catalog): """Returns whether the index is sortable """ index = self.get_index(index_name, catalog) if not index: return False return index.meta_type in ["FieldIndex", "DateIndex"]
0, module; 1, function_definition; 2, function_name:sortable_title; 3, parameters; 4, block; 5, identifier:portal; 6, identifier:title; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Replace numbers with zero filled numbers; 12, expression_statement; 13, comme...
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; 8, 17; 8, 18; 9, 19; 10, 20; 12, 21; 14, 22; 14, 23; 14, 24; 15, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 23, 34; 23, 35; 23, 36; 24, 37; 27, 38; 29, 39; 29, 40; 31, 41; 31, 42; 33, 43; 33, ...
def sortable_title(portal, title): """Convert title to sortable title """ if not title: return '' def_charset = portal.plone_utils.getSiteEncoding() sortabletitle = str(title.lower().strip()) # Replace numbers with zero filled numbers sortabletitle = num_sort_regex.sub(zero_fill, so...
0, module; 1, function_definition; 2, function_name:_sort_column; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column; 7, identifier:reverse; 8, expression_statement; 9, if_statement; 10, comment:# get list of (value, item) tuple where value is the value in column for the item; 11, expression_statement; 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; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 8, 18; 9, 19; 9, 20; 11, 21; 13, 22; 15, 23; 15, 24; 15, 25; 17, 26; 19, 27; 19, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 4...
def _sort_column(self, column, reverse): """Sort a column by its values""" if tk.DISABLED in self.state(): return # get list of (value, item) tuple where value is the value in column for the item l = [(self.set(child, column), child) for child in self.get_children('')] ...
0, module; 1, function_definition; 2, function_name:column; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, if_statement; 14, identifier:option; 15, None; 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; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 12, 23; 13, 24; 13, 25; 13, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 21, 32; 21, 33; 23, 34; 24, 35; 24, 36; 25, 37; 26, 38; 26, 39; 30, 40; 31, 41; 32, 42; 32, 43; 33...
def column(self, column, option=None, **kw): """ Query or modify the options for the specified column. If `kw` is not given, returns a dict of the column option values. If `option` is specified then the value for that option is returned. Otherwise, sets the options to the corres...
0, module; 1, function_definition; 2, function_name:_config_sortable; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sortable; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, comment:"""Configure a new sortable state"""; 11, identifier:col; 12, subscript; 13, block; 14, assignment; 1...
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; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 17, 21; 18, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 22, 28; 26, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 35, 37; 35, 38; 36, 39; 36, 40; 39, 41; 40, 42; 40, 43;...
def _config_sortable(self, sortable): """Configure a new sortable state""" for col in self["columns"]: command = (lambda c=col: self._sort_column(c, True)) if sortable else "" self.heading(col, command=command) self._sortable = sortable
0, module; 1, function_definition; 2, function_name:iter_items; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:repo; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:common_path; 11, None; 12, comment:"""Find all refs in the repository :param repo: is the Repo ...
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; 15, 17; 15, 18; 16, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 28, 31; 28, 32; 30, 33; 30, 34
def iter_items(cls, repo, common_path=None): """Find all refs in the repository :param repo: is the Repo :param common_path: Optional keyword argument to the path which is to be shared by all returned Ref objects. Defaults to class specific portion if None a...
0, module; 1, function_definition; 2, function_name:write_cache; 3, parameters; 4, block; 5, identifier:entries; 6, identifier:stream; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# wrap the stream into a compatible writer; 11, expression_statement; 12, expression_statement; 13, expr...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 7, 26; 8, 27; 8, 28; 9, 29; 11, 30; 12, 31; 13, 32; 15, 33; 16, 34; 17, 35; 19, 36; 19, 37; 19, 38; 22, 39; 22, 40; 24, 41; 30, 42; 30, 43; 31, 44; 31, 45...
def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1Writer): """Write the cache represented by entries to a stream :param entries: **sorted** list of entries :param stream: stream to wrap into the AdapterStreamCls - it is used for final output. :param ShaStreamCls: ...
0, module; 1, function_definition; 2, function_name:write_tree_from_cache; 3, parameters; 4, block; 5, identifier:entries; 6, identifier:odb; 7, identifier:sl; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, while...
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; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 14, 30; 17, 31; 18, 32; 19, 33; 20, 34; 21, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44; 2...
def write_tree_from_cache(entries, odb, sl, si=0): """Create a tree from the given sorted list of entries and put the respective trees into the given object database :param entries: **sorted** list of IndexEntries :param odb: object database to store the trees in :param si: start index at which we ...