From 802970e79a53beaf7ce1a0dddd691b021944ad65 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Wed, 23 Aug 2023 17:12:54 +0200 Subject: [PATCH] simplify Chain#append --- src/refiners/fluxion/layers/chain.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/refiners/fluxion/layers/chain.py b/src/refiners/fluxion/layers/chain.py index 6b0f84e..6971c4a 100644 --- a/src/refiners/fluxion/layers/chain.py +++ b/src/refiners/fluxion/layers/chain.py @@ -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)