utilities#

Various unclassifiable utilities.

Functions

change_environment(exec_path)

Changes the python environment based on the executable.

chunks(data, n)

Splits a dataset into n chunks

extract_attribute_docs(node_type)

Extracts attribute docstrings in the style of PEP 258.

extract_parent_type(owner, name)

Extract type annotations from a owning class.

extract_type(obj)

Extract type annotations from an object or class.

find_probable_files_from_command(command)

Finds possible files from a command string.

graph_cycles(graph)

Returns whether the graph contains cycles.

graph_to_nx(graph)

Converts a workflow graph to a networkx.MultiDiGraph object.

has_file(path)

Returns whether the specified directory contains files.

has_module_system()

Checks whether the system can use modules.

is_path_type(arg1)

Checks if type is a Path-like type.

load_modules(*names)

Loads environment modules using lmod.

make_list(item)

Makes a single item or sequence of items into a list.

match_context(match[, chars])

Provides context to a regular expression match.

matching_types(arg1, arg2[, strict])

Checks if two types are matching.

nested_dict_to_tuple(__data)

Convert a sequentially nested dictionary into a tuple.

set_environment(env)

Set global system environment variables.

tuple_to_nested_dict(*data)

Convert a tuple into a sequentially nested dictionary.

typecheck(value, datatype)

Checks if a value is valid using type annotations.

unique_id([length])

Creates a somewhat unique identifier.

Classes

StrEnum(value)

Allows use of enum names as auto string values.

Timer()

Timer with start, pause, and stop functionality.