From d452b4117a50d6007f3839025df6e48317c41e5b Mon Sep 17 00:00:00 2001 From: Maxim Gonchar <maxim.mg.gonchar@gmail.com> Date: Tue, 28 Mar 2023 17:31:20 +0300 Subject: [PATCH] feat: Output.seti to set particular field of the output --- subtrees/dagflow/dagflow/output.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/subtrees/dagflow/dagflow/output.py b/subtrees/dagflow/dagflow/output.py index 8147fa0..5f98ed7 100644 --- a/subtrees/dagflow/dagflow/output.py +++ b/subtrees/dagflow/dagflow/output.py @@ -317,6 +317,22 @@ class Output: return True + def seti(self, idx: int, value: float, check_taint: bool = False, force: bool = False) -> bool: + if self.node._frozen and not force: + return False + + tainted = True + if check_taint: + tainted = self._data[udx] != value + + if tainted: + self._data[idx] = value + self.taint_children() + self.node.invalidate_parents() + self.node._tainted = False + + return tainted + def set( self, data: ArrayLike, check_taint: bool = False, force: bool = False ) -> bool: -- GitLab