r"""Returns an iterable of key-module pairs for all the modules within this module, including itself, where 'key' is the dotted path from this module to the submodules. Args: prefix: prefix prepended to the path.
(
self, prefix: Optional[str] = None, **kwargs
)
| 355 | yield from self._flatten(with_key=False, predicate=_is_module, **kwargs) |
| 356 | |
| 357 | def named_modules( |
| 358 | self, prefix: Optional[str] = None, **kwargs |
| 359 | ) -> "Iterable[Tuple[str, Module]]": |
| 360 | r"""Returns an iterable of key-module pairs for all the modules within this |
| 361 | module, including itself, where 'key' is the dotted path from this module to the |
| 362 | submodules. |
| 363 | |
| 364 | Args: |
| 365 | prefix: prefix prepended to the path. |
| 366 | """ |
| 367 | if "with_parent" in kwargs and kwargs["with_parent"]: |
| 368 | yield ("" if prefix is None else prefix), self, None |
| 369 | else: |
| 370 | yield ("" if prefix is None else prefix), self |
| 371 | yield from self._flatten( |
| 372 | with_key=True, prefix=prefix, predicate=_is_module, **kwargs |
| 373 | ) |
| 374 | |
| 375 | def apply(self, fn: "Callable[[Module], Any]") -> None: |
| 376 | r"""Applies function ``fn`` to all the modules within this module, including |