diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-12-29 11:24:04 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-12-29 11:25:06 +0100 |
commit | ad9ccabdd7100c1538787c1f40447cc5aa260118 (patch) | |
tree | 6553fb9f668fc5f96eb37c05bccf56dce17c72e1 | |
parent | 71833bbe06594cdb0e1660b40d66f9f4607a9038 (diff) | |
download | qutebrowser-ad9ccabdd7100c1538787c1f40447cc5aa260118.tar.gz qutebrowser-ad9ccabdd7100c1538787c1f40447cc5aa260118.zip |
Update type annotations
-rw-r--r-- | qutebrowser/extensions/loader.py | 2 | ||||
-rw-r--r-- | qutebrowser/utils/log.py | 6 | ||||
-rw-r--r-- | qutebrowser/utils/utils.py | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/qutebrowser/extensions/loader.py b/qutebrowser/extensions/loader.py index 2774d04e4..793f131c8 100644 --- a/qutebrowser/extensions/loader.py +++ b/qutebrowser/extensions/loader.py @@ -83,7 +83,7 @@ def add_module_info(module: types.ModuleType) -> ModuleInfo: # pylint: disable=protected-access if not hasattr(module, '__qute_module_info'): module.__qute_module_info = ModuleInfo() # type: ignore[attr-defined] - return module.__qute_module_info # type: ignore[attr-defined] + return module.__qute_module_info def load_components(*, skip_hooks: bool = False) -> None: diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 6677e383e..4853d62ae 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -247,7 +247,9 @@ def disable_qt_msghandler() -> Iterator[None]: @contextlib.contextmanager def py_warning_filter(action: str = 'ignore', **kwargs: Any) -> Iterator[None]: """Contextmanager to temporarily disable certain Python warnings.""" - warnings.filterwarnings(action, **kwargs) + # FIXME Use Literal['default', 'error', 'ignore', 'always', 'module', 'once'] + # once we use Python 3.8 or typing_extensions + warnings.filterwarnings(action, **kwargs) # type: ignore[arg-type] yield if _log_inited: _init_py_warnings() @@ -729,8 +731,8 @@ class ColoredFormatter(logging.Formatter): datefmt: str, style: str, *, use_colors: bool) -> None: - super().__init__(fmt, datefmt, style) # type: ignore[arg-type] # FIXME Use Literal["%", "{", "$"] once we use Python 3.8 or typing_extensions + super().__init__(fmt, datefmt, style) # type: ignore[arg-type] self.use_colors = use_colors def format(self, record: logging.LogRecord) -> str: diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 9c68932f3..a899fa599 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -300,7 +300,8 @@ def fake_io(write_func: Callable[[str], int]) -> Iterator[None]: def disabled_excepthook() -> Iterator[None]: """Run code with the exception hook temporarily disabled.""" old_excepthook = sys.excepthook - sys.excepthook = sys.__excepthook__ + # https://github.com/python/typeshed/pull/6678 + sys.excepthook = sys.__excepthook__ # type: ignore[assignment] try: yield finally: |