brainstate.maybe_state#
- brainstate.maybe_state(val)[source]#
Extracts the value from a State object if given, otherwise returns the input value.
This function is useful for handling both State objects and raw values uniformly. If the input is a State object, it returns the value stored in that State. If the input is not a State object, it returns the input as is.