pockit.base.autoupdate

class AutoUpdate:

Utility class for managing dependencies between functions.

AutoUpdate(n_source: int, f_target: list[typing.Callable[[], NoneType]])
Arguments:
  • n_source: Number of sources.
  • f_target: List of target functions
n_in: int

Number of sources.

f_target: list[typing.Callable[[], NoneType]]

List of target functions.

dependent_table: list[list[int]]

Table of dependencies.

todo: list[bool]

List of targets that need to be updated.

def set_dependency(self, i_target: int, i_sources: list[int]) -> None:

Set dependency of the target function with index i_target on the sources with indices i_sources.

def update(self, i_source: int) -> None:

Call the target functions that depend on the source with index i_source.

def update_all(self) -> None:

Update all targets.