Skip to content

Commit c248a43

Browse files
committed
fix: Fix Python3.7 tests
1 parent fe2fd15 commit c248a43

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Python [finite-state machines](https://en.wikipedia.org/wiki/Finite-state_machin
1616

1717
</div>
1818

19-
Welcome to python-statemachine, an intuitive and powerful state machine framework designed for a
19+
Welcome to python-statemachine, an intuitive and powerful state machine library designed for a
2020
great developer experience. We provide an _pythonic_ and expressive API for implementing state
2121
machines in sync or asynchonous Python codebases.
2222

statemachine/dispatcher.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from operator import attrgetter
33
from typing import Any
44
from typing import Generator
5+
from typing import Tuple
56

67
from .signature import SignatureAdapter
78

@@ -15,7 +16,7 @@ class ObjectConfig(namedtuple("ObjectConfig", "obj skip_attrs resolver_id")):
1516
"""
1617

1718
@classmethod
18-
def from_obj(cls, obj, skip_attrs=None):
19+
def from_obj(cls, obj, skip_attrs=None) -> "ObjectConfig":
1920
if isinstance(obj, ObjectConfig):
2021
return obj
2122
else:
@@ -84,7 +85,7 @@ async def wrapper(*args, **kwargs):
8485

8586

8687
def _search_callable_attr_is_property(
87-
attr, configs: tuple[ObjectConfig]
88+
attr, configs: Tuple[ObjectConfig, ...]
8889
) -> "WrapSearchResult | None":
8990
# if the attr is a property, we'll try to find the object that has the
9091
# property on the configs
@@ -96,7 +97,7 @@ def _search_callable_attr_is_property(
9697
return None
9798

9899

99-
def _search_callable_attr_is_callable(attr, configs: tuple[ObjectConfig]) -> WrapSearchResult:
100+
def _search_callable_attr_is_callable(attr, configs: Tuple[ObjectConfig, ...]) -> WrapSearchResult:
100101
# if the attr is an unbounded method, we'll try to find the bounded method
101102
# on the configs
102103
if not hasattr(attr, "__self__"):
@@ -109,7 +110,7 @@ def _search_callable_attr_is_callable(attr, configs: tuple[ObjectConfig]) -> Wra
109110

110111

111112
def _search_callable_in_configs(
112-
attr, configs: tuple[ObjectConfig]
113+
attr, configs: Tuple[ObjectConfig, ...]
113114
) -> Generator[WrapSearchResult, None, None]:
114115
for obj, skip_attrs, resolver_id in configs:
115116
if attr in skip_attrs:
@@ -128,7 +129,9 @@ def _search_callable_in_configs(
128129
yield CallableSearchResult(attr, func, resolver_id)
129130

130131

131-
def search_callable(attr, configs: tuple) -> Generator[WrapSearchResult, None, None]: # noqa: C901
132+
def search_callable(
133+
attr, configs: Tuple[ObjectConfig, ...]
134+
) -> Generator[WrapSearchResult, None, None]: # noqa: C901
132135
if isinstance(attr, property):
133136
result = _search_callable_attr_is_property(attr, configs)
134137
if result is not None:
@@ -142,7 +145,7 @@ def search_callable(attr, configs: tuple) -> Generator[WrapSearchResult, None, N
142145
yield from _search_callable_in_configs(attr, configs)
143146

144147

145-
def resolver_factory(objects: tuple[ObjectConfig]):
148+
def resolver_factory(objects: Tuple[ObjectConfig, ...]):
146149
"""Factory that returns a configured resolver."""
147150

148151
def resolver(attr) -> Generator[WrapSearchResult, None, None]:
@@ -151,6 +154,6 @@ def resolver(attr) -> Generator[WrapSearchResult, None, None]:
151154
return resolver
152155

153156

154-
def resolver_factory_from_objects(*objects: tuple[Any]):
155-
configs = tuple(ObjectConfig.from_obj(o) for o in objects)
157+
def resolver_factory_from_objects(*objects: Tuple[Any, ...]):
158+
configs: Tuple[ObjectConfig, ...] = tuple(ObjectConfig.from_obj(o) for o in objects)
156159
return resolver_factory(configs)

statemachine/statemachine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(
7979
self.__processing: bool = False
8080
self._external_queue: deque = deque()
8181
self._callbacks_registry = CallbacksRegistry()
82-
self._states_for_instance: Dict["State", "State"] = {}
82+
self._states_for_instance: Dict[State, State] = {}
8383
self._observers: Dict[Any, Any] = {}
8484

8585
if self._abstract:

0 commit comments

Comments
 (0)