def get_state()

in azure/durable_functions/models/DurableEntityContext.py [0:0]


    def get_state(self, initializer: Optional[Callable[[], Any]] = None) -> Any:
        """Get the current state of this entity.

        Parameters
        ----------
        initializer: Optional[Callable[[], Any]]
            A 0-argument function to provide an initial state. Defaults to None.

        Returns
        -------
        Any
            The current state of the entity
        """
        state = self._state
        if state is not None:
            return state
        elif initializer:
            if not callable(initializer):
                raise Exception("initializer argument needs to be a callable function")
            state = initializer()
        return state