requires_state#

biotite.application.requires_state(app_state)[source]#

A decorator for methods of Application subclasses that raises an AppStateError in case the method is called, when the Application is not in the specified AppState app_state.

Parameters:
app_stateAppState

The required app state.

Examples

Raises AppStateError when function is called, if Application is not in one of the specified states:

>>> @requires_state(AppState.RUNNING | AppState.FINISHED)
... def function(self):
...     pass