Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Sep 22, 2023
1 parent d086b11 commit 35e2236
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions mknodes/navs/mkdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ def collect_classes(
self,
*,
recursive: bool = False,
predicate: Callable | None = None,
predicate: Callable[[type], bool] | None = None,
submodule: types.ModuleType | str | tuple | list | None = None,
):
"""Collect classes from given module.
Arguments:
recursive: Also collect classes from submodules
predicate: Class filter predicate
submodule: If set, only collect from given module.
"""
for klass in self.iter_classes(
recursive=recursive,
predicate=predicate,
Expand All @@ -107,7 +114,7 @@ def iter_classes(
submodule: types.ModuleType | str | tuple | list | None = None,
*,
recursive: bool = False,
predicate: Callable | None = None,
predicate: Callable[[type], bool] | None = None,
_seen: set | None = None,
) -> Iterator[type]:
"""Iterate over all classes of the module.
Expand Down Expand Up @@ -147,9 +154,16 @@ def collect_modules(
self,
*,
recursive: bool = False,
predicate: Callable | None = None,
predicate: Callable[[types.ModuleType], bool] | None = None,
submodule: types.ModuleType | str | tuple | list | None = None,
):
"""Collect submodules.
Arguments:
recursive: Collect recursively
predicate: Module filter predicate
submodule: Module to collect from. If None, collect from project module.
"""
for module in self.iter_modules(
recursive=recursive,
predicate=predicate,
Expand All @@ -162,7 +176,7 @@ def iter_modules(
*,
submodule: types.ModuleType | str | tuple | list | None = None,
recursive: bool = False,
predicate: Callable | None = None,
predicate: Callable[[types.ModuleType], bool] | None = None,
_seen: set | None = None,
) -> Iterator[types.ModuleType]:
"""Iterate over all submodules of the module.
Expand Down

0 comments on commit 35e2236

Please sign in to comment.