|
| drop_zeros (v, replace="") |
| Drops trailing zeros and empty decimal separator, if any.
|
|
| ellipsize (text, limit, ellipsis="..") |
| Returns text ellipsized if beyond limit.
|
|
| ensure_namespace (val, defaults=None, dashify=("WRITE_OPTIONS",), **kwargs) |
| Returns a copy of value as argparse.Namespace , with all keys uppercase.
|
|
| filter_dict (dct, keys=(), values=(), reverse=False) |
| Filters string dictionary by keys and values, supporting * wildcards.
|
|
| find_files (names=(), paths=(), suffixes=(), skip_suffixes=(), recurse=False) |
| Yields filenames from current directory or given paths.
|
|
| format_bytes (size, precision=2, inter=" ", strip=True) |
| Returns a formatted byte size (like 421.40 MB), trailing zeros optionally removed.
|
|
| format_stamp (stamp) |
| Returns ISO datetime from UNIX timestamp.
|
|
| format_timedelta (delta) |
| Formats the datetime.timedelta as "3d 40h 23min 23.1sec".
|
|
| get_name (obj) |
| Returns the fully namespaced name for a Python module, class, function or object.
|
|
| has_arg (func, name) |
| Returns whether function supports taking specified argument by name.
|
|
| import_item (name) |
| Returns imported module, or identifier from imported namespace; raises on error.
|
|
| is_iterable (value) |
| Returns whether value is iterable.
|
|
| is_stream (value) |
| Returns whether value is a file-like object.
|
|
| makedirs (path) |
| Creates directory structure for path if not already existing.
|
|
| memoize (func) |
| Returns a results-caching wrapper for the function, cache used if arguments hashable.
|
|
| merge_dicts (d1, d2) |
| Merges d2 into d1, recursively for nested dicts, returns d1.
|
|
| merge_spans (spans, join_blanks=False) |
| Returns a sorted list of (start, end) spans with overlapping spans merged.
|
|
| parse_datetime (text) |
| Returns datetime object from ISO datetime string (may be partial).
|
|
| parse_number (value, suffixes=None) |
| Returns an integer parsed from text, raises on error.
|
|
| path_to_regex (text, sep=".", wildcard="*", end=False, intify=False) |
| Returns re.Pattern for matching path strings with optional integer indexes.
|
|
| plural (word, items=None, numbers=True, single="1", sep=",", pref="", suf="") |
| Returns the word as 'count words', or '1 word' if count is 1, or 'words' if count omitted.
|
|
| structcopy (value) |
| Returns a deep copy of a standard data structure (dict, list, set, tuple), other object types reused instead of copied.
|
|
| unique_path (pathname, empty_ok=False) |
| Returns a unique version of the path.
|
|
| verify_io (f, mode) |
| Returns whether stream or file path can be read from and/or written to as binary.
|
|
| wildcard_to_regex (text, end=False) |
| Returns plain wildcard like "foo*bar" as re.Pattern("foo.*bar", re.I).
|
|