fixed the skip_import_error option
This commit is contained in:
@@ -63,6 +63,7 @@ class GriffeLoader:
|
||||
self,
|
||||
module_paths: List[str],
|
||||
project_name: Optional[str] = None,
|
||||
skip_import_errors: bool = None,
|
||||
) -> Project:
|
||||
if not module_paths:
|
||||
raise ValueError("At least one module path must be provided")
|
||||
@@ -73,7 +74,14 @@ class GriffeLoader:
|
||||
project = Project(name=project_name)
|
||||
|
||||
for module_path in module_paths:
|
||||
module = self.load_module(module_path)
|
||||
try:
|
||||
module = self.load_module(module_path)
|
||||
except ImportError as import_error:
|
||||
if skip_import_errors:
|
||||
logger.debug("Could not load %s: %s", module_path, import_error)
|
||||
continue
|
||||
else:
|
||||
raise import_error
|
||||
project.add_module(module)
|
||||
|
||||
return project
|
||||
|
||||
@@ -23,6 +23,7 @@ class GriffeLoader:
|
||||
self,
|
||||
module_paths: List[str],
|
||||
project_name: Optional[str] = ...,
|
||||
skip_import_errors: bool = ...,
|
||||
) -> Project:
|
||||
"""Load a documentation project from Python modules."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user