diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-12-21 11:30:30 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-12-21 11:39:00 +0100 |
commit | 05e6ef85d66885a105072d03879d924d48a81e9f (patch) | |
tree | 0e66a5c8edde7b3990fc1ade47277da1ad20933e | |
parent | ad44615b20d7c84ee94e21404b5858cb9fcc1f75 (diff) | |
download | qutebrowser-05e6ef85d66885a105072d03879d924d48a81e9f.tar.gz qutebrowser-05e6ef85d66885a105072d03879d924d48a81e9f.zip |
utils: Reorder imports
Fixes pylint properly and avoids https://github.com/PyCQA/pylint/issues/2366
-rw-r--r-- | qutebrowser/utils/utils.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index 331bf5f96..cf239805c 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -38,6 +38,15 @@ import ctypes import ctypes.util from typing import (Any, Callable, IO, Iterator, Optional, Sequence, Tuple, Type, Union, TYPE_CHECKING, cast) +try: + # Protocol was added in Python 3.8 + from typing import Protocol +except ImportError: # pragma: no cover + if not TYPE_CHECKING: + class Protocol: + + """Empty stub at runtime.""" + from PyQt5.QtCore import QUrl, QVersionNumber from PyQt5.QtGui import QClipboard, QDesktopServices @@ -72,16 +81,6 @@ is_windows = sys.platform.startswith('win') is_posix = os.name == 'posix' -try: - # Protocol was added in Python 3.8 - from typing import Protocol # pylint: disable=ungrouped-imports -except ImportError: # pragma: no cover - if not TYPE_CHECKING: - class Protocol: - - """Empty stub at runtime.""" - - class SupportsLessThan(Protocol): """Protocol for a "comparable" object.""" |