Load a state object based on the provided token. Args: token: The token used to identify the state object. Returns: The loaded state object or None.
(self, token: StateToken[TOKEN_TYPE])
| 112 | ).absolute() |
| 113 | |
| 114 | async def load_state(self, token: StateToken[TOKEN_TYPE]) -> TOKEN_TYPE | None: |
| 115 | """Load a state object based on the provided token. |
| 116 | |
| 117 | Args: |
| 118 | token: The token used to identify the state object. |
| 119 | |
| 120 | Returns: |
| 121 | The loaded state object or None. |
| 122 | """ |
| 123 | token_path = self.token_path(token) |
| 124 | |
| 125 | if token_path.exists(): |
| 126 | try: |
| 127 | with token_path.open(mode="rb") as file: |
| 128 | return token.deserialize(fp=file) |
| 129 | except Exception: |
| 130 | pass |
| 131 | return None |
| 132 | |
| 133 | async def populate_substates( |
| 134 | self, token: BaseStateToken, state: BaseState, root_state: BaseState |
no test coverage detected