Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds docs for update() function to Reducer #447

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions burr/core/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <burr.core.state.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 <burr.core.action.Function.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


Expand Down