diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-05-30 18:14:44 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-06-22 17:41:12 +0200 |
commit | 98beb50e644c2ad3a3a3b2980fbcba6fdce2442c (patch) | |
tree | eb08aabf0dcc60415681e0792846de4557625696 | |
parent | 08e1b987bfad53d51fac6a3e3808056c55720ed6 (diff) | |
download | qutebrowser-98beb50e644c2ad3a3a3b2980fbcba6fdce2442c.tar.gz qutebrowser-98beb50e644c2ad3a3a3b2980fbcba6fdce2442c.zip |
Move creating version.MODULE_INFO to a function
-rw-r--r-- | qutebrowser/utils/version.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index a45cb2352..23ac05d8d 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -26,7 +26,6 @@ import os.path import platform import subprocess import importlib -import collections import pathlib import configparser import enum @@ -394,11 +393,8 @@ class ModuleInfo: return text -MODULE_INFO: Mapping[str, ModuleInfo] = collections.OrderedDict([ - # FIXME: Mypy doesn't understand this. See https://github.com/python/mypy/issues/9706 - (name, ModuleInfo(name, *args)) # type: ignore[arg-type, misc] - for (name, *args) in - [ +def _create_module_info() -> Dict[str, ModuleInfo]: + packages = [ ('sip', ['SIP_VERSION_STR']), ('colorama', ['VERSION', '__version__']), ('jinja2', ['__version__']), @@ -409,7 +405,14 @@ MODULE_INFO: Mapping[str, ModuleInfo] = collections.OrderedDict([ ('PyQt5.QtWebEngine', ['PYQT_WEBENGINE_VERSION_STR']), ('PyQt5.QtWebKitWidgets', []), ] -]) + # Mypy doesn't understand this. See https://github.com/python/mypy/issues/9706 + return { + name: ModuleInfo(name, *args) # type: ignore[arg-type, misc] + for (name, *args) in packages + } + + +MODULE_INFO: Mapping[str, ModuleInfo] = _create_module_info() def _module_versions() -> Sequence[str]: |