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.
- objwatch.utils.logger.log_error(msg: str, *args: Any, **kwargs: Any) None[source]¶
Log an error message or print it if FORCE is enabled.
objwatch.utils.weak module¶
- class objwatch.utils.weak.WeakIdKeyDictionary(dict=None, ref_type=<class 'objwatch.utils.weak.WeakIdRef'>)[source]¶
Bases:
MutableMapping- 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.
- 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.
- objwatch.utils.weak.WeakTensorKeyDictionary¶
alias of
WeakIdKeyDictionary