Skip to content

Commit

Permalink
refactor: Skip inspection of some debug packages
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Jan 14, 2022
1 parent 133b4e4 commit 4ee8968
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/griffe/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

_accepted_py_module_extensions = [".py", ".pyc", ".pyo", ".pyd", ".so"]
_extensions_set = set(_accepted_py_module_extensions)
_ignored_modules = {"debugpy", "_pydev"}

# TODO: namespace packages can span multiple locations! we must support it.
# ideally: find all locations, sort them, then reverse-merge their file lists
Expand Down Expand Up @@ -326,6 +327,9 @@ def _visit_module(self, code: str, module_name: str, module_path: Path, parent:
)

def _inspect_module(self, module_name: str, filepath: Path | None = None, parent: Module | None = None) -> Module:
for prefix in _ignored_modules:
if module_name.startswith(prefix):
raise ImportError(f"Ignored module '{module_name}'")
try:
return inspect(
module_name,
Expand Down

0 comments on commit 4ee8968

Please sign in to comment.