mirror of
https://github.com/finegrain-ai/refiners.git
synced 2024-11-22 06:08:46 +00:00
simplify Chain#append
This commit is contained in:
parent
beacfe816b
commit
802970e79a
|
@ -337,12 +337,7 @@ class Chain(ContextModule):
|
|||
raise ValueError(f"No module of type {module_type.__name__} found in the chain.")
|
||||
|
||||
def append(self, module: Module) -> None:
|
||||
modules = list(self)
|
||||
modules.append(module)
|
||||
self._regenerate_keys(modules)
|
||||
if isinstance(module, ContextModule):
|
||||
module._set_parent(self)
|
||||
self._register_provider()
|
||||
self.insert(-1, module)
|
||||
|
||||
def pop(self, index: int = -1) -> Module | tuple[Module]:
|
||||
modules = list(self)
|
||||
|
|
Loading…
Reference in a new issue