Skip to main content

ModuleDict

ModuleDict(modules=None)

A registered, insertion-ordered mapping from names to modules; look them up in your own forward. Constructed from a mapping or an iterable of (key, module) pairs; update takes the same.

__init__​

__init__(self, modules: 'Mapping[str, Module] | Iterable[tuple[str, Module]] | None' = None) -> 'None'

Initialize self. See help(type(self)) for accurate signature.

clear​

clear(self) -> 'None'

clear() -> None

Remove every entry.

items​

items(self) -> 'Iterable[tuple[str, Module]]'

items() -> the (name, module) pairs, in insertion order.

keys​

keys(self) -> 'Iterable[str]'

keys() -> the registered names, in insertion order.

pop​

pop(self, key: 'str') -> 'Module'

pop(key) -> Module

Remove and return the module under key.

update​

update(self, modules: 'Mapping[str, Module] | Iterable[tuple[str, Module]]') -> 'None'

update(modules) -> None

Add the entries of a mapping, or of an iterable of (key, module) pairs, overwriting existing keys.

values​

values(self) -> 'Iterable[Module]'

values() -> the modules, in insertion order.