Skip to content

Commit

Permalink
Pass test
Browse files Browse the repository at this point in the history
  • Loading branch information
znicholls committed Apr 11, 2023
1 parent 830bf5c commit d611358
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/sphinx_autodoc_typehints/__init__.py
Expand Up @@ -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:
Expand Down

0 comments on commit d611358

Please sign in to comment.