Skip to content

Commit 3c82a7e

Browse files
authored
improve self aenter typing (#6064)
1 parent f4561ec commit 3c82a7e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

reflex/istate/proxy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from typing import TYPE_CHECKING, Any, SupportsIndex, TypeVar
1515

1616
import wrapt
17+
from typing_extensions import Self
1718

1819
from reflex.base import Base
1920
from reflex.utils import prerequisites
@@ -93,7 +94,7 @@ def _is_mutable(self) -> bool:
9394
return self._self_parent_state_proxy._is_mutable() or self._self_mutable
9495
return self._self_mutable
9596

96-
async def __aenter__(self) -> StateProxy:
97+
async def __aenter__(self) -> Self:
9798
"""Enter the async context manager protocol.
9899
99100
Sets mutability to True and enters the `App.modify_state` async context,

reflex/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@ def dict(
22362236

22372237
return d
22382238

2239-
async def __aenter__(self) -> BaseState:
2239+
async def __aenter__(self) -> Self:
22402240
"""Enter the async context manager protocol.
22412241
22422242
This is a no-op for the State class and mainly used in background-tasks/StateProxy.

0 commit comments

Comments
 (0)