From d611358a1ef446cca2bda975e0c59913c2b3e65b Mon Sep 17 00:00:00 2001 From: Zebedee Nicholls Date: Tue, 11 Apr 2023 10:53:36 +1000 Subject: [PATCH] Pass test --- src/sphinx_autodoc_typehints/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sphinx_autodoc_typehints/__init__.py b/src/sphinx_autodoc_typehints/__init__.py index 70d092a9..c859d3ef 100644 --- a/src/sphinx_autodoc_typehints/__init__.py +++ b/src/sphinx_autodoc_typehints/__init__.py @@ -358,12 +358,10 @@ def get_all_type_hints(autodoc_mock_imports: list[str], obj: Any, name: str) -> _TYPE_GUARD_IMPORT_RE = re.compile(r"\nif (typing.)?TYPE_CHECKING:[^\n]*([\s\S]*?)(?=\n\S)") -_TYPE_GUARD_IMPORTS_RESOLVED = set() def _resolve_type_guarded_imports(autodoc_mock_imports: list[str], obj: Any) -> None: - if hasattr(obj, "__module__") and obj.__module__ not in _TYPE_GUARD_IMPORTS_RESOLVED: - _TYPE_GUARD_IMPORTS_RESOLVED.add(obj.__module__) + if hasattr(obj, "__module__"): if obj.__module__ not in sys.builtin_module_names: module = inspect.getmodule(obj) if module: