From d7a5822c746f2f44a238e24e44793ff2940af40e Mon Sep 17 00:00:00 2001 From: elijahbenizzy Date: Mon, 2 Dec 2024 07:48:34 -0800 Subject: [PATCH] Adds docs for update() function to Reducer --- burr/core/action.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/burr/core/action.py b/burr/core/action.py index 5acabfe7..75e8dae5 100644 --- a/burr/core/action.py +++ b/burr/core/action.py @@ -124,6 +124,19 @@ def writes(self) -> list[str]: @abc.abstractmethod def update(self, result: dict, state: State) -> State: + """Performs a state update given a result and the current state. + Returns a new, modified :py:class:`State ` + (recall state is immutable -- simply changing the state in place will not work). + + In the context of Burr, this is only applied in the two-step actions, where + the :py:meth:`run ` and update() functions are separate. The + function-based APIs for Burr use the SingleStepAction class, which performs them both at once. + This is not (yet) exposed as an interface for users to extend. + + :param result: Result of a function executing on the state + :param state: State to update + :return: A new, modified state. + """ pass