diff options
Diffstat (limited to 'src/apscheduler/converters.py')
-rw-r--r-- | src/apscheduler/converters.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/apscheduler/converters.py b/src/apscheduler/converters.py index 7502327..3518d44 100644 --- a/src/apscheduler/converters.py +++ b/src/apscheduler/converters.py @@ -48,6 +48,17 @@ def as_enum(enum_class: type[TEnum]) -> Callable[[TEnum | str], TEnum]: return converter +def as_async_eventbroker( + value: abc.EventBroker | abc.AsyncEventBroker, +) -> abc.AsyncEventBroker: + if isinstance(value, abc.EventBroker): + from apscheduler.eventbrokers.async_adapter import AsyncEventBrokerAdapter + + return AsyncEventBrokerAdapter(value) + + return value + + def as_async_datastore(value: abc.DataStore | abc.AsyncDataStore) -> abc.AsyncDataStore: if isinstance(value, abc.DataStore): from apscheduler.datastores.async_adapter import AsyncDataStoreAdapter |