objwatch.utils package

Submodules

objwatch.utils.logger module

objwatch.utils.logger.create_logger(name: str = 'objwatch', output: str | None = None, level: int | str = 10, simple: bool = False) None[source]

Create and configure a logger.

Args:

name (str): Name of the logger. output (Optional[str]): Path to a file for writing logs. level (Union[int, str]): Logging level (e.g., logging.DEBUG, logging.INFO, “force”). simple (bool): Enable simple logging mode with a basic format.

objwatch.utils.logger.get_logger() Logger[source]

Retrieve the configured logger.

Returns:

logging.Logger: The logger instance.

objwatch.utils.logger.log_debug(msg: str, *args: Any, **kwargs: Any) None[source]

Log a debug message or print it if FORCE is enabled.

Args:

msg (str): The message to log. *args (Any): Variable length argument list. **kwargs (Any): Arbitrary keyword arguments.

objwatch.utils.logger.log_error(msg: str, *args: Any, **kwargs: Any) None[source]

Log an error message or print it if FORCE is enabled.

Args:

msg (str): The message to log. *args (Any): Variable length argument list. **kwargs (Any): Arbitrary keyword arguments.

objwatch.utils.logger.log_info(msg: str, *args: Any, **kwargs: Any) None[source]

Log an informational message or print it if FORCE is enabled.

Args:

msg (str): The message to log. *args (Any): Variable length argument list. **kwargs (Any): Arbitrary keyword arguments.

objwatch.utils.logger.log_warn(msg: str, *args: Any, **kwargs: Any) None[source]

Log a warning message or print it if FORCE is enabled.

Args:

msg (str): The message to log. *args (Any): Variable length argument list. **kwargs (Any): Arbitrary keyword arguments.

objwatch.utils.weak module

class objwatch.utils.weak.WeakIdKeyDictionary(dict=None, ref_type=<class 'objwatch.utils.weak.WeakIdRef'>)[source]

Bases: MutableMapping

copy()[source]
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
items() a set-like object providing a view on D's items[source]
keyrefs()[source]

Return a list of weak references to the keys.

The references are not guaranteed to be ‘live’ at the time they are used, so the result of calling the references needs to be checked before being used. This can be used to avoid creating references that will cause the garbage collector to keep the keys around longer than needed.

keys() a set-like object providing a view on D's keys[source]
pop(k[, d]) v, remove specified key and return the corresponding value.[source]

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair[source]

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D[source]
update([E, ]**F) None.  Update D from mapping/iterable E and F.[source]

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values[source]
class objwatch.utils.weak.WeakIdRef(key, callback=None)[source]

Bases: ReferenceType

Module contents