Skip to content

Commit

Permalink
feat: Support inspecting packages (__init__ modules)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed May 12, 2024
1 parent 964e0d2 commit 3f74f67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/griffe/agents/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def get_module(self, import_paths: Sequence[str | Path] | None = None) -> Module
parent_path = self.filepath.parent
for _ in range(import_path.count(".")):
parent_path = parent_path.parent
# Climb up one more time for `__init__` modules.
if self.filepath.stem == "__init__":
parent_path = parent_path.parent
if parent_path not in import_paths:
import_paths.insert(0, parent_path)

Expand Down

0 comments on commit 3f74f67

Please sign in to comment.