|
| rosros.util.drop_zeros (v, replace="") |
| Drops or replaces trailing zeros and empty decimal separator, if any.
|
|
| rosros.util.ensure_object (obj_or_cls, attributes, populate_object=None, *args, **kwargs) |
| Ensures result is an object of specified type.
|
|
| rosros.util.flatten_dict (dct, sep=".") |
| Flattens a nested dictionary to a flat dictionary, with nested keys joined with separator.
|
|
| rosros.util.format_bytes (size, precision=2, inter=" ", strip=True) |
| Returns a formatted byte size (like 421.40 MB), trailing zeros optionally removed.
|
|
| rosros.util.get_arity (func, positional=True, keyword=False) |
| Returns the maximum number of arguments the function takes, -1 if variable number.
|
|
| rosros.util.get_nested (obj, path) |
| Returns (nested value, value parent container, key in parent container).
|
|
| rosros.util.get_value (obj, path, pathsep=None) |
| Returns object or dictionary or list value at (nested, path).
|
|
| rosros.util.make_dict (path, value) |
| Returns a nested dictionary from path, like {"nested": {"path": value}}.
|
|
| rosros.util.memoize (func) |
| Returns a results-caching wrapper for the function.
|
|
| rosros.util.merge_dicts (d1, d2) |
| Merges d2 into d1, recursively for nested dicts.
|
|
| rosros.util.namejoin (*args) |
| Returns arguments joined into a namespace name, starting and separated with "/".
|
|
| rosros.util.namesplit (name) |
| Returns argument split into (namespace, name), like "/a/b/c" as ("/a/b", "c").
|
|
| rosros.util.set_value (obj, path, value, pathsep=None) |
| Sets object or dictionary or list value at key or (nested, path).
|
|
| rosros.util.start_future (func, *args, **kwargs) |
| Returns `concurrent.futures.Future` and invokes function in a background thread.
|
|
| rosros.util.unique_path (pathname, empty_ok=False) |
| Returns a unique version of the path.
|
|
| rosros.util.wrap_arity (func) |
| Returns wrapper for invoking function with its maximum supported number of arguments.
|
|