Skip to content

Commit

Permalink
docs: (Async)TransitionConfig can be Collection[str] now
Browse files Browse the repository at this point in the history
  • Loading branch information
aleneum committed Aug 13, 2024
1 parent 80ae05a commit 4d8d103
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions transitions/core.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from logging import Logger
from typing import (
Any, Optional, Callable, Sequence, Union, Iterable, List, Dict, DefaultDict,
Type, Deque, OrderedDict, Tuple, Literal, Collection, TypedDict, Mapping, Required
Type, Deque, OrderedDict, Tuple, Literal, Collection, TypedDict, Required
)

# Enums are supported for Python 3.4+ and Python 2.7 with enum34 package installed
Expand Down Expand Up @@ -102,8 +102,8 @@ class TransitionConfigDict(TypedDict, total=False):
conditions: CallbacksArg
unless: CallbacksArg

# For backwards compatibility we also accept untyped dictionaries/mappings
TransitionConfig = Union[TransitionConfigList, TransitionConfigDict, Mapping[str, Any]]
# For backwards compatibility we also accept generic collections
TransitionConfig = Union[TransitionConfigList, TransitionConfigDict, Collection[str]]

class EventData:
state: State
Expand Down
6 changes: 3 additions & 3 deletions transitions/extensions/asyncio.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ from ..core import Callback, Condition, Event, EventData, Machine, State, Transi
from .nesting import HierarchicalMachine, NestedEvent, NestedState, NestedTransition, NestedEventData, \
NestedStateConfig, NestedStateIdentifier
from typing import Any, Awaitable, Optional, List, Type, Dict, Deque, Callable, Union, Iterable, DefaultDict, Literal, \
Sequence, Coroutine, Mapping, Required, TypedDict
Sequence, Coroutine, Required, TypedDict, Collection
from asyncio import Task
from logging import Logger
from enum import Enum
Expand All @@ -27,8 +27,8 @@ class AsyncTransitionConfigDict(TypedDict, total=False):
conditions: AsyncCallbacksArg
unless: AsyncCallbacksArg

# For backwards compatibility we also accept untyped dictionaries/mappings
AsyncTransitionConfig = Union[TransitionConfigList, AsyncTransitionConfigDict, Mapping[str, Any]]
# For backwards compatibility we also accept generic collections
AsyncTransitionConfig = Union[TransitionConfigList, AsyncTransitionConfigDict, Collection[str]]

class AsyncState(State):
async def enter(self, event_data: AsyncEventData) -> None: ... # type: ignore[override]
Expand Down

0 comments on commit 4d8d103

Please sign in to comment.