pygacity.util.stringthings module¶
Utility string functions for pygacity
- pygacity.util.stringthings.banner(logf: callable = <built-in function print>)[source]¶
Logs the pygacity banner message using the provided logging function.
- Parameters:
logf (function) – writer; e.g., print, f.write, etc.
- pygacity.util.stringthings.chmod_recursive_dirs_files(path: Path, dmode=493, fmode=420)[source]¶
Recursively changes permissions of a directory and its contents.
- pygacity.util.stringthings.linesplit(line: str, cchar: str = '!')[source]¶
Splits the line into to substrings at first occurrence of cchar and returns the two strings as a tuple.
- pygacity.util.stringthings.my_logger(msg: str | list | dict, logf: callable = <built-in function print>, width: int = None, fill: str = '', just: str = '<', frame: str = '', depth: int = 0, **kwargs)[source]¶
A fancy logger with recursion for lists and dicts.
- Parameters:
msg (str, list, or dict) – the message to be logged, either as a single string, list, or dict
logf (function, optional) – writer; default is print; works with logger.info, f.write, etc.
width (int, optional) – linelength in bytes; default is terminal width for print, 67 otherwise
fill (str, optional) – single character used to fill blank spaces
just (str, optional) – format character for justification: ‘<’ (left), ‘>’ (right), ‘^’ (center). default is ‘<’ (left)
frame (str, optional) – single character used to frame the message block
depth (int, optional) – indentation depth for nested structures (default is 0)