From 7c066f3c880825322ea20442f2709e15911cfb41 Mon Sep 17 00:00:00 2001 From: Chad Dombrova Date: Sun, 23 Jul 2023 19:00:38 -0400 Subject: [PATCH] Do not filter __version__ module attribute: it is useful in practice. --- mypy/stubutil.py | 1 - test-data/unit/stubgen.test | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mypy/stubutil.py b/mypy/stubutil.py index 1de0c8bc892b2..dfb04976badb1 100644 --- a/mypy/stubutil.py +++ b/mypy/stubutil.py @@ -488,7 +488,6 @@ class BaseStubGenerator: IGNORED_DUNDERS: Final = { "__all__", "__author__", - "__version__", "__about__", "__copyright__", "__email__", diff --git a/test-data/unit/stubgen.test b/test-data/unit/stubgen.test index 5e67cc3144ba6..5264d70b5f642 100644 --- a/test-data/unit/stubgen.test +++ b/test-data/unit/stubgen.test @@ -315,6 +315,7 @@ __all__ = [] __author__ = '' __version__ = '' [out] +__version__: str [case testBaseClass] class A: ... @@ -2852,6 +2853,8 @@ __uri__ = '' __version__ = '' [out] +from m import __version__ as __version__ + class A: ... [case testHideDunderModuleAttributesWithAll_import] @@ -2881,6 +2884,7 @@ __uri__ = '' __version__ = '' [out] +from m import __version__ as __version__ [case testAttrsClass_semanal] import attrs