diff --git a/kleinanzeigen_bot/selenium_mixin.py b/kleinanzeigen_bot/selenium_mixin.py index c6baf25..5f7b31f 100644 --- a/kleinanzeigen_bot/selenium_mixin.py +++ b/kleinanzeigen_bot/selenium_mixin.py @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later """ import logging, os, shutil, sys from collections.abc import Callable, Iterable -from typing import Any, Final, TypeVar +from typing import Any, Final from selenium import webdriver from selenium.common.exceptions import NoSuchElementException, TimeoutException @@ -23,12 +23,10 @@ from webdriver_manager.chrome import ChromeDriverManager from webdriver_manager.microsoft import EdgeChromiumDriverManager from webdriver_manager.utils import ChromeType -from .utils import ensure, pause +from .utils import ensure, pause, T LOG:Final[logging.Logger] = logging.getLogger("kleinanzeigen_bot.selenium_mixin") -T:Final[TypeVar] = TypeVar('T') - class BrowserConfig: diff --git a/kleinanzeigen_bot/utils.py b/kleinanzeigen_bot/utils.py index ddd7ebe..84d4858 100644 --- a/kleinanzeigen_bot/utils.py +++ b/kleinanzeigen_bot/utils.py @@ -6,7 +6,7 @@ import copy, decimal, json, logging, os, re, secrets, sys, traceback, time from importlib.resources import read_text as get_resource_as_string from collections.abc import Callable, Iterable from types import ModuleType -from typing import Any, Final +from typing import Any, Final, TypeVar import coloredlogs, inflect from ruamel.yaml import YAML @@ -14,6 +14,8 @@ from ruamel.yaml import YAML LOG_ROOT:Final[logging.Logger] = logging.getLogger() LOG:Final[logging.Logger] = logging.getLogger("kleinanzeigen_bot.utils") +T:Final[TypeVar] = TypeVar('T') + def abspath(relative_path:str, relative_to:str = None): """ @@ -123,8 +125,7 @@ def configure_console_logging() -> None: def on_exception(ex_type, ex_value, ex_traceback) -> None: if issubclass(ex_type, KeyboardInterrupt): sys.__excepthook__(ex_type, ex_value, ex_traceback) - return - if LOG.isEnabledFor(logging.DEBUG) or isinstance(ex_value, (AttributeError, ImportError, NameError, TypeError)): + elif LOG.isEnabledFor(logging.DEBUG) or isinstance(ex_value, (AttributeError, ImportError, NameError, TypeError)): LOG.error("".join(traceback.format_exception(ex_type, ex_value, ex_traceback))) elif isinstance(ex_value, AssertionError): LOG.error(ex_value)