Gate stubs behind TYPE_CHECKING

This commit is contained in:
Odd Stråbø 2025-09-18 17:32:28 +02:00
commit 402be319ca

View file

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals from __future__ import division, absolute_import, print_function, unicode_literals
from typing import TYPE_CHECKING
class LazyLogger(object): class LazyLogger(object):
""" """
@ -26,80 +28,82 @@ class LazyLogger(object):
# Please ensure any actually functional code is above this comment. # # Please ensure any actually functional code is above this comment. #
##################################################################### #####################################################################
def setLevel(self, level): if TYPE_CHECKING:
"""
Set the logging level of this logger. level must be an int or a str.
"""
...
def debug(self, msg, *args, **kwargs): def setLevel(self, level):
""" """
Log 'msg % args' with severity 'DEBUG'. Set the logging level of this logger. level must be an int or a str.
"""
...
To pass exception information, use the keyword argument exc_info with def debug(self, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with severity 'DEBUG'.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
def info(self, msg, *args, **kwargs): logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
""" """
Log 'msg % args' with severity 'INFO'. ...
To pass exception information, use the keyword argument exc_info with def info(self, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with severity 'INFO'.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
def warning(self, msg, *args, **kwargs): logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
""" """
Log 'msg % args' with severity 'WARNING'. ...
To pass exception information, use the keyword argument exc_info with def warning(self, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with severity 'WARNING'.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
def error(self, msg, *args, **kwargs): logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
""" """
Log 'msg % args' with severity 'ERROR'. ...
To pass exception information, use the keyword argument exc_info with def error(self, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with severity 'ERROR'.
logger.error("Houston, we have a %s", "major problem", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
def exception(self, msg, *args, exc_info=True, **kwargs): logger.error("Houston, we have a %s", "major problem", exc_info=1)
""" """
Convenience method for logging an ERROR with exception information. ...
"""
...
def critical(self, msg, *args, **kwargs): def exception(self, msg, *args, exc_info=True, **kwargs):
""" """
Log 'msg % args' with severity 'CRITICAL'. Convenience method for logging an ERROR with exception information.
"""
...
To pass exception information, use the keyword argument exc_info with def critical(self, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with severity 'CRITICAL'.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
def log(self, level, msg, *args, **kwargs): logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
""" """
Log 'msg % args' with the integer severity 'level'. ...
To pass exception information, use the keyword argument exc_info with def log(self, level, msg, *args, **kwargs):
a true value, e.g. """
Log 'msg % args' with the integer severity 'level'.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1) To pass exception information, use the keyword argument exc_info with
""" a true value, e.g.
...
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
"""
...