# HG changeset patch # User Goffi # Date 1677950613 -3600 # Node ID 1b7c6ee080b9506ddf9aadec293e2cbf3eb86bfb # Parent 7a6c7abd7dbb2c7c0bbb1b6b546b6774f3c30707 core (log): type hints diff -r 7a6c7abd7dbb -r 1b7c6ee080b9 sat/core/log.py --- a/sat/core/log.py Thu Mar 02 12:39:16 2023 +0100 +++ b/sat/core/log.py Sat Mar 04 18:23:33 2023 +0100 @@ -21,7 +21,7 @@ # XXX: this module use standard logging module when possible, but as SàT can work in different cases where logging is not the best choice (twisted, pyjamas, etc), it is necessary to have a dedicated module. Additional feature like environment variables and colors are also managed. # TODO: change formatting from "%s" style to "{}" when moved to Python 3 -from typing import TYPE_CHECKING, Any, Optional +from typing import TYPE_CHECKING, Any, Optional, Dict if TYPE_CHECKING: from logging import _ExcInfoType @@ -34,7 +34,7 @@ import traceback backend = None -_loggers = {} +_loggers: Dict[str, "Logger"] = {} handlers = {} COLOR_START = '%(color_start)s' COLOR_END = '%(color_end)s' @@ -401,7 +401,7 @@ raise ValueError('memory output is not used') return configure_cls[backend].memoryGet(size) -def getLogger(name=C.LOG_BASE_LOGGER): +def getLogger(name=C.LOG_BASE_LOGGER) -> Logger: try: logger_class = configure_cls[backend].LOGGER_CLASS except KeyError: