a_sync package
Subpackages
- a_sync.a_sync package
- Subpackages
- Submodules
- a_sync.a_sync._descriptor module
ASyncDescriptor
ASyncDescriptor.__init__()
ASyncDescriptor._all()
ASyncDescriptor._any()
ASyncDescriptor._asyncify()
ASyncDescriptor._max()
ASyncDescriptor._min()
ASyncDescriptor._sum()
ASyncDescriptor.map()
ASyncDescriptor._await
ASyncDescriptor.all
ASyncDescriptor.any
ASyncDescriptor.default
ASyncDescriptor.field_name
ASyncDescriptor.max
ASyncDescriptor.min
ASyncDescriptor.modifiers
ASyncDescriptor.sum
ASyncDescriptor.wrapped
- a_sync.a_sync._flags module
- a_sync.a_sync._helpers module
- a_sync.a_sync._kwargs module
- a_sync.a_sync._meta module
- a_sync.a_sync.abstract module
- a_sync.a_sync.base module
- a_sync.a_sync.config module
- a_sync.a_sync.decorator module
- a_sync.a_sync.function module
ASyncDecorator
ASyncDecoratorAsyncDefault
ASyncDecoratorAsyncDefault.__call__()
ASyncDecoratorAsyncDefault.__init__()
ASyncDecoratorAsyncDefault._asyncify()
ASyncDecoratorAsyncDefault.validate_inputs()
ASyncDecoratorAsyncDefault._await
ASyncDecoratorAsyncDefault.default
ASyncDecoratorAsyncDefault.modifiers
ASyncDecoratorAsyncDefault.wrapped
ASyncDecoratorSyncDefault
ASyncFunction
ASyncFunction.__call__()
ASyncFunction.__init__()
ASyncFunction._asyncify()
ASyncFunction._run_sync()
ASyncFunction.all()
ASyncFunction.any()
ASyncFunction.map()
ASyncFunction.max()
ASyncFunction.min()
ASyncFunction.sum()
ASyncFunction._async_def
ASyncFunction._async_wrap
ASyncFunction._asyncified
ASyncFunction._await
ASyncFunction._modified_fn
ASyncFunction._sync_default
ASyncFunction._sync_wrap
ASyncFunction.default
ASyncFunction.fn
ASyncFunction.modifiers
ASyncFunction.wrapped
ASyncFunctionAsyncDefault
ASyncFunctionAsyncDefault.__call__()
ASyncFunctionAsyncDefault.__init__()
ASyncFunctionAsyncDefault._asyncify()
ASyncFunctionAsyncDefault._run_sync()
ASyncFunctionAsyncDefault.all()
ASyncFunctionAsyncDefault.any()
ASyncFunctionAsyncDefault.map()
ASyncFunctionAsyncDefault.max()
ASyncFunctionAsyncDefault.min()
ASyncFunctionAsyncDefault.sum()
ASyncFunctionAsyncDefault._async_def
ASyncFunctionAsyncDefault._async_wrap
ASyncFunctionAsyncDefault._asyncified
ASyncFunctionAsyncDefault._await
ASyncFunctionAsyncDefault._modified_fn
ASyncFunctionAsyncDefault._sync_default
ASyncFunctionAsyncDefault._sync_wrap
ASyncFunctionAsyncDefault.default
ASyncFunctionAsyncDefault.fn
ASyncFunctionAsyncDefault.modifiers
ASyncFunctionAsyncDefault.wrapped
ASyncFunctionSyncDefault
ASyncFunctionSyncDefault.__call__()
ASyncFunctionSyncDefault.__init__()
ASyncFunctionSyncDefault._asyncify()
ASyncFunctionSyncDefault._run_sync()
ASyncFunctionSyncDefault.all()
ASyncFunctionSyncDefault.any()
ASyncFunctionSyncDefault.map()
ASyncFunctionSyncDefault.max()
ASyncFunctionSyncDefault.min()
ASyncFunctionSyncDefault.sum()
ASyncFunctionSyncDefault._async_def
ASyncFunctionSyncDefault._async_wrap
ASyncFunctionSyncDefault._asyncified
ASyncFunctionSyncDefault._await
ASyncFunctionSyncDefault._modified_fn
ASyncFunctionSyncDefault._sync_default
ASyncFunctionSyncDefault._sync_wrap
ASyncFunctionSyncDefault.default
ASyncFunctionSyncDefault.fn
ASyncFunctionSyncDefault.modifiers
ASyncFunctionSyncDefault.wrapped
ModifiedMixin
_check_not_genfunc()
_validate_wrapped_fn()
- a_sync.a_sync.method module
ASyncBoundMethod
ASyncBoundMethod.__call__()
ASyncBoundMethod.__cancel_cache_handle()
ASyncBoundMethod.__init__()
ASyncBoundMethod._asyncify()
ASyncBoundMethod._run_sync()
ASyncBoundMethod._should_await()
ASyncBoundMethod.all()
ASyncBoundMethod.any()
ASyncBoundMethod.map()
ASyncBoundMethod.max()
ASyncBoundMethod.min()
ASyncBoundMethod.sum()
ASyncBoundMethod._async_def
ASyncBoundMethod._async_wrap
ASyncBoundMethod._asyncified
ASyncBoundMethod._await
ASyncBoundMethod._cache_handle
ASyncBoundMethod._is_async_def
ASyncBoundMethod._modified_fn
ASyncBoundMethod._sync_default
ASyncBoundMethod._sync_wrap
ASyncBoundMethod.default
ASyncBoundMethod.fn
ASyncBoundMethod.modifiers
ASyncBoundMethod.wrapped
ASyncBoundMethodAsyncDefault
ASyncBoundMethodAsyncDefault.__call__()
ASyncBoundMethodAsyncDefault.__init__()
ASyncBoundMethodAsyncDefault._asyncify()
ASyncBoundMethodAsyncDefault._run_sync()
ASyncBoundMethodAsyncDefault._should_await()
ASyncBoundMethodAsyncDefault.all()
ASyncBoundMethodAsyncDefault.any()
ASyncBoundMethodAsyncDefault.map()
ASyncBoundMethodAsyncDefault.max()
ASyncBoundMethodAsyncDefault.min()
ASyncBoundMethodAsyncDefault.sum()
ASyncBoundMethodAsyncDefault._async_def
ASyncBoundMethodAsyncDefault._async_wrap
ASyncBoundMethodAsyncDefault._asyncified
ASyncBoundMethodAsyncDefault._await
ASyncBoundMethodAsyncDefault._cache_handle
ASyncBoundMethodAsyncDefault._is_async_def
ASyncBoundMethodAsyncDefault._modified_fn
ASyncBoundMethodAsyncDefault._sync_default
ASyncBoundMethodAsyncDefault._sync_wrap
ASyncBoundMethodAsyncDefault.default
ASyncBoundMethodAsyncDefault.fn
ASyncBoundMethodAsyncDefault.modifiers
ASyncBoundMethodAsyncDefault.wrapped
ASyncBoundMethodSyncDefault
ASyncBoundMethodSyncDefault.__call__()
ASyncBoundMethodSyncDefault.__init__()
ASyncBoundMethodSyncDefault._asyncify()
ASyncBoundMethodSyncDefault._run_sync()
ASyncBoundMethodSyncDefault._should_await()
ASyncBoundMethodSyncDefault.all()
ASyncBoundMethodSyncDefault.any()
ASyncBoundMethodSyncDefault.map()
ASyncBoundMethodSyncDefault.max()
ASyncBoundMethodSyncDefault.min()
ASyncBoundMethodSyncDefault.sum()
ASyncBoundMethodSyncDefault._async_def
ASyncBoundMethodSyncDefault._async_wrap
ASyncBoundMethodSyncDefault._asyncified
ASyncBoundMethodSyncDefault._await
ASyncBoundMethodSyncDefault._cache_handle
ASyncBoundMethodSyncDefault._is_async_def
ASyncBoundMethodSyncDefault._modified_fn
ASyncBoundMethodSyncDefault._sync_default
ASyncBoundMethodSyncDefault._sync_wrap
ASyncBoundMethodSyncDefault.default
ASyncBoundMethodSyncDefault.fn
ASyncBoundMethodSyncDefault.modifiers
ASyncBoundMethodSyncDefault.wrapped
ASyncMethodDescriptor
ASyncMethodDescriptor.__call__()
ASyncMethodDescriptor.__init__()
ASyncMethodDescriptor._all()
ASyncMethodDescriptor._any()
ASyncMethodDescriptor._asyncify()
ASyncMethodDescriptor._get_cache_handle()
ASyncMethodDescriptor._max()
ASyncMethodDescriptor._min()
ASyncMethodDescriptor._sum()
ASyncMethodDescriptor.map()
ASyncMethodDescriptor._await
ASyncMethodDescriptor.all
ASyncMethodDescriptor.any
ASyncMethodDescriptor.default
ASyncMethodDescriptor.field_name
ASyncMethodDescriptor.max
ASyncMethodDescriptor.min
ASyncMethodDescriptor.modifiers
ASyncMethodDescriptor.sum
ASyncMethodDescriptor.wrapped
ASyncMethodDescriptorAsyncDefault
ASyncMethodDescriptorAsyncDefault.__call__()
ASyncMethodDescriptorAsyncDefault.__init__()
ASyncMethodDescriptorAsyncDefault._all()
ASyncMethodDescriptorAsyncDefault._any()
ASyncMethodDescriptorAsyncDefault._asyncify()
ASyncMethodDescriptorAsyncDefault._get_cache_handle()
ASyncMethodDescriptorAsyncDefault._max()
ASyncMethodDescriptorAsyncDefault._min()
ASyncMethodDescriptorAsyncDefault._sum()
ASyncMethodDescriptorAsyncDefault.map()
ASyncMethodDescriptorAsyncDefault._await
ASyncMethodDescriptorAsyncDefault.all
ASyncMethodDescriptorAsyncDefault.any
ASyncMethodDescriptorAsyncDefault.default
ASyncMethodDescriptorAsyncDefault.field_name
ASyncMethodDescriptorAsyncDefault.max
ASyncMethodDescriptorAsyncDefault.min
ASyncMethodDescriptorAsyncDefault.modifiers
ASyncMethodDescriptorAsyncDefault.sum
ASyncMethodDescriptorAsyncDefault.wrapped
ASyncMethodDescriptorSyncDefault
ASyncMethodDescriptorSyncDefault.__call__()
ASyncMethodDescriptorSyncDefault.__init__()
ASyncMethodDescriptorSyncDefault._all()
ASyncMethodDescriptorSyncDefault._any()
ASyncMethodDescriptorSyncDefault._asyncify()
ASyncMethodDescriptorSyncDefault._get_cache_handle()
ASyncMethodDescriptorSyncDefault._max()
ASyncMethodDescriptorSyncDefault._min()
ASyncMethodDescriptorSyncDefault._sum()
ASyncMethodDescriptorSyncDefault.map()
ASyncMethodDescriptorSyncDefault._await
ASyncMethodDescriptorSyncDefault.all
ASyncMethodDescriptorSyncDefault.any
ASyncMethodDescriptorSyncDefault.default
ASyncMethodDescriptorSyncDefault.field_name
ASyncMethodDescriptorSyncDefault.max
ASyncMethodDescriptorSyncDefault.min
ASyncMethodDescriptorSyncDefault.modifiers
ASyncMethodDescriptorSyncDefault.sum
ASyncMethodDescriptorSyncDefault.wrapped
- a_sync.a_sync.property module
ASyncCachedPropertyDescriptor
ASyncCachedPropertyDescriptor.__init__()
ASyncCachedPropertyDescriptor._all()
ASyncCachedPropertyDescriptor._any()
ASyncCachedPropertyDescriptor._asyncify()
ASyncCachedPropertyDescriptor._check_method_name()
ASyncCachedPropertyDescriptor._check_method_sync()
ASyncCachedPropertyDescriptor._max()
ASyncCachedPropertyDescriptor._min()
ASyncCachedPropertyDescriptor._sum()
ASyncCachedPropertyDescriptor.already_loaded()
ASyncCachedPropertyDescriptor.del_cache_value()
ASyncCachedPropertyDescriptor.deleter()
ASyncCachedPropertyDescriptor.get()
ASyncCachedPropertyDescriptor.get_cache()
ASyncCachedPropertyDescriptor.get_cache_value()
ASyncCachedPropertyDescriptor.get_instance_state()
ASyncCachedPropertyDescriptor.get_loader()
ASyncCachedPropertyDescriptor.get_lock()
ASyncCachedPropertyDescriptor.has_cache_value()
ASyncCachedPropertyDescriptor.map()
ASyncCachedPropertyDescriptor.not_loaded()
ASyncCachedPropertyDescriptor.pop_lock()
ASyncCachedPropertyDescriptor.set_cache_value()
ASyncCachedPropertyDescriptor.setter()
ASyncCachedPropertyDescriptor._await
ASyncCachedPropertyDescriptor.all
ASyncCachedPropertyDescriptor.any
ASyncCachedPropertyDescriptor.default
ASyncCachedPropertyDescriptor.field_name
ASyncCachedPropertyDescriptor.hidden_method_descriptor
ASyncCachedPropertyDescriptor.hidden_method_name
ASyncCachedPropertyDescriptor.max
ASyncCachedPropertyDescriptor.min
ASyncCachedPropertyDescriptor.modifiers
ASyncCachedPropertyDescriptor.sum
ASyncCachedPropertyDescriptor.wrapped
ASyncCachedPropertyDescriptorAsyncDefault
ASyncCachedPropertyDescriptorAsyncDefault.__init__()
ASyncCachedPropertyDescriptorAsyncDefault._all()
ASyncCachedPropertyDescriptorAsyncDefault._any()
ASyncCachedPropertyDescriptorAsyncDefault._asyncify()
ASyncCachedPropertyDescriptorAsyncDefault._check_method_name()
ASyncCachedPropertyDescriptorAsyncDefault._check_method_sync()
ASyncCachedPropertyDescriptorAsyncDefault._max()
ASyncCachedPropertyDescriptorAsyncDefault._min()
ASyncCachedPropertyDescriptorAsyncDefault._sum()
ASyncCachedPropertyDescriptorAsyncDefault.already_loaded()
ASyncCachedPropertyDescriptorAsyncDefault.del_cache_value()
ASyncCachedPropertyDescriptorAsyncDefault.deleter()
ASyncCachedPropertyDescriptorAsyncDefault.get()
ASyncCachedPropertyDescriptorAsyncDefault.get_cache()
ASyncCachedPropertyDescriptorAsyncDefault.get_cache_value()
ASyncCachedPropertyDescriptorAsyncDefault.get_instance_state()
ASyncCachedPropertyDescriptorAsyncDefault.get_loader()
ASyncCachedPropertyDescriptorAsyncDefault.get_lock()
ASyncCachedPropertyDescriptorAsyncDefault.has_cache_value()
ASyncCachedPropertyDescriptorAsyncDefault.map()
ASyncCachedPropertyDescriptorAsyncDefault.not_loaded()
ASyncCachedPropertyDescriptorAsyncDefault.pop_lock()
ASyncCachedPropertyDescriptorAsyncDefault.set_cache_value()
ASyncCachedPropertyDescriptorAsyncDefault.setter()
ASyncCachedPropertyDescriptorAsyncDefault._await
ASyncCachedPropertyDescriptorAsyncDefault.all
ASyncCachedPropertyDescriptorAsyncDefault.any
ASyncCachedPropertyDescriptorAsyncDefault.default
ASyncCachedPropertyDescriptorAsyncDefault.field_name
ASyncCachedPropertyDescriptorAsyncDefault.hidden_method_descriptor
ASyncCachedPropertyDescriptorAsyncDefault.hidden_method_name
ASyncCachedPropertyDescriptorAsyncDefault.max
ASyncCachedPropertyDescriptorAsyncDefault.min
ASyncCachedPropertyDescriptorAsyncDefault.modifiers
ASyncCachedPropertyDescriptorAsyncDefault.sum
ASyncCachedPropertyDescriptorAsyncDefault.wrapped
ASyncCachedPropertyDescriptorSyncDefault
ASyncCachedPropertyDescriptorSyncDefault.__init__()
ASyncCachedPropertyDescriptorSyncDefault._all()
ASyncCachedPropertyDescriptorSyncDefault._any()
ASyncCachedPropertyDescriptorSyncDefault._asyncify()
ASyncCachedPropertyDescriptorSyncDefault._check_method_name()
ASyncCachedPropertyDescriptorSyncDefault._check_method_sync()
ASyncCachedPropertyDescriptorSyncDefault._max()
ASyncCachedPropertyDescriptorSyncDefault._min()
ASyncCachedPropertyDescriptorSyncDefault._sum()
ASyncCachedPropertyDescriptorSyncDefault.already_loaded()
ASyncCachedPropertyDescriptorSyncDefault.del_cache_value()
ASyncCachedPropertyDescriptorSyncDefault.deleter()
ASyncCachedPropertyDescriptorSyncDefault.get()
ASyncCachedPropertyDescriptorSyncDefault.get_cache()
ASyncCachedPropertyDescriptorSyncDefault.get_cache_value()
ASyncCachedPropertyDescriptorSyncDefault.get_instance_state()
ASyncCachedPropertyDescriptorSyncDefault.get_loader()
ASyncCachedPropertyDescriptorSyncDefault.get_lock()
ASyncCachedPropertyDescriptorSyncDefault.has_cache_value()
ASyncCachedPropertyDescriptorSyncDefault.map()
ASyncCachedPropertyDescriptorSyncDefault.not_loaded()
ASyncCachedPropertyDescriptorSyncDefault.pop_lock()
ASyncCachedPropertyDescriptorSyncDefault.set_cache_value()
ASyncCachedPropertyDescriptorSyncDefault.setter()
ASyncCachedPropertyDescriptorSyncDefault._await
ASyncCachedPropertyDescriptorSyncDefault.all
ASyncCachedPropertyDescriptorSyncDefault.any
ASyncCachedPropertyDescriptorSyncDefault.default
ASyncCachedPropertyDescriptorSyncDefault.field_name
ASyncCachedPropertyDescriptorSyncDefault.hidden_method_descriptor
ASyncCachedPropertyDescriptorSyncDefault.hidden_method_name
ASyncCachedPropertyDescriptorSyncDefault.max
ASyncCachedPropertyDescriptorSyncDefault.min
ASyncCachedPropertyDescriptorSyncDefault.modifiers
ASyncCachedPropertyDescriptorSyncDefault.sum
ASyncCachedPropertyDescriptorSyncDefault.wrapped
ASyncPropertyDescriptor
ASyncPropertyDescriptor.__init__()
ASyncPropertyDescriptor._all()
ASyncPropertyDescriptor._any()
ASyncPropertyDescriptor._asyncify()
ASyncPropertyDescriptor._max()
ASyncPropertyDescriptor._min()
ASyncPropertyDescriptor._sum()
ASyncPropertyDescriptor.awaitable_only()
ASyncPropertyDescriptor.get()
ASyncPropertyDescriptor.get_loader()
ASyncPropertyDescriptor.map()
ASyncPropertyDescriptor._await
ASyncPropertyDescriptor.all
ASyncPropertyDescriptor.any
ASyncPropertyDescriptor.default
ASyncPropertyDescriptor.field_name
ASyncPropertyDescriptor.hidden_method_descriptor
ASyncPropertyDescriptor.hidden_method_name
ASyncPropertyDescriptor.max
ASyncPropertyDescriptor.min
ASyncPropertyDescriptor.modifiers
ASyncPropertyDescriptor.sum
ASyncPropertyDescriptor.wrapped
ASyncPropertyDescriptorAsyncDefault
ASyncPropertyDescriptorAsyncDefault.__init__()
ASyncPropertyDescriptorAsyncDefault._all()
ASyncPropertyDescriptorAsyncDefault._any()
ASyncPropertyDescriptorAsyncDefault._asyncify()
ASyncPropertyDescriptorAsyncDefault._max()
ASyncPropertyDescriptorAsyncDefault._min()
ASyncPropertyDescriptorAsyncDefault._sum()
ASyncPropertyDescriptorAsyncDefault.awaitable_only()
ASyncPropertyDescriptorAsyncDefault.get()
ASyncPropertyDescriptorAsyncDefault.get_loader()
ASyncPropertyDescriptorAsyncDefault.map()
ASyncPropertyDescriptorAsyncDefault._await
ASyncPropertyDescriptorAsyncDefault.all
ASyncPropertyDescriptorAsyncDefault.any
ASyncPropertyDescriptorAsyncDefault.default
ASyncPropertyDescriptorAsyncDefault.field_name
ASyncPropertyDescriptorAsyncDefault.hidden_method_descriptor
ASyncPropertyDescriptorAsyncDefault.hidden_method_name
ASyncPropertyDescriptorAsyncDefault.max
ASyncPropertyDescriptorAsyncDefault.min
ASyncPropertyDescriptorAsyncDefault.modifiers
ASyncPropertyDescriptorAsyncDefault.sum
ASyncPropertyDescriptorAsyncDefault.wrapped
ASyncPropertyDescriptorSyncDefault
ASyncPropertyDescriptorSyncDefault.__init__()
ASyncPropertyDescriptorSyncDefault._all()
ASyncPropertyDescriptorSyncDefault._any()
ASyncPropertyDescriptorSyncDefault._asyncify()
ASyncPropertyDescriptorSyncDefault._max()
ASyncPropertyDescriptorSyncDefault._min()
ASyncPropertyDescriptorSyncDefault._sum()
ASyncPropertyDescriptorSyncDefault.awaitable_only()
ASyncPropertyDescriptorSyncDefault.get()
ASyncPropertyDescriptorSyncDefault.get_loader()
ASyncPropertyDescriptorSyncDefault.map()
ASyncPropertyDescriptorSyncDefault._await
ASyncPropertyDescriptorSyncDefault.all
ASyncPropertyDescriptorSyncDefault.any
ASyncPropertyDescriptorSyncDefault.default
ASyncPropertyDescriptorSyncDefault.field_name
ASyncPropertyDescriptorSyncDefault.hidden_method_descriptor
ASyncPropertyDescriptorSyncDefault.hidden_method_name
ASyncPropertyDescriptorSyncDefault.max
ASyncPropertyDescriptorSyncDefault.min
ASyncPropertyDescriptorSyncDefault.modifiers
ASyncPropertyDescriptorSyncDefault.sum
ASyncPropertyDescriptorSyncDefault.wrapped
HiddenMethod
HiddenMethod.__call__()
HiddenMethod.__init__()
HiddenMethod._asyncify()
HiddenMethod._run_sync()
HiddenMethod._should_await()
HiddenMethod.all()
HiddenMethod.any()
HiddenMethod.map()
HiddenMethod.max()
HiddenMethod.min()
HiddenMethod.sum()
HiddenMethod._async_def
HiddenMethod._async_wrap
HiddenMethod._asyncified
HiddenMethod._await
HiddenMethod._cache_handle
HiddenMethod._is_async_def
HiddenMethod._modified_fn
HiddenMethod._sync_default
HiddenMethod._sync_wrap
HiddenMethod.default
HiddenMethod.fn
HiddenMethod.modifiers
HiddenMethod.wrapped
HiddenMethodDescriptor
HiddenMethodDescriptor.__call__()
HiddenMethodDescriptor.__init__()
HiddenMethodDescriptor._all()
HiddenMethodDescriptor._any()
HiddenMethodDescriptor._asyncify()
HiddenMethodDescriptor._get_cache_handle()
HiddenMethodDescriptor._max()
HiddenMethodDescriptor._min()
HiddenMethodDescriptor._sum()
HiddenMethodDescriptor.map()
HiddenMethodDescriptor._await
HiddenMethodDescriptor.all
HiddenMethodDescriptor.any
HiddenMethodDescriptor.default
HiddenMethodDescriptor.field_name
HiddenMethodDescriptor.max
HiddenMethodDescriptor.min
HiddenMethodDescriptor.modifiers
HiddenMethodDescriptor.sum
HiddenMethodDescriptor.wrapped
_ASyncPropertyDescriptorBase
_ASyncPropertyDescriptorBase.__init__()
_ASyncPropertyDescriptorBase._all()
_ASyncPropertyDescriptorBase._any()
_ASyncPropertyDescriptorBase._asyncify()
_ASyncPropertyDescriptorBase._max()
_ASyncPropertyDescriptorBase._min()
_ASyncPropertyDescriptorBase._sum()
_ASyncPropertyDescriptorBase.get()
_ASyncPropertyDescriptorBase.map()
_ASyncPropertyDescriptorBase._await
_ASyncPropertyDescriptorBase.all
_ASyncPropertyDescriptorBase.any
_ASyncPropertyDescriptorBase.default
_ASyncPropertyDescriptorBase.field_name
_ASyncPropertyDescriptorBase.hidden_method_descriptor
_ASyncPropertyDescriptorBase.hidden_method_name
_ASyncPropertyDescriptorBase.max
_ASyncPropertyDescriptorBase.min
_ASyncPropertyDescriptorBase.modifiers
_ASyncPropertyDescriptorBase.sum
_ASyncPropertyDescriptorBase.wrapped
cached_property
cached_property.__init__()
cached_property._all()
cached_property._any()
cached_property._asyncify()
cached_property._check_method_name()
cached_property._check_method_sync()
cached_property._max()
cached_property._min()
cached_property._sum()
cached_property.already_loaded()
cached_property.del_cache_value()
cached_property.deleter()
cached_property.get()
cached_property.get_cache()
cached_property.get_cache_value()
cached_property.get_instance_state()
cached_property.get_loader()
cached_property.get_lock()
cached_property.has_cache_value()
cached_property.map()
cached_property.not_loaded()
cached_property.pop_lock()
cached_property.set_cache_value()
cached_property.setter()
cached_property._await
cached_property.all
cached_property.any
cached_property.default
cached_property.field_name
cached_property.hidden_method_descriptor
cached_property.hidden_method_name
cached_property.max
cached_property.min
cached_property.modifiers
cached_property.sum
cached_property.wrapped
property
property.__init__()
property._all()
property._any()
property._asyncify()
property._max()
property._min()
property._sum()
property.awaitable_only()
property.get()
property.get_loader()
property.map()
property._await
property.all
property.any
property.default
property.field_name
property.hidden_method_descriptor
property.hidden_method_name
property.max
property.min
property.modifiers
property.sum
property.wrapped
_is_a_sync_instance()
_parse_args()
a_sync_cached_property()
a_sync_property()
- a_sync.a_sync.singleton module
- Module contents
ASyncCachedPropertyDescriptor
ASyncCachedPropertyDescriptor.__init__()
ASyncCachedPropertyDescriptor._all()
ASyncCachedPropertyDescriptor._any()
ASyncCachedPropertyDescriptor._asyncify()
ASyncCachedPropertyDescriptor._check_method_name()
ASyncCachedPropertyDescriptor._check_method_sync()
ASyncCachedPropertyDescriptor._max()
ASyncCachedPropertyDescriptor._min()
ASyncCachedPropertyDescriptor._sum()
ASyncCachedPropertyDescriptor.already_loaded()
ASyncCachedPropertyDescriptor.del_cache_value()
ASyncCachedPropertyDescriptor.deleter()
ASyncCachedPropertyDescriptor.get()
ASyncCachedPropertyDescriptor.get_cache()
ASyncCachedPropertyDescriptor.get_cache_value()
ASyncCachedPropertyDescriptor.get_instance_state()
ASyncCachedPropertyDescriptor.get_loader()
ASyncCachedPropertyDescriptor.get_lock()
ASyncCachedPropertyDescriptor.has_cache_value()
ASyncCachedPropertyDescriptor.map()
ASyncCachedPropertyDescriptor.not_loaded()
ASyncCachedPropertyDescriptor.pop_lock()
ASyncCachedPropertyDescriptor.set_cache_value()
ASyncCachedPropertyDescriptor.setter()
ASyncCachedPropertyDescriptor._await
ASyncCachedPropertyDescriptor.all
ASyncCachedPropertyDescriptor.any
ASyncCachedPropertyDescriptor.default
ASyncCachedPropertyDescriptor.field_name
ASyncCachedPropertyDescriptor.hidden_method_descriptor
ASyncCachedPropertyDescriptor.hidden_method_name
ASyncCachedPropertyDescriptor.max
ASyncCachedPropertyDescriptor.min
ASyncCachedPropertyDescriptor.modifiers
ASyncCachedPropertyDescriptor.sum
ASyncCachedPropertyDescriptor.wrapped
ASyncFunction
ASyncFunction.__call__()
ASyncFunction.__init__()
ASyncFunction._asyncify()
ASyncFunction._run_sync()
ASyncFunction.all()
ASyncFunction.any()
ASyncFunction.map()
ASyncFunction.max()
ASyncFunction.min()
ASyncFunction.sum()
ASyncFunction._async_def
ASyncFunction._async_wrap
ASyncFunction._asyncified
ASyncFunction._await
ASyncFunction._modified_fn
ASyncFunction._sync_default
ASyncFunction._sync_wrap
ASyncFunction.default
ASyncFunction.fn
ASyncFunction.modifiers
ASyncFunction.wrapped
ASyncGenericBase
ASyncPropertyDescriptor
ASyncPropertyDescriptor.__init__()
ASyncPropertyDescriptor._all()
ASyncPropertyDescriptor._any()
ASyncPropertyDescriptor._asyncify()
ASyncPropertyDescriptor._max()
ASyncPropertyDescriptor._min()
ASyncPropertyDescriptor._sum()
ASyncPropertyDescriptor.awaitable_only()
ASyncPropertyDescriptor.get()
ASyncPropertyDescriptor.get_loader()
ASyncPropertyDescriptor.map()
ASyncPropertyDescriptor._await
ASyncPropertyDescriptor.all
ASyncPropertyDescriptor.any
ASyncPropertyDescriptor.default
ASyncPropertyDescriptor.field_name
ASyncPropertyDescriptor.hidden_method_descriptor
ASyncPropertyDescriptor.hidden_method_name
ASyncPropertyDescriptor.max
ASyncPropertyDescriptor.min
ASyncPropertyDescriptor.modifiers
ASyncPropertyDescriptor.sum
ASyncPropertyDescriptor.wrapped
HiddenMethod
HiddenMethod.__call__()
HiddenMethod.__init__()
HiddenMethod._asyncify()
HiddenMethod._run_sync()
HiddenMethod._should_await()
HiddenMethod.all()
HiddenMethod.any()
HiddenMethod.map()
HiddenMethod.max()
HiddenMethod.min()
HiddenMethod.sum()
HiddenMethod._async_def
HiddenMethod._async_wrap
HiddenMethod._asyncified
HiddenMethod._await
HiddenMethod._cache_handle
HiddenMethod._is_async_def
HiddenMethod._modified_fn
HiddenMethod._sync_default
HiddenMethod._sync_wrap
HiddenMethod.default
HiddenMethod.fn
HiddenMethod.modifiers
HiddenMethod.wrapped
HiddenMethodDescriptor
HiddenMethodDescriptor.__call__()
HiddenMethodDescriptor.__init__()
HiddenMethodDescriptor._all()
HiddenMethodDescriptor._any()
HiddenMethodDescriptor._asyncify()
HiddenMethodDescriptor._get_cache_handle()
HiddenMethodDescriptor._max()
HiddenMethodDescriptor._min()
HiddenMethodDescriptor._sum()
HiddenMethodDescriptor.map()
HiddenMethodDescriptor._await
HiddenMethodDescriptor.all
HiddenMethodDescriptor.any
HiddenMethodDescriptor.default
HiddenMethodDescriptor.field_name
HiddenMethodDescriptor.max
HiddenMethodDescriptor.min
HiddenMethodDescriptor.modifiers
HiddenMethodDescriptor.sum
HiddenMethodDescriptor.wrapped
cached_property
cached_property.__init__()
cached_property._all()
cached_property._any()
cached_property._asyncify()
cached_property._check_method_name()
cached_property._check_method_sync()
cached_property._max()
cached_property._min()
cached_property._sum()
cached_property.already_loaded()
cached_property.del_cache_value()
cached_property.deleter()
cached_property.get()
cached_property.get_cache()
cached_property.get_cache_value()
cached_property.get_instance_state()
cached_property.get_loader()
cached_property.get_lock()
cached_property.has_cache_value()
cached_property.map()
cached_property.not_loaded()
cached_property.pop_lock()
cached_property.set_cache_value()
cached_property.setter()
cached_property._await
cached_property.all
cached_property.any
cached_property.default
cached_property.field_name
cached_property.hidden_method_descriptor
cached_property.hidden_method_name
cached_property.max
cached_property.min
cached_property.modifiers
cached_property.sum
cached_property.wrapped
property
property.__init__()
property._all()
property._any()
property._asyncify()
property._max()
property._min()
property._sum()
property.awaitable_only()
property.get()
property.get_loader()
property.map()
property._await
property.all
property.any
property.default
property.field_name
property.hidden_method_descriptor
property.hidden_method_name
property.max
property.min
property.modifiers
property.sum
property.wrapped
a_sync()
- a_sync.asyncio package
- a_sync.primitives package
- Subpackages
- Submodules
- a_sync.primitives._debug module
- a_sync.primitives._loggable module
- a_sync.primitives.queue module
PriorityProcessingQueue
PriorityProcessingQueue.__call__()
PriorityProcessingQueue.__init__()
PriorityProcessingQueue._create_future()
PriorityProcessingQueue._ensure_workers()
PriorityProcessingQueue._format()
PriorityProcessingQueue._get()
PriorityProcessingQueue._get_loop()
PriorityProcessingQueue._init()
PriorityProcessingQueue._put()
PriorityProcessingQueue._wakeup_next()
PriorityProcessingQueue.close()
PriorityProcessingQueue.empty()
PriorityProcessingQueue.full()
PriorityProcessingQueue.get()
PriorityProcessingQueue.get_nowait()
PriorityProcessingQueue.join()
PriorityProcessingQueue.put()
PriorityProcessingQueue.put_nowait()
PriorityProcessingQueue.qsize()
PriorityProcessingQueue.task_done()
PriorityProcessingQueue._closed
PriorityProcessingQueue._finished
PriorityProcessingQueue._getters
PriorityProcessingQueue._loop
PriorityProcessingQueue._maxsize
PriorityProcessingQueue._putters
PriorityProcessingQueue._unfinished_tasks
PriorityProcessingQueue._worker_coro
PriorityProcessingQueue._workers
PriorityProcessingQueue.func
PriorityProcessingQueue.maxsize
PriorityProcessingQueue.name
PriorityProcessingQueue.num_workers
ProcessingQueue
ProcessingQueue.__call__()
ProcessingQueue.__init__()
ProcessingQueue.__worker_coro()
ProcessingQueue._create_future()
ProcessingQueue._ensure_workers()
ProcessingQueue._format()
ProcessingQueue._get()
ProcessingQueue._get_loop()
ProcessingQueue._init()
ProcessingQueue._put()
ProcessingQueue._wakeup_next()
ProcessingQueue.close()
ProcessingQueue.empty()
ProcessingQueue.full()
ProcessingQueue.get()
ProcessingQueue.get_nowait()
ProcessingQueue.join()
ProcessingQueue.put()
ProcessingQueue.put_nowait()
ProcessingQueue.qsize()
ProcessingQueue.task_done()
ProcessingQueue._closed
ProcessingQueue._finished
ProcessingQueue._getters
ProcessingQueue._loop
ProcessingQueue._maxsize
ProcessingQueue._putters
ProcessingQueue._unfinished_tasks
ProcessingQueue._worker_coro
ProcessingQueue._workers
ProcessingQueue.func
ProcessingQueue.maxsize
ProcessingQueue.name
ProcessingQueue.num_workers
Queue
Queue.__init__()
Queue._format()
Queue._get()
Queue._get_loop()
Queue._init()
Queue._put()
Queue._wakeup_next()
Queue.empty()
Queue.full()
Queue.get()
Queue.get_all()
Queue.get_all_nowait()
Queue.get_multi()
Queue.get_multi_nowait()
Queue.get_nowait()
Queue.join()
Queue.put()
Queue.put_nowait()
Queue.qsize()
Queue.task_done()
Queue._finished
Queue._getters
Queue._loop
Queue._maxsize
Queue._putters
Queue._unfinished_tasks
Queue.maxsize
SmartProcessingQueue
SmartProcessingQueue.__call__()
SmartProcessingQueue.__init__()
SmartProcessingQueue.__worker_coro()
SmartProcessingQueue._create_future()
SmartProcessingQueue._ensure_workers()
SmartProcessingQueue._format()
SmartProcessingQueue._get()
SmartProcessingQueue._get_key()
SmartProcessingQueue._get_loop()
SmartProcessingQueue._init()
SmartProcessingQueue._put()
SmartProcessingQueue._wakeup_next()
SmartProcessingQueue.close()
SmartProcessingQueue.empty()
SmartProcessingQueue.full()
SmartProcessingQueue.get()
SmartProcessingQueue.get_nowait()
SmartProcessingQueue.join()
SmartProcessingQueue.put()
SmartProcessingQueue.put_nowait()
SmartProcessingQueue.qsize()
SmartProcessingQueue.task_done()
SmartProcessingQueue._closed
SmartProcessingQueue._finished
SmartProcessingQueue._futs
SmartProcessingQueue._getters
SmartProcessingQueue._loop
SmartProcessingQueue._maxsize
SmartProcessingQueue._no_futs
SmartProcessingQueue._putters
SmartProcessingQueue._unfinished_tasks
SmartProcessingQueue._worker_coro
SmartProcessingQueue._workers
SmartProcessingQueue.func
SmartProcessingQueue.maxsize
SmartProcessingQueue.name
SmartProcessingQueue.num_workers
VariablePriorityQueue
VariablePriorityQueue.__init__()
VariablePriorityQueue._format()
VariablePriorityQueue._get()
VariablePriorityQueue._get_key()
VariablePriorityQueue._get_loop()
VariablePriorityQueue._init()
VariablePriorityQueue._put()
VariablePriorityQueue._wakeup_next()
VariablePriorityQueue.empty()
VariablePriorityQueue.full()
VariablePriorityQueue.get()
VariablePriorityQueue.get_nowait()
VariablePriorityQueue.join()
VariablePriorityQueue.put()
VariablePriorityQueue.put_nowait()
VariablePriorityQueue.qsize()
VariablePriorityQueue.task_done()
VariablePriorityQueue._loop
VariablePriorityQueue.maxsize
_PriorityQueueMixin
_Queue
_Queue.__init__()
_Queue._format()
_Queue._get()
_Queue._get_loop()
_Queue._init()
_Queue._put()
_Queue._wakeup_next()
_Queue.empty()
_Queue.full()
_Queue.get()
_Queue.get_nowait()
_Queue.join()
_Queue.put()
_Queue.put_nowait()
_Queue.qsize()
_Queue.task_done()
_Queue._finished
_Queue._getters
_Queue._loop
_Queue._maxsize
_Queue._putters
_Queue._unfinished_tasks
_Queue.maxsize
_SmartFutureRef
_VariablePriorityQueueMixin
_validate_args()
- Module contents
CounterLock
CounterLock.__init__()
CounterLock._debug_daemon()
CounterLock._ensure_debug_daemon()
CounterLock._start_debug_daemon()
CounterLock._stop_debug_daemon()
CounterLock.set()
CounterLock.wait_for()
CounterLock._daemon
CounterLock._events
CounterLock._name
CounterLock._value
CounterLock.debug_logs_enabled
CounterLock.is_ready
CounterLock.logger
CounterLock.value
Event
Event.__init__()
Event._debug_daemon()
Event._ensure_debug_daemon()
Event._get_loop()
Event._start_debug_daemon()
Event._stop_debug_daemon()
Event.clear()
Event.is_set()
Event.set()
Event.wait()
Event._daemon
Event._debug_daemon_interval
Event._loop
Event._value
Event._waiters
Event.debug_logs_enabled
Event.logger
PrioritySemaphore
PrioritySemaphore._context_manager_class
PrioritySemaphore.__call__()
PrioritySemaphore.__getitem__()
PrioritySemaphore.__init__()
PrioritySemaphore._count_waiters()
PrioritySemaphore._debug_daemon()
PrioritySemaphore._ensure_debug_daemon()
PrioritySemaphore._get_loop()
PrioritySemaphore._start_debug_daemon()
PrioritySemaphore._stop_debug_daemon()
PrioritySemaphore._wake_up_next()
PrioritySemaphore.acquire()
PrioritySemaphore.decorate()
PrioritySemaphore.locked()
PrioritySemaphore.release()
PrioritySemaphore._capacity
PrioritySemaphore._context_managers
PrioritySemaphore._daemon
PrioritySemaphore._decorated
PrioritySemaphore._loop
PrioritySemaphore._potential_lost_waiters
PrioritySemaphore._top_priority
PrioritySemaphore._value
PrioritySemaphore._waiters
PrioritySemaphore.debug_logs_enabled
PrioritySemaphore.logger
PrioritySemaphore.name
ProcessingQueue
ProcessingQueue.__call__()
ProcessingQueue.__init__()
ProcessingQueue.__worker_coro()
ProcessingQueue._create_future()
ProcessingQueue._ensure_workers()
ProcessingQueue._format()
ProcessingQueue._get()
ProcessingQueue._get_loop()
ProcessingQueue._init()
ProcessingQueue._put()
ProcessingQueue._wakeup_next()
ProcessingQueue.close()
ProcessingQueue.empty()
ProcessingQueue.full()
ProcessingQueue.get()
ProcessingQueue.get_nowait()
ProcessingQueue.join()
ProcessingQueue.put()
ProcessingQueue.put_nowait()
ProcessingQueue.qsize()
ProcessingQueue.task_done()
ProcessingQueue._closed
ProcessingQueue._finished
ProcessingQueue._getters
ProcessingQueue._loop
ProcessingQueue._maxsize
ProcessingQueue._putters
ProcessingQueue._unfinished_tasks
ProcessingQueue._worker_coro
ProcessingQueue._workers
ProcessingQueue.func
ProcessingQueue.maxsize
ProcessingQueue.name
ProcessingQueue.num_workers
Queue
Queue.__init__()
Queue._format()
Queue._get()
Queue._get_loop()
Queue._init()
Queue._put()
Queue._wakeup_next()
Queue.empty()
Queue.full()
Queue.get()
Queue.get_all()
Queue.get_all_nowait()
Queue.get_multi()
Queue.get_multi_nowait()
Queue.get_nowait()
Queue.join()
Queue.put()
Queue.put_nowait()
Queue.qsize()
Queue.task_done()
Queue._finished
Queue._getters
Queue._loop
Queue._maxsize
Queue._putters
Queue._unfinished_tasks
Queue.maxsize
Semaphore
Semaphore.__call__()
Semaphore.__init__()
Semaphore._debug_daemon()
Semaphore._ensure_debug_daemon()
Semaphore._get_loop()
Semaphore._start_debug_daemon()
Semaphore._stop_debug_daemon()
Semaphore._wake_up_next()
Semaphore.acquire()
Semaphore.decorate()
Semaphore.locked()
Semaphore.release()
Semaphore._daemon
Semaphore._decorated
Semaphore._loop
Semaphore._value
Semaphore._waiters
Semaphore.debug_logs_enabled
Semaphore.logger
Semaphore.name
SmartProcessingQueue
SmartProcessingQueue.__call__()
SmartProcessingQueue.__init__()
SmartProcessingQueue.__worker_coro()
SmartProcessingQueue._create_future()
SmartProcessingQueue._ensure_workers()
SmartProcessingQueue._format()
SmartProcessingQueue._get()
SmartProcessingQueue._get_key()
SmartProcessingQueue._get_loop()
SmartProcessingQueue._init()
SmartProcessingQueue._put()
SmartProcessingQueue._wakeup_next()
SmartProcessingQueue.close()
SmartProcessingQueue.empty()
SmartProcessingQueue.full()
SmartProcessingQueue.get()
SmartProcessingQueue.get_nowait()
SmartProcessingQueue.join()
SmartProcessingQueue.put()
SmartProcessingQueue.put_nowait()
SmartProcessingQueue.qsize()
SmartProcessingQueue.task_done()
SmartProcessingQueue._closed
SmartProcessingQueue._finished
SmartProcessingQueue._futs
SmartProcessingQueue._getters
SmartProcessingQueue._loop
SmartProcessingQueue._maxsize
SmartProcessingQueue._no_futs
SmartProcessingQueue._putters
SmartProcessingQueue._unfinished_tasks
SmartProcessingQueue._worker_coro
SmartProcessingQueue._workers
SmartProcessingQueue.func
SmartProcessingQueue.maxsize
SmartProcessingQueue.name
SmartProcessingQueue.num_workers
ThreadsafeSemaphore
ThreadsafeSemaphore.__call__()
ThreadsafeSemaphore.__init__()
ThreadsafeSemaphore._debug_daemon()
ThreadsafeSemaphore._ensure_debug_daemon()
ThreadsafeSemaphore._get_loop()
ThreadsafeSemaphore._start_debug_daemon()
ThreadsafeSemaphore._stop_debug_daemon()
ThreadsafeSemaphore._wake_up_next()
ThreadsafeSemaphore.acquire()
ThreadsafeSemaphore.decorate()
ThreadsafeSemaphore.locked()
ThreadsafeSemaphore.release()
ThreadsafeSemaphore._daemon
ThreadsafeSemaphore._decorated
ThreadsafeSemaphore._loop
ThreadsafeSemaphore._value
ThreadsafeSemaphore._waiters
ThreadsafeSemaphore.debug_logs_enabled
ThreadsafeSemaphore.dummy
ThreadsafeSemaphore.logger
ThreadsafeSemaphore.name
ThreadsafeSemaphore.semaphore
ThreadsafeSemaphore.semaphores
ThreadsafeSemaphore.use_dummy
- a_sync.sphinx package
- Submodules
- a_sync.sphinx.ext module
- Introduction
ASyncDescriptorDirective
ASyncDescriptorDirective.__init__()
ASyncDescriptorDirective._object_hierarchy_parts()
ASyncDescriptorDirective._toc_entry_name()
ASyncDescriptorDirective.add_name()
ASyncDescriptorDirective.add_target_and_index()
ASyncDescriptorDirective.after_content()
ASyncDescriptorDirective.assert_has_content()
ASyncDescriptorDirective.before_content()
ASyncDescriptorDirective.debug()
ASyncDescriptorDirective.directive_error()
ASyncDescriptorDirective.error()
ASyncDescriptorDirective.get_field_type_map()
ASyncDescriptorDirective.get_index_text()
ASyncDescriptorDirective.get_location()
ASyncDescriptorDirective.get_signature_prefix()
ASyncDescriptorDirective.get_signatures()
ASyncDescriptorDirective.get_source_info()
ASyncDescriptorDirective.handle_signature()
ASyncDescriptorDirective.info()
ASyncDescriptorDirective.needs_arglist()
ASyncDescriptorDirective.run()
ASyncDescriptorDirective.set_source_info()
ASyncDescriptorDirective.severe()
ASyncDescriptorDirective.transform_content()
ASyncDescriptorDirective.warning()
ASyncDescriptorDirective._doc_field_type_map
ASyncDescriptorDirective.allow_nesting
ASyncDescriptorDirective.config
ASyncDescriptorDirective.doc_field_types
ASyncDescriptorDirective.domain
ASyncDescriptorDirective.env
ASyncDescriptorDirective.final_argument_whitespace
ASyncDescriptorDirective.has_content
ASyncDescriptorDirective.indexnode
ASyncDescriptorDirective.objtype
ASyncDescriptorDirective.option_spec
ASyncDescriptorDirective.optional_arguments
ASyncDescriptorDirective.prefix_env
ASyncDescriptorDirective.required_arguments
ASyncDescriptorDocumenter
ASyncDescriptorDocumenter.typ
ASyncDescriptorDocumenter.__init__()
ASyncDescriptorDocumenter._call_format_args()
ASyncDescriptorDocumenter._find_signature()
ASyncDescriptorDocumenter.add_content()
ASyncDescriptorDocumenter.add_directive_header()
ASyncDescriptorDocumenter.add_line()
ASyncDescriptorDocumenter.annotate_to_first_argument()
ASyncDescriptorDocumenter.can_document_member()
ASyncDescriptorDocumenter.check_module()
ASyncDescriptorDocumenter.document_members()
ASyncDescriptorDocumenter.filter_members()
ASyncDescriptorDocumenter.format_args()
ASyncDescriptorDocumenter.format_name()
ASyncDescriptorDocumenter.format_signature()
ASyncDescriptorDocumenter.generate()
ASyncDescriptorDocumenter.get_attr()
ASyncDescriptorDocumenter.get_doc()
ASyncDescriptorDocumenter.get_object_members()
ASyncDescriptorDocumenter.get_real_modname()
ASyncDescriptorDocumenter.get_sourcename()
ASyncDescriptorDocumenter.import_object()
ASyncDescriptorDocumenter.merge_default_value()
ASyncDescriptorDocumenter.parse_name()
ASyncDescriptorDocumenter.process_doc()
ASyncDescriptorDocumenter.resolve_name()
ASyncDescriptorDocumenter.sort_members()
ASyncDescriptorDocumenter._new_docstrings
ASyncDescriptorDocumenter._signatures
ASyncDescriptorDocumenter.content_indent
ASyncDescriptorDocumenter.directivetype
ASyncDescriptorDocumenter.documenters
ASyncDescriptorDocumenter.member_order
ASyncDescriptorDocumenter.objtype
ASyncDescriptorDocumenter.option_spec
ASyncDescriptorDocumenter.priority
ASyncDescriptorDocumenter.titles_allowed
ASyncFunctionAsyncDirective
ASyncFunctionAsyncDirective.__init__()
ASyncFunctionAsyncDirective._object_hierarchy_parts()
ASyncFunctionAsyncDirective._toc_entry_name()
ASyncFunctionAsyncDirective.add_name()
ASyncFunctionAsyncDirective.add_target_and_index()
ASyncFunctionAsyncDirective.after_content()
ASyncFunctionAsyncDirective.assert_has_content()
ASyncFunctionAsyncDirective.before_content()
ASyncFunctionAsyncDirective.debug()
ASyncFunctionAsyncDirective.directive_error()
ASyncFunctionAsyncDirective.error()
ASyncFunctionAsyncDirective.get_field_type_map()
ASyncFunctionAsyncDirective.get_index_text()
ASyncFunctionAsyncDirective.get_location()
ASyncFunctionAsyncDirective.get_signature_prefix()
ASyncFunctionAsyncDirective.get_signatures()
ASyncFunctionAsyncDirective.get_source_info()
ASyncFunctionAsyncDirective.handle_signature()
ASyncFunctionAsyncDirective.info()
ASyncFunctionAsyncDirective.needs_arglist()
ASyncFunctionAsyncDirective.run()
ASyncFunctionAsyncDirective.set_source_info()
ASyncFunctionAsyncDirective.severe()
ASyncFunctionAsyncDirective.transform_content()
ASyncFunctionAsyncDirective.warning()
ASyncFunctionAsyncDirective._doc_field_type_map
ASyncFunctionAsyncDirective.allow_nesting
ASyncFunctionAsyncDirective.config
ASyncFunctionAsyncDirective.doc_field_types
ASyncFunctionAsyncDirective.domain
ASyncFunctionAsyncDirective.env
ASyncFunctionAsyncDirective.final_argument_whitespace
ASyncFunctionAsyncDirective.has_content
ASyncFunctionAsyncDirective.indexnode
ASyncFunctionAsyncDirective.objtype
ASyncFunctionAsyncDirective.option_spec
ASyncFunctionAsyncDirective.optional_arguments
ASyncFunctionAsyncDirective.prefix_env
ASyncFunctionAsyncDirective.required_arguments
ASyncFunctionAsyncDocumenter
ASyncFunctionAsyncDocumenter.typ
ASyncFunctionAsyncDocumenter.__init__()
ASyncFunctionAsyncDocumenter._call_format_args()
ASyncFunctionAsyncDocumenter._find_signature()
ASyncFunctionAsyncDocumenter.add_content()
ASyncFunctionAsyncDocumenter.add_directive_header()
ASyncFunctionAsyncDocumenter.add_line()
ASyncFunctionAsyncDocumenter.annotate_to_first_argument()
ASyncFunctionAsyncDocumenter.can_document_member()
ASyncFunctionAsyncDocumenter.check_module()
ASyncFunctionAsyncDocumenter.document_members()
ASyncFunctionAsyncDocumenter.filter_members()
ASyncFunctionAsyncDocumenter.format_args()
ASyncFunctionAsyncDocumenter.format_name()
ASyncFunctionAsyncDocumenter.format_signature()
ASyncFunctionAsyncDocumenter.generate()
ASyncFunctionAsyncDocumenter.get_attr()
ASyncFunctionAsyncDocumenter.get_doc()
ASyncFunctionAsyncDocumenter.get_object_members()
ASyncFunctionAsyncDocumenter.get_real_modname()
ASyncFunctionAsyncDocumenter.get_sourcename()
ASyncFunctionAsyncDocumenter.import_object()
ASyncFunctionAsyncDocumenter.merge_default_value()
ASyncFunctionAsyncDocumenter.parse_name()
ASyncFunctionAsyncDocumenter.process_doc()
ASyncFunctionAsyncDocumenter.resolve_name()
ASyncFunctionAsyncDocumenter.sort_members()
ASyncFunctionAsyncDocumenter._new_docstrings
ASyncFunctionAsyncDocumenter._signatures
ASyncFunctionAsyncDocumenter.content_indent
ASyncFunctionAsyncDocumenter.documenters
ASyncFunctionAsyncDocumenter.member_order
ASyncFunctionAsyncDocumenter.objtype
ASyncFunctionAsyncDocumenter.option_spec
ASyncFunctionAsyncDocumenter.priority
ASyncFunctionAsyncDocumenter.titles_allowed
ASyncFunctionDirective
ASyncFunctionDirective.__init__()
ASyncFunctionDirective._object_hierarchy_parts()
ASyncFunctionDirective._toc_entry_name()
ASyncFunctionDirective.add_name()
ASyncFunctionDirective.add_target_and_index()
ASyncFunctionDirective.after_content()
ASyncFunctionDirective.assert_has_content()
ASyncFunctionDirective.before_content()
ASyncFunctionDirective.debug()
ASyncFunctionDirective.directive_error()
ASyncFunctionDirective.error()
ASyncFunctionDirective.get_field_type_map()
ASyncFunctionDirective.get_index_text()
ASyncFunctionDirective.get_location()
ASyncFunctionDirective.get_signature_prefix()
ASyncFunctionDirective.get_signatures()
ASyncFunctionDirective.get_source_info()
ASyncFunctionDirective.handle_signature()
ASyncFunctionDirective.info()
ASyncFunctionDirective.needs_arglist()
ASyncFunctionDirective.run()
ASyncFunctionDirective.set_source_info()
ASyncFunctionDirective.severe()
ASyncFunctionDirective.transform_content()
ASyncFunctionDirective.warning()
ASyncFunctionDirective._doc_field_type_map
ASyncFunctionDirective.allow_nesting
ASyncFunctionDirective.config
ASyncFunctionDirective.doc_field_types
ASyncFunctionDirective.domain
ASyncFunctionDirective.env
ASyncFunctionDirective.final_argument_whitespace
ASyncFunctionDirective.has_content
ASyncFunctionDirective.indexnode
ASyncFunctionDirective.objtype
ASyncFunctionDirective.option_spec
ASyncFunctionDirective.optional_arguments
ASyncFunctionDirective.prefix_env
ASyncFunctionDirective.required_arguments
ASyncFunctionDocumenter
ASyncFunctionDocumenter.typ
ASyncFunctionDocumenter.__init__()
ASyncFunctionDocumenter._call_format_args()
ASyncFunctionDocumenter._find_signature()
ASyncFunctionDocumenter.add_content()
ASyncFunctionDocumenter.add_directive_header()
ASyncFunctionDocumenter.add_line()
ASyncFunctionDocumenter.annotate_to_first_argument()
ASyncFunctionDocumenter.can_document_member()
ASyncFunctionDocumenter.check_module()
ASyncFunctionDocumenter.document_members()
ASyncFunctionDocumenter.filter_members()
ASyncFunctionDocumenter.format_args()
ASyncFunctionDocumenter.format_name()
ASyncFunctionDocumenter.format_signature()
ASyncFunctionDocumenter.generate()
ASyncFunctionDocumenter.get_attr()
ASyncFunctionDocumenter.get_doc()
ASyncFunctionDocumenter.get_object_members()
ASyncFunctionDocumenter.get_real_modname()
ASyncFunctionDocumenter.get_sourcename()
ASyncFunctionDocumenter.import_object()
ASyncFunctionDocumenter.merge_default_value()
ASyncFunctionDocumenter.parse_name()
ASyncFunctionDocumenter.process_doc()
ASyncFunctionDocumenter.resolve_name()
ASyncFunctionDocumenter.sort_members()
ASyncFunctionDocumenter._new_docstrings
ASyncFunctionDocumenter._signatures
ASyncFunctionDocumenter.content_indent
ASyncFunctionDocumenter.documenters
ASyncFunctionDocumenter.member_order
ASyncFunctionDocumenter.objtype
ASyncFunctionDocumenter.option_spec
ASyncFunctionDocumenter.priority
ASyncFunctionDocumenter.titles_allowed
ASyncFunctionSyncDirective
ASyncFunctionSyncDirective.__init__()
ASyncFunctionSyncDirective._object_hierarchy_parts()
ASyncFunctionSyncDirective._toc_entry_name()
ASyncFunctionSyncDirective.add_name()
ASyncFunctionSyncDirective.add_target_and_index()
ASyncFunctionSyncDirective.after_content()
ASyncFunctionSyncDirective.assert_has_content()
ASyncFunctionSyncDirective.before_content()
ASyncFunctionSyncDirective.debug()
ASyncFunctionSyncDirective.directive_error()
ASyncFunctionSyncDirective.error()
ASyncFunctionSyncDirective.get_field_type_map()
ASyncFunctionSyncDirective.get_index_text()
ASyncFunctionSyncDirective.get_location()
ASyncFunctionSyncDirective.get_signature_prefix()
ASyncFunctionSyncDirective.get_signatures()
ASyncFunctionSyncDirective.get_source_info()
ASyncFunctionSyncDirective.handle_signature()
ASyncFunctionSyncDirective.info()
ASyncFunctionSyncDirective.needs_arglist()
ASyncFunctionSyncDirective.run()
ASyncFunctionSyncDirective.set_source_info()
ASyncFunctionSyncDirective.severe()
ASyncFunctionSyncDirective.transform_content()
ASyncFunctionSyncDirective.warning()
ASyncFunctionSyncDirective._doc_field_type_map
ASyncFunctionSyncDirective.allow_nesting
ASyncFunctionSyncDirective.config
ASyncFunctionSyncDirective.doc_field_types
ASyncFunctionSyncDirective.domain
ASyncFunctionSyncDirective.env
ASyncFunctionSyncDirective.final_argument_whitespace
ASyncFunctionSyncDirective.has_content
ASyncFunctionSyncDirective.indexnode
ASyncFunctionSyncDirective.objtype
ASyncFunctionSyncDirective.option_spec
ASyncFunctionSyncDirective.optional_arguments
ASyncFunctionSyncDirective.prefix_env
ASyncFunctionSyncDirective.required_arguments
ASyncFunctionSyncDocumenter
ASyncFunctionSyncDocumenter.typ
ASyncFunctionSyncDocumenter.__init__()
ASyncFunctionSyncDocumenter._call_format_args()
ASyncFunctionSyncDocumenter._find_signature()
ASyncFunctionSyncDocumenter.add_content()
ASyncFunctionSyncDocumenter.add_directive_header()
ASyncFunctionSyncDocumenter.add_line()
ASyncFunctionSyncDocumenter.annotate_to_first_argument()
ASyncFunctionSyncDocumenter.can_document_member()
ASyncFunctionSyncDocumenter.check_module()
ASyncFunctionSyncDocumenter.document_members()
ASyncFunctionSyncDocumenter.filter_members()
ASyncFunctionSyncDocumenter.format_args()
ASyncFunctionSyncDocumenter.format_name()
ASyncFunctionSyncDocumenter.format_signature()
ASyncFunctionSyncDocumenter.generate()
ASyncFunctionSyncDocumenter.get_attr()
ASyncFunctionSyncDocumenter.get_doc()
ASyncFunctionSyncDocumenter.get_object_members()
ASyncFunctionSyncDocumenter.get_real_modname()
ASyncFunctionSyncDocumenter.get_sourcename()
ASyncFunctionSyncDocumenter.import_object()
ASyncFunctionSyncDocumenter.merge_default_value()
ASyncFunctionSyncDocumenter.parse_name()
ASyncFunctionSyncDocumenter.process_doc()
ASyncFunctionSyncDocumenter.resolve_name()
ASyncFunctionSyncDocumenter.sort_members()
ASyncFunctionSyncDocumenter._new_docstrings
ASyncFunctionSyncDocumenter._signatures
ASyncFunctionSyncDocumenter.content_indent
ASyncFunctionSyncDocumenter.documenters
ASyncFunctionSyncDocumenter.member_order
ASyncFunctionSyncDocumenter.objtype
ASyncFunctionSyncDocumenter.option_spec
ASyncFunctionSyncDocumenter.priority
ASyncFunctionSyncDocumenter.titles_allowed
ASyncGeneratorFunctionDirective
ASyncGeneratorFunctionDirective.__init__()
ASyncGeneratorFunctionDirective._object_hierarchy_parts()
ASyncGeneratorFunctionDirective._toc_entry_name()
ASyncGeneratorFunctionDirective.add_name()
ASyncGeneratorFunctionDirective.add_target_and_index()
ASyncGeneratorFunctionDirective.after_content()
ASyncGeneratorFunctionDirective.assert_has_content()
ASyncGeneratorFunctionDirective.before_content()
ASyncGeneratorFunctionDirective.debug()
ASyncGeneratorFunctionDirective.directive_error()
ASyncGeneratorFunctionDirective.error()
ASyncGeneratorFunctionDirective.get_field_type_map()
ASyncGeneratorFunctionDirective.get_index_text()
ASyncGeneratorFunctionDirective.get_location()
ASyncGeneratorFunctionDirective.get_signature_prefix()
ASyncGeneratorFunctionDirective.get_signatures()
ASyncGeneratorFunctionDirective.get_source_info()
ASyncGeneratorFunctionDirective.handle_signature()
ASyncGeneratorFunctionDirective.info()
ASyncGeneratorFunctionDirective.needs_arglist()
ASyncGeneratorFunctionDirective.run()
ASyncGeneratorFunctionDirective.set_source_info()
ASyncGeneratorFunctionDirective.severe()
ASyncGeneratorFunctionDirective.transform_content()
ASyncGeneratorFunctionDirective.warning()
ASyncGeneratorFunctionDirective._doc_field_type_map
ASyncGeneratorFunctionDirective.allow_nesting
ASyncGeneratorFunctionDirective.config
ASyncGeneratorFunctionDirective.doc_field_types
ASyncGeneratorFunctionDirective.domain
ASyncGeneratorFunctionDirective.env
ASyncGeneratorFunctionDirective.final_argument_whitespace
ASyncGeneratorFunctionDirective.has_content
ASyncGeneratorFunctionDirective.indexnode
ASyncGeneratorFunctionDirective.objtype
ASyncGeneratorFunctionDirective.option_spec
ASyncGeneratorFunctionDirective.optional_arguments
ASyncGeneratorFunctionDirective.prefix_env
ASyncGeneratorFunctionDirective.required_arguments
ASyncGeneratorFunctionDocumenter
ASyncGeneratorFunctionDocumenter.typ
ASyncGeneratorFunctionDocumenter.__init__()
ASyncGeneratorFunctionDocumenter._call_format_args()
ASyncGeneratorFunctionDocumenter._find_signature()
ASyncGeneratorFunctionDocumenter.add_content()
ASyncGeneratorFunctionDocumenter.add_directive_header()
ASyncGeneratorFunctionDocumenter.add_line()
ASyncGeneratorFunctionDocumenter.annotate_to_first_argument()
ASyncGeneratorFunctionDocumenter.can_document_member()
ASyncGeneratorFunctionDocumenter.check_module()
ASyncGeneratorFunctionDocumenter.document_members()
ASyncGeneratorFunctionDocumenter.filter_members()
ASyncGeneratorFunctionDocumenter.format_args()
ASyncGeneratorFunctionDocumenter.format_name()
ASyncGeneratorFunctionDocumenter.format_signature()
ASyncGeneratorFunctionDocumenter.generate()
ASyncGeneratorFunctionDocumenter.get_attr()
ASyncGeneratorFunctionDocumenter.get_doc()
ASyncGeneratorFunctionDocumenter.get_object_members()
ASyncGeneratorFunctionDocumenter.get_real_modname()
ASyncGeneratorFunctionDocumenter.get_sourcename()
ASyncGeneratorFunctionDocumenter.import_object()
ASyncGeneratorFunctionDocumenter.merge_default_value()
ASyncGeneratorFunctionDocumenter.parse_name()
ASyncGeneratorFunctionDocumenter.process_doc()
ASyncGeneratorFunctionDocumenter.resolve_name()
ASyncGeneratorFunctionDocumenter.sort_members()
ASyncGeneratorFunctionDocumenter._new_docstrings
ASyncGeneratorFunctionDocumenter._signatures
ASyncGeneratorFunctionDocumenter.content_indent
ASyncGeneratorFunctionDocumenter.documenters
ASyncGeneratorFunctionDocumenter.member_order
ASyncGeneratorFunctionDocumenter.objtype
ASyncGeneratorFunctionDocumenter.option_spec
ASyncGeneratorFunctionDocumenter.priority
ASyncGeneratorFunctionDocumenter.titles_allowed
_ASyncDirective
_ASyncFunctionDirective
_ASyncFunctionDirective.__init__()
_ASyncFunctionDirective._object_hierarchy_parts()
_ASyncFunctionDirective._toc_entry_name()
_ASyncFunctionDirective.add_name()
_ASyncFunctionDirective.add_target_and_index()
_ASyncFunctionDirective.after_content()
_ASyncFunctionDirective.assert_has_content()
_ASyncFunctionDirective.before_content()
_ASyncFunctionDirective.debug()
_ASyncFunctionDirective.directive_error()
_ASyncFunctionDirective.error()
_ASyncFunctionDirective.get_field_type_map()
_ASyncFunctionDirective.get_index_text()
_ASyncFunctionDirective.get_location()
_ASyncFunctionDirective.get_signature_prefix()
_ASyncFunctionDirective.get_signatures()
_ASyncFunctionDirective.get_source_info()
_ASyncFunctionDirective.handle_signature()
_ASyncFunctionDirective.info()
_ASyncFunctionDirective.needs_arglist()
_ASyncFunctionDirective.run()
_ASyncFunctionDirective.set_source_info()
_ASyncFunctionDirective.severe()
_ASyncFunctionDirective.transform_content()
_ASyncFunctionDirective.warning()
_ASyncFunctionDirective._doc_field_type_map
_ASyncFunctionDirective.allow_nesting
_ASyncFunctionDirective.config
_ASyncFunctionDirective.doc_field_types
_ASyncFunctionDirective.domain
_ASyncFunctionDirective.env
_ASyncFunctionDirective.final_argument_whitespace
_ASyncFunctionDirective.has_content
_ASyncFunctionDirective.indexnode
_ASyncFunctionDirective.objtype
_ASyncFunctionDirective.option_spec
_ASyncFunctionDirective.optional_arguments
_ASyncFunctionDirective.prefix_env
_ASyncFunctionDirective.required_arguments
_ASyncFunctionDocumenter
_ASyncFunctionDocumenter.__init__()
_ASyncFunctionDocumenter._call_format_args()
_ASyncFunctionDocumenter._find_signature()
_ASyncFunctionDocumenter.add_content()
_ASyncFunctionDocumenter.add_directive_header()
_ASyncFunctionDocumenter.add_line()
_ASyncFunctionDocumenter.annotate_to_first_argument()
_ASyncFunctionDocumenter.can_document_member()
_ASyncFunctionDocumenter.check_module()
_ASyncFunctionDocumenter.document_members()
_ASyncFunctionDocumenter.filter_members()
_ASyncFunctionDocumenter.format_args()
_ASyncFunctionDocumenter.format_name()
_ASyncFunctionDocumenter.format_signature()
_ASyncFunctionDocumenter.generate()
_ASyncFunctionDocumenter.get_attr()
_ASyncFunctionDocumenter.get_doc()
_ASyncFunctionDocumenter.get_object_members()
_ASyncFunctionDocumenter.get_real_modname()
_ASyncFunctionDocumenter.get_sourcename()
_ASyncFunctionDocumenter.import_object()
_ASyncFunctionDocumenter.merge_default_value()
_ASyncFunctionDocumenter.parse_name()
_ASyncFunctionDocumenter.process_doc()
_ASyncFunctionDocumenter.resolve_name()
_ASyncFunctionDocumenter.sort_members()
_ASyncFunctionDocumenter._new_docstrings
_ASyncFunctionDocumenter._signatures
_ASyncFunctionDocumenter.content_indent
_ASyncFunctionDocumenter.documenters
_ASyncFunctionDocumenter.member_order
_ASyncFunctionDocumenter.objtype
_ASyncFunctionDocumenter.option_spec
_ASyncFunctionDocumenter.priority
_ASyncFunctionDocumenter.titles_allowed
_ASyncFunctionDocumenter.typ
_ASyncMethodDirective
_ASyncMethodDirective.__init__()
_ASyncMethodDirective._object_hierarchy_parts()
_ASyncMethodDirective._toc_entry_name()
_ASyncMethodDirective.add_name()
_ASyncMethodDirective.add_target_and_index()
_ASyncMethodDirective.after_content()
_ASyncMethodDirective.assert_has_content()
_ASyncMethodDirective.before_content()
_ASyncMethodDirective.debug()
_ASyncMethodDirective.directive_error()
_ASyncMethodDirective.error()
_ASyncMethodDirective.get_field_type_map()
_ASyncMethodDirective.get_index_text()
_ASyncMethodDirective.get_location()
_ASyncMethodDirective.get_signature_prefix()
_ASyncMethodDirective.get_signatures()
_ASyncMethodDirective.get_source_info()
_ASyncMethodDirective.handle_signature()
_ASyncMethodDirective.info()
_ASyncMethodDirective.needs_arglist()
_ASyncMethodDirective.run()
_ASyncMethodDirective.set_source_info()
_ASyncMethodDirective.severe()
_ASyncMethodDirective.transform_content()
_ASyncMethodDirective.warning()
_ASyncMethodDirective._doc_field_type_map
_ASyncMethodDirective.allow_nesting
_ASyncMethodDirective.config
_ASyncMethodDirective.doc_field_types
_ASyncMethodDirective.domain
_ASyncMethodDirective.env
_ASyncMethodDirective.final_argument_whitespace
_ASyncMethodDirective.has_content
_ASyncMethodDirective.indexnode
_ASyncMethodDirective.objtype
_ASyncMethodDirective.option_spec
_ASyncMethodDirective.optional_arguments
_ASyncMethodDirective.prefix_env
_ASyncMethodDirective.required_arguments
_ASyncMethodDocumenter
_ASyncMethodDocumenter.__init__()
_ASyncMethodDocumenter._call_format_args()
_ASyncMethodDocumenter._find_signature()
_ASyncMethodDocumenter.add_content()
_ASyncMethodDocumenter.add_directive_header()
_ASyncMethodDocumenter.add_line()
_ASyncMethodDocumenter.annotate_to_first_argument()
_ASyncMethodDocumenter.can_document_member()
_ASyncMethodDocumenter.check_module()
_ASyncMethodDocumenter.document_members()
_ASyncMethodDocumenter.filter_members()
_ASyncMethodDocumenter.format_args()
_ASyncMethodDocumenter.format_name()
_ASyncMethodDocumenter.format_signature()
_ASyncMethodDocumenter.generate()
_ASyncMethodDocumenter.get_attr()
_ASyncMethodDocumenter.get_doc()
_ASyncMethodDocumenter.get_object_members()
_ASyncMethodDocumenter.get_real_modname()
_ASyncMethodDocumenter.get_sourcename()
_ASyncMethodDocumenter.import_object()
_ASyncMethodDocumenter.merge_default_value()
_ASyncMethodDocumenter.parse_name()
_ASyncMethodDocumenter.process_doc()
_ASyncMethodDocumenter.resolve_name()
_ASyncMethodDocumenter.sort_members()
_ASyncMethodDocumenter._new_docstrings
_ASyncMethodDocumenter._signatures
_ASyncMethodDocumenter.content_indent
_ASyncMethodDocumenter.directivetype
_ASyncMethodDocumenter.documenters
_ASyncMethodDocumenter.member_order
_ASyncMethodDocumenter.objtype
_ASyncMethodDocumenter.option_spec
_ASyncMethodDocumenter.priority
_ASyncMethodDocumenter.titles_allowed
_ASyncMethodDocumenter.typ
_ASyncWrapperDocumenter
autodoc_skip_member_handler()
setup()
- Module contents
- a_sync.utils package
Submodules
a_sync.ENVIRONMENT_VARIABLES module
a_sync._smart module
- class a_sync._smart.SmartFuture[source]
Bases:
_SmartFutureMixin
[T
],Future
- __iter__()
Implement iter(self).
- __new__(**kwargs)
- _make_cancelled_error()
Create the CancelledError to raise if the Future is cancelled.
This should only be called once when handling a cancellation since it erases the context exception value.
- _repr_info()
- _self_done_cleanup_callback()
- Parameters:
self (SmartFuture | SmartTask)
- Return type:
None
- _waiter_done_cleanup_callback(waiter)
Removes the waiter from _waiters, and _queue._futs if applicable
- Parameters:
self (SmartFuture | SmartTask)
waiter (SmartTask)
- Return type:
None
- add_done_callback()
Add a callback to be run when the future becomes done.
The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon.
- cancel(msg=None)
Cancel the future and schedule callbacks.
If the future is already done or cancelled, return False. Otherwise, change the future’s state to cancelled, schedule the callbacks and return True.
- cancelled()
Return True if the future was cancelled.
- done()
Return True if the future is done.
Done means either that a result / exception are available, or that the future was cancelled.
- exception()
Return the exception that was set on this future.
The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn’t done yet, raises InvalidStateError.
- get_loop()
Return the event loop the Future is bound to.
- remove_done_callback(fn, /)
Remove all instances of a callback from the “call when done” list.
Returns the number of callbacks removed.
- result()
Return the result this future represents.
If the future has been cancelled, raises CancelledError. If the future’s result isn’t yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised.
- set_exception(exception, /)
Mark the future done and set an exception.
If the future is already done when this method is called, raises InvalidStateError.
- set_result(result, /)
Mark the future done and set its result.
If the future is already done when this method is called, raises InvalidStateError.
- _asyncio_future_blocking
- _callbacks
- _cancel_message
- _exception
- _key: _Key = None
- _log_traceback
- _loop
- _result
- _source_traceback
- _state
- _waiters: weakref.WeakSet[SmartTask[T]]
- class a_sync._smart.SmartTask[source]
Bases:
_SmartFutureMixin
[T
],Task
- __iter__()
Implement iter(self).
- __new__(**kwargs)
- _make_cancelled_error()
Create the CancelledError to raise if the Task is cancelled.
This should only be called once when handling a cancellation since it erases the context exception value.
- _repr_info()
- _self_done_cleanup_callback()
- Parameters:
self (SmartFuture | SmartTask)
- Return type:
None
- _waiter_done_cleanup_callback(waiter)
Removes the waiter from _waiters, and _queue._futs if applicable
- Parameters:
self (SmartFuture | SmartTask)
waiter (SmartTask)
- Return type:
None
- add_done_callback()
Add a callback to be run when the future becomes done.
The callback is called with a single argument - the future object. If the future is already done when this is called, the callback is scheduled with call_soon.
- cancel(msg=None)
Request that this task cancel itself.
This arranges for a CancelledError to be thrown into the wrapped coroutine on the next cycle through the event loop. The coroutine then has a chance to clean up or even deny the request using try/except/finally.
Unlike Future.cancel, this does not guarantee that the task will be cancelled: the exception might be caught and acted upon, delaying cancellation of the task or preventing cancellation completely. The task may also return a value or raise a different exception.
Immediately after this method is called, Task.cancelled() will not return True (unless the task was already cancelled). A task will be marked as cancelled when the wrapped coroutine terminates with a CancelledError exception (even if cancel() was not called).
- cancelled()
Return True if the future was cancelled.
- done()
Return True if the future is done.
Done means either that a result / exception are available, or that the future was cancelled.
- exception()
Return the exception that was set on this future.
The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn’t done yet, raises InvalidStateError.
- get_coro()
- get_loop()
Return the event loop the Future is bound to.
- get_name()
- get_stack(*, limit=None)
Return the list of stack frames for this task’s coroutine.
If the coroutine is not done, this returns the stack where it is suspended. If the coroutine has completed successfully or was cancelled, this returns an empty list. If the coroutine was terminated by an exception, this returns the list of traceback frames.
The frames are always ordered from oldest to newest.
The optional limit gives the maximum number of frames to return; by default all available frames are returned. Its meaning differs depending on whether a stack or a traceback is returned: the newest frames of a stack are returned, but the oldest frames of a traceback are returned. (This matches the behavior of the traceback module.)
For reasons beyond our control, only one stack frame is returned for a suspended coroutine.
- print_stack(*, limit=None, file=None)
Print the stack or traceback for this task’s coroutine.
This produces output similar to that of the traceback module, for the frames retrieved by get_stack(). The limit argument is passed to get_stack(). The file argument is an I/O stream to which the output is written; by default output is written to sys.stderr.
- remove_done_callback(fn, /)
Remove all instances of a callback from the “call when done” list.
Returns the number of callbacks removed.
- result()
Return the result this future represents.
If the future has been cancelled, raises CancelledError. If the future’s result isn’t yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised.
- set_exception(exception, /)
Mark the future done and set an exception.
If the future is already done when this method is called, raises InvalidStateError.
- set_name(value, /)
- set_result(result, /)
Mark the future done and set its result.
If the future is already done when this method is called, raises InvalidStateError.
- _asyncio_future_blocking
- _callbacks
- _cancel_message
- _coro
- _exception
- _fut_waiter
- _key: _Key
- _log_destroy_pending
- _log_traceback
- _loop
- _must_cancel
- _result
- _source_traceback
- _state
- _waiters: Set['asyncio.Task[T]']
- a_sync._smart.create_future(*, queue=None, key=None, loop=None)[source]
- Parameters:
- Return type:
SmartFuture[V]
- a_sync._smart.set_smart_task_factory(loop=None)[source]
- Parameters:
loop (AbstractEventLoop | None)
- Return type:
None
- a_sync._smart.shield(arg, *, loop=None)[source]
Wait for a future, shielding it from cancellation.
The statement
res = await shield(something())
is exactly equivalent to the statement
res = await something()
except that if the coroutine containing it is cancelled, the task running in something() is not cancelled. From the POV of something(), the cancellation did not happen. But its caller is still cancelled, so the yield-from expression still raises CancelledError. Note: If something() is cancelled by other means this will still cancel shield().
If you want to completely ignore cancellation (not recommended) you can combine shield() with a try/except clause, as follows:
- try:
res = await shield(something())
- except CancelledError:
res = None
- Parameters:
arg (Awaitable[T])
loop (AbstractEventLoop | None)
- Return type:
SmartFuture[T]
a_sync._typing module
- class a_sync._typing.AsyncUnboundMethod[source]
Bases:
Protocol
[I
,P
,T
]- __init__(*args, **kwargs)
- class a_sync._typing.ModifierKwargs[source]
Bases:
TypedDict
- __getitem__()
x.__getitem__(y) <==> x[y]
- __init__(*args, **kwargs)
- __iter__()
Implement iter(self).
- __new__(**kwargs)
- clear() None. Remove all items from D.
- copy() a shallow copy of D
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values
- executor: Executor
a_sync.aliases module
a_sync.exceptions module
- exception a_sync.exceptions.ASyncFlagException[source]
Bases:
ValueError
- __init__(*args, **kwargs)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.ASyncRuntimeError[source]
Bases:
RuntimeError
- __init__(e)[source]
- Parameters:
e (RuntimeError)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.EmptySequenceError[source]
Bases:
ValueError
- __init__(*args, **kwargs)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.FlagNotDefined[source]
Bases:
ASyncFlagException
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.FunctionNotAsync[source]
Bases:
ImproperFunctionType
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.FunctionNotSync[source]
Bases:
ImproperFunctionType
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.ImproperFunctionType[source]
Bases:
ValueError
- __init__(*args, **kwargs)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.InvalidFlag[source]
Bases:
ASyncFlagException
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.InvalidFlagValue[source]
Bases:
ASyncFlagException
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.KwargsUnsupportedError[source]
Bases:
ValueError
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.MappingError[source]
Bases:
Exception
- __init__(mapping, msg='')[source]
- Parameters:
mapping (TaskMapping)
msg (str)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.MappingIsEmptyError[source]
Bases:
MappingError
- __init__(mapping, msg='')
- Parameters:
mapping (TaskMapping)
msg (str)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.MappingNotEmptyError[source]
Bases:
MappingError
- __init__(mapping, msg='')
- Parameters:
mapping (TaskMapping)
msg (str)
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.NoFlagsFound[source]
Bases:
ASyncFlagException
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.PersistedTaskException[source]
Bases:
Exception
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
- exception a_sync.exceptions.SyncModeInAsyncContextError[source]
Bases:
ASyncRuntimeError
- __new__(**kwargs)
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args
a_sync.executor module
With these executors, you can simply run sync fns in your executor with await executor.run(fn, *args)
executor.submit(fn, *args) will work the same as the concurrent.futures implementation, but will return an asyncio.Future instead of a concurrent.futures.Future
- class a_sync.executor.AsyncProcessPoolExecutor[source]
Bases:
_AsyncExecutorMixin
,ProcessPoolExecutor
- _adjust_process_count()
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _launch_processes()
- _spawn_process()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _start_executor_manager_thread()
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – If greater than one, the iterables will be chopped into chunks of size chunksize and submitted to the process pool. If set to one, the items in the list will be sent one at a time.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _broken
- _call_queue
- _daemon
- _initargs
- _initializer
- _mp_context
- _pending_work_items
- _processes
- _queue_count
- _queue_management_thread
- _queue_management_thread_wakeup
- _result_queue
- _shutdown_lock
- _shutdown_thread
- _work_ids
- class a_sync.executor.AsyncThreadPoolExecutor[source]
Bases:
_AsyncExecutorMixin
,ThreadPoolExecutor
- _adjust_thread_count()
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _initializer_failed()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _broken
- _counter = <method-wrapper '__next__' of itertools.count object>
- _daemon
- _idle_semaphore
- _initargs
- _initializer
- _shutdown
- _shutdown_lock
- _thread_name_prefix
- _threads
- _work_queue
- class a_sync.executor.PruningThreadPoolExecutor[source]
Bases:
AsyncThreadPoolExecutor
This ThreadPoolExecutor implementation prunes inactive threads after ‘timeout’ seconds without a work item. Pruned threads will be automatically recreated as needed for future workloads. up to ‘max_threads’ can be active at any one time.
- __init__(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), timeout=600)[source]
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _initializer_failed()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _adjusting_lock
- _broken
- _counter = <method-wrapper '__next__' of itertools.count object>
- _daemon
- _idle_semaphore
- _initargs
- _initializer
- _shutdown
- _shutdown_lock
- _thread_name_prefix
- _threads
- _timeout
- _work_queue
a_sync.future module
- class a_sync.future.ASyncFuture[source]
Bases:
Future
,Awaitable
[T
]- async __await()
- Return type:
T
- __init__(awaitable, dependencies=[])[source]
Initializes the future. Should not be called by clients.
- Parameters:
awaitable (Awaitable[T])
dependencies (List[ASyncFuture])
- Return type:
None
- __list_dependencies(other)
- Return type:
- _invoke_callbacks()
- add_done_callback(fn)
Attaches a callable that will be called when the future finishes.
- Parameters:
fn – A callable that will be called with this future as its only argument when the future completes or is cancelled. The callable will always be called by a thread in the same process in which it was added. If the future has already completed or been cancelled then the callable will be called immediately. These callables are called in the order that they were added.
- cancel()
Cancel the future if possible.
Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed.
- cancelled()
Return True if the future was cancelled.
- done()
Return True if the future was cancelled or finished executing.
- exception(timeout=None)
Return the exception raised by the call that the future represents.
- Parameters:
timeout – The number of seconds to wait for the exception if the future isn’t done. If None, then there is no limit on the wait time.
- Returns:
The exception raised by the call that the future represents or None if the call completed without raising.
- Raises:
CancelledError – If the future was cancelled.
TimeoutError – If the future didn’t finish executing before the given timeout.
- running()
Return True if the future is currently executing.
- set_exception(exception)
Sets the result of the future as being the given exception.
Should only be used by Executor implementations and unit tests.
- set_result(result)
Sets the return value of work associated with the future.
Should only be used by Executor implementations and unit tests.
- set_running_or_notify_cancel()
Mark the future as running or process any cancel notifications.
Should only be used by Executor implementations and unit tests.
If the future has been cancelled (cancel() was called and returned True) then any threads waiting on the future completing (though calls to as_completed() or wait()) are notified and False is returned.
If the future was not cancelled then it is put in the running state (future calls to running() will return True) and True is returned.
This method should be called by Executor implementations before executing the work associated with this future. If this method returns False then the work should not be executed.
- Returns:
False if the Future was cancelled, True otherwise.
- Raises:
RuntimeError – if this method was already called or if set_result() or set_exception() was called.
- __dependants: List[ASyncFuture]
- __dependencies
- __task
- property result: Callable[[], T] | Any
If this future is not done, it will work like cf.Future.result. It will block, await the awaitable, and return the result when ready. If this future is done and the result has attribute results, will return getattr(future_result, ‘result’) If this future is done and the result does NOT have attribute results, will again work like cf.Future.result
a_sync.iter module
- class a_sync.iter.ASyncFilter[source]
Bases:
_ASyncView
[T
]- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- async __anext__()[source]
Asynchronously fetches the next item from the async iterator.
- Return type:
T
- __init__(function, iterable)
Initializes the ASyncIterator with an async iterator.
- __iter__()
- __next__()
Return the next item from the iterator. When exhausted, raise StopIteration
- Return type:
T
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)
Class method to wrap either an AsyncIterator or an async generator function.
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- class a_sync.iter.ASyncGeneratorFunction[source]
Bases:
Generic
[P
,T
]- Description:
Encapsulates an asynchronous generator function, providing a mechanism to use it as an asynchronous iterator with enhanced capabilities. This class wraps an async generator function, allowing it to be called with parameters and return an
ASyncIterator
object. It is particularly useful for situations where an async generator function needs to be used in a manner that is consistent with both synchronous and asynchronous execution contexts.The ASyncGeneratorFunction class supports dynamic binding to instances, enabling it to be used as a method on class instances. When accessed as a descriptor, it automatically handles the binding to the instance, thereby allowing the wrapped async generator function to be invoked with instance context (‘self’) automatically provided. This feature is invaluable for designing classes that need to expose asynchronous generators as part of their interface while maintaining the ease of use and calling semantics similar to regular methods.
By providing a unified interface to asynchronous generator functions, this class facilitates the creation of APIs that are flexible and easy to use in a wide range of asynchronous programming scenarios. It abstracts away the complexities involved in managing asynchronous generator lifecycles and invocation semantics, making it easier for developers to integrate asynchronous iteration patterns into their applications.
- __call__(*args, **kwargs)[source]
Calls the wrapped async generator function with the given arguments and keyword arguments, returning an ASyncIterator.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
- __init__(async_gen_func, instance=None)[source]
Initializes the ASyncGeneratorFunction with the given async generator function and optionally an instance.
- Parameters:
async_gen_func (Callable[[~P], AsyncGenerator[T, None] | AsyncIterator[T]])
instance (Any | None)
- Return type:
None
- _cache_handle: TimerHandle
An asyncio handle used to pop the bound method from instance.__dict__ 5 minutes after its last use.
- field_name
The name of the async generator function.
- class a_sync.iter.ASyncIterable[source]
Bases:
_AwaitableAsyncIterableMixin
[T
],Iterable
[T
]- Description:
A hybrid Iterable/AsyncIterable implementation designed to offer dual compatibility with both synchronous and asynchronous iteration protocols. This class allows objects to be iterated over using either a standard for loop or an async for loop, making it versatile in scenarios where the mode of iteration (synchronous or asynchronous) needs to be flexible or is determined at runtime.
The class achieves this by implementing both __iter__ and __aiter__ methods, enabling it to return appropriate iterator objects that can handle synchronous and asynchronous iteration, respectively. This dual functionality is particularly useful in codebases that are transitioning between synchronous and asynchronous code, or in libraries that aim to support both synchronous and asynchronous usage patterns without requiring the user to manage different types of iterable objects.
- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- __init__(async_iterable)[source]
Initializes the ASyncIterable with an async iterable.
- Parameters:
async_iterable (AsyncIterable[T])
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)[source]
Class method to wrap an AsyncIterable for backward compatibility.
- Parameters:
wrapped (AsyncIterable[T])
- Return type:
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- class a_sync.iter.ASyncIterator[source]
Bases:
_AwaitableAsyncIterableMixin
[T
],Iterator
[T
]- Description:
A hybrid Iterator/AsyncIterator implementation that bridges the gap between synchronous and asynchronous iteration. This class provides a unified interface for iteration that can seamlessly operate in both synchronous (for loop) and asynchronous (async for loop) contexts. It allows the wrapping of asynchronous iterable objects or async generator functions, making them usable in synchronous code without explicitly managing event loops or asynchronous context switches.
By implementing both __next__ and __anext__ methods, ASyncIterator enables objects to be iterated using standard iteration protocols while internally managing the complexities of asynchronous iteration. This design simplifies the use of asynchronous iterables in environments or frameworks that are not inherently asynchronous, such as standard synchronous functions or older codebases being gradually migrated to asynchronous IO.
This class is particularly useful for library developers seeking to provide a consistent iteration interface across synchronous and asynchronous code, reducing the cognitive load on users and promoting code reusability and simplicity.
- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- async __anext__()[source]
Asynchronously fetches the next item from the async iterator.
- Return type:
T
- __init__(async_iterator)[source]
Initializes the ASyncIterator with an async iterator.
- Parameters:
async_iterator (AsyncIterator[T])
- __iter__()
- __next__()[source]
Return the next item from the iterator. When exhausted, raise StopIteration
- Return type:
T
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)[source]
Class method to wrap either an AsyncIterator or an async generator function.
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- class a_sync.iter.ASyncSorter[source]
Bases:
_ASyncView
[T
]- __init__(iterable, *, key=None, reverse=False)[source]
Initializes the ASyncIterator with an async iterator.
- Parameters:
iterable (AsyncIterable[T])
reverse (bool)
- Return type:
None
- __iter__()
- __next__()
Return the next item from the iterator. When exhausted, raise StopIteration
- Return type:
T
- async __sort(reverse)
This method is internal so the original iterator can only ever be consumed once.
- Parameters:
reverse (bool)
- Return type:
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)
Class method to wrap either an AsyncIterator or an async generator function.
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
a_sync.task module
- class a_sync.task.TaskMapping[source]
Bases:
DefaultDict
[K
,asyncio.Task[V]
],AsyncIterable
[Tuple
[K
,V
]]A mapping from keys to asyncio Tasks that asynchronously generates and manages tasks based on input iterables.
- async __aiter__(pop=False)[source]
aiterate thru all key-task pairs, yielding the key-result pair as each task completes
- Parameters:
pop (bool)
- Return type:
AsyncIterator[Tuple[K, V]]
- __cleanup(t)
- Parameters:
t (Task[None])
- Return type:
None
- __init__(wrapped_func=None, *iterables, name='', concurrency=None, **wrapped_func_kwargs)[source]
- Parameters:
wrapped_func (Callable[[Concatenate[K, ~P]], Awaitable[V]] | None) – A function that takes a key (and optional parameters) and returns an Awaitable.
*iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]]) – Any number of iterables whose elements will be used as keys for task generation.
name (str) – An optional name for the tasks created by this mapping.
**wrapped_func_kwargs (~P) – Keyword arguments that will be passed to wrapped_func.
concurrency (int | None)
**wrapped_func_kwargs
- Return type:
None
- __iter__()
Implement iter(self).
- __new__(**kwargs)
- _tasks_for_iterables(*iterables)[source]
Ensure tasks are running for each key in the provided iterables.
- Parameters:
iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]])
- Return type:
AsyncIterator[Tuple[K, Task[V]]]
- copy() a shallow copy of D.
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingValues[K, V]
- keys() a set-like object providing a view on D's keys [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingKeys[K, V]
- map(*iterables, pop=True, yields='both')[source]
Asynchronously map iterables to tasks and yield their results.
Args: *iterables: Iterables to map over. pop: Whether to remove tasks from the internal storage once they are completed. yields: Whether to yield ‘keys’, ‘values’, or ‘both’ (key-value pairs).
Yields: Depending on yields, either keys, values, or tuples of key-value pairs representing the results of completed tasks.
- Parameters:
iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]])
pop (bool)
yields (Literal['keys', 'both'])
- Return type:
AsyncIterator[Tuple[K, V]]
- pop(k[, d]) v, remove specified key and return the corresponding value. [source]
If the key is not found, return the default if given; otherwise, raise a KeyError.
- Parameters:
args (K)
cancel (bool)
- Return type:
Task[V] | Future[V]
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingValues[K, V]
- yield_completed(pop=True)[source]
Asynchronously yield tuples of key-value pairs representing the results of any completed tasks.
- Parameters:
pop (bool) – Whether to remove tasks from the internal storage once they are completed.
- Yields:
Tuples of key-value pairs representing the results of completed tasks.
- Return type:
AsyncIterator[Tuple[K, V]]
- __init_loader_coro: Awaitable[None] | None = None
An optional asyncio Coroutine to be run by the _init_loader
- _destroyed: bool = False
Boolean indicating whether his mapping has been consumed and is no longer usable for aggregations.
- property _init_loader: Task[None] | None
An asyncio Task used to preload values from the iterables.
- _init_loader_next: Callable[[], Awaitable[Tuple[Tuple[K, Task[V]]]]] | None = None
A coro function that blocks until the _init_loader starts a new task(s), and then returns a Tuple[Tuple[K, asyncio.Task[V]]] with all of the new tasks and the keys that started them.
- property _queue: ProcessingQueue
- _wrapped_func
The function used to create tasks for each key.
- default_factory
Factory for default value called by __missing__().
- class a_sync.task.TaskMappingItems[source]
Bases:
_TaskMappingView
[Tuple
[K
,V
],K
,V
],Generic
[K
,V
]- async __aiter__()[source]
- Return type:
AsyncIterator[Tuple[K, V]]
- __init__(view, task_mapping, pop=False)
- Parameters:
view (Iterable[T])
task_mapping (TaskMapping[K, V])
pop (bool)
- Return type:
None
- _get_from_item(item)
- class a_sync.task.TaskMappingKeys[source]
Bases:
_TaskMappingView
[K
,K
,V
],Generic
[K
,V
]- __init__(view, task_mapping, pop=False)
- Parameters:
view (Iterable[T])
task_mapping (TaskMapping[K, V])
pop (bool)
- Return type:
None
- _get_from_item(item)
- class a_sync.task.TaskMappingValues[source]
Bases:
_TaskMappingView
[V
,K
,V
],Generic
[K
,V
]- __init__(view, task_mapping, pop=False)
- Parameters:
view (Iterable[T])
task_mapping (TaskMapping[K, V])
pop (bool)
- Return type:
None
- _get_from_item(item)
- a_sync.task.create_task(coro, *, name=None, skip_gc_until_done=False, log_destroy_pending=True)[source]
Extends asyncio.create_task to support any Awaitable, manage task lifecycle, and enhance error handling.
Unlike asyncio.create_task, which requires a coroutine, this function accepts any Awaitable, ensuring broader compatibility. It optionally prevents the task from being garbage-collected until completion and provides enhanced error management by wrapping exceptions in a custom exception.
- Parameters:
coro (Awaitable[T]) – An Awaitable object from which to create the task.
name (str | None) – Optional name for the task, aiding in debugging.
skip_gc_until_done (bool) – If True, the task is kept alive until it completes, preventing garbage collection.
log_destroy_pending (bool) – If False, asyncio’s default error log when a pending task is destroyed is suppressed.
- Returns:
An asyncio.Task object created from the provided Awaitable.
- Return type:
Task[T]
Module contents
- class a_sync.ASyncCachedPropertyDescriptor[source]
Bases:
_ASyncPropertyDescriptorBase
[I
,T
],AsyncCachedPropertyDescriptor
- async _all(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- async _any(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- _asyncify(func)
Applies only async modifiers.
- _check_method_name(method, method_type)
- _check_method_sync(method, method_type)
- async _max(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _min(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _sum(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- already_loaded(instance)
- del_cache_value(instance)
- deleter(method)
- get_cache(instance)
- get_cache_value(instance)
- get_instance_state(instance)
- has_cache_value(instance)
- map(instances, owner=None, concurrency=None, name='')
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
owner (Type[I] | None)
concurrency (int | None)
name (str)
- Return type:
TaskMapping[I, T]
- not_loaded(instance)
- set_cache_value(instance, value)
- setter(method)
- property all: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- property any: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- field_name
- property max: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- property min: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- modifiers: ModifierManager
- property sum: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- wrapped
- class a_sync.ASyncGenericSingleton[source]
Bases:
ASyncGenericBase
Subclass this class if you want Singleton-esque ASync objects. They work kind of like a typical Singleton would, but you will have two instances instead of one: - one sync instance - one async instance
- class a_sync.ASyncIterable[source]
Bases:
_AwaitableAsyncIterableMixin
[T
],Iterable
[T
]- Description:
A hybrid Iterable/AsyncIterable implementation designed to offer dual compatibility with both synchronous and asynchronous iteration protocols. This class allows objects to be iterated over using either a standard for loop or an async for loop, making it versatile in scenarios where the mode of iteration (synchronous or asynchronous) needs to be flexible or is determined at runtime.
The class achieves this by implementing both __iter__ and __aiter__ methods, enabling it to return appropriate iterator objects that can handle synchronous and asynchronous iteration, respectively. This dual functionality is particularly useful in codebases that are transitioning between synchronous and asynchronous code, or in libraries that aim to support both synchronous and asynchronous usage patterns without requiring the user to manage different types of iterable objects.
- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- __init__(async_iterable)[source]
Initializes the ASyncIterable with an async iterable.
- Parameters:
async_iterable (AsyncIterable[T])
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)[source]
Class method to wrap an AsyncIterable for backward compatibility.
- Parameters:
wrapped (AsyncIterable[T])
- Return type:
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- class a_sync.ASyncIterator[source]
Bases:
_AwaitableAsyncIterableMixin
[T
],Iterator
[T
]- Description:
A hybrid Iterator/AsyncIterator implementation that bridges the gap between synchronous and asynchronous iteration. This class provides a unified interface for iteration that can seamlessly operate in both synchronous (for loop) and asynchronous (async for loop) contexts. It allows the wrapping of asynchronous iterable objects or async generator functions, making them usable in synchronous code without explicitly managing event loops or asynchronous context switches.
By implementing both __next__ and __anext__ methods, ASyncIterator enables objects to be iterated using standard iteration protocols while internally managing the complexities of asynchronous iteration. This design simplifies the use of asynchronous iterables in environments or frameworks that are not inherently asynchronous, such as standard synchronous functions or older codebases being gradually migrated to asynchronous IO.
This class is particularly useful for library developers seeking to provide a consistent iteration interface across synchronous and asynchronous code, reducing the cognitive load on users and promoting code reusability and simplicity.
- __aiter__()
Returns an async iterator for the wrapped async iterable.
- Return type:
- async __anext__()[source]
Asynchronously fetches the next item from the async iterator.
- Return type:
T
- __init__(async_iterator)[source]
Initializes the ASyncIterator with an async iterator.
- Parameters:
async_iterator (AsyncIterator[T])
- __iter__()
- __next__()[source]
Return the next item from the iterator. When exhausted, raise StopIteration
- Return type:
T
- filter(function)
- sort(*, key=None, reverse=False)
- Parameters:
- Return type:
ASyncSorter[T]
- classmethod wrap(wrapped)[source]
Class method to wrap either an AsyncIterator or an async generator function.
- _materialized
Asynchronously iterates through all contents of
Self
and returns alist
containing the results.
- class a_sync.ASyncPropertyDescriptor[source]
Bases:
_ASyncPropertyDescriptorBase
[I
,T
],AsyncPropertyDescriptor
- __init__(_fget, field_name=None, **modifiers)
- Parameters:
field_name (str | None)
modifiers (ModifierKwargs)
- Return type:
None
- async _all(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- async _any(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- _asyncify(func)
Applies only async modifiers.
- async _max(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _min(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _sum(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- awaitable_only(instance)
- get_loader(instance)
- map(instances, owner=None, concurrency=None, name='')
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
owner (Type[I] | None)
concurrency (int | None)
name (str)
- Return type:
TaskMapping[I, T]
- property all: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- property any: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- field_name
- property max: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- property min: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- modifiers: ModifierManager
- property sum: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- wrapped
- class a_sync.AsyncProcessPoolExecutor[source]
Bases:
_AsyncExecutorMixin
,ProcessPoolExecutor
- _adjust_process_count()
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _launch_processes()
- _spawn_process()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _start_executor_manager_thread()
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – If greater than one, the iterables will be chopped into chunks of size chunksize and submitted to the process pool. If set to one, the items in the list will be sent one at a time.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _broken
- _call_queue
- _daemon
- _initargs
- _initializer
- _mp_context
- _pending_work_items
- _processes
- _queue_count
- _queue_management_thread
- _queue_management_thread_wakeup
- _result_queue
- _shutdown_lock
- _shutdown_thread
- _work_ids
- class a_sync.AsyncThreadPoolExecutor[source]
Bases:
_AsyncExecutorMixin
,ThreadPoolExecutor
- _adjust_thread_count()
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _initializer_failed()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _broken
- _counter = <method-wrapper '__next__' of itertools.count object>
- _daemon
- _idle_semaphore
- _initargs
- _initializer
- _shutdown
- _shutdown_lock
- _thread_name_prefix
- _threads
- _work_queue
- class a_sync.CounterLock[source]
Bases:
_DebugDaemonMixin
A asyncio primative that blocks until the internal counter has reached a specific value.
counter = CounterLock() A coroutine can now await counter.wait_for(3) and it will block until the internal counter >= 3. Now if some other task executes counter.value = 5 or counter.set(5), the first coroutine will unblock as 5 >= 3.
The internal counter can only increase.
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- _daemon
- _events: DefaultDict[int, Event]
- _name
- _value
- is_ready
- class a_sync.Event[source]
Bases:
Event
,_DebugDaemonMixin
asyncio.Event but with some additional debug logging to help detect deadlocks.
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _get_loop()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- clear()[source]
Reset the internal flag to false. Subsequently, coroutines calling wait() will block until set() is called to set the internal flag to true again.
- set()[source]
Set the internal flag to true. All coroutines waiting for it to become true are awakened. Coroutine that call wait() once the flag is true will not block at all.
- async wait()[source]
Block until the internal flag is true.
If the internal flag is true on entry, return True immediately. Otherwise, block until another coroutine calls set() to set the flag to true, then return True.
- Return type:
Literal[True]
- _daemon
- _debug_daemon_interval
- _loop: AbstractEventLoop = None
- class a_sync.PrioritySemaphore[source]
Bases:
_AbstractPrioritySemaphore
[int
|float
|Decimal
,_PrioritySemaphoreContextManager
]- _context_manager_class
alias of
_PrioritySemaphoreContextManager
- __call__(fn)
Call self as a function.
- __getitem__(priority)
- Parameters:
priority (PT | None)
- Return type:
- __init__(value=1, *, name=None)
name is used only in debug logs to provide useful context
- async _debug_daemon()
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _get_loop()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- _wake_up_next()
Wake up the first waiter that isn’t done.
- Return type:
None
- async acquire()
Acquire a semaphore.
If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True.
- Return type:
Literal[True]
- decorate(fn)
- release()
Release a semaphore, incrementing the internal counter by one.
When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine.
- _capacity
- _context_managers: Dict[PT, _AbstractPrioritySemaphoreContextManager[PT]]
- _daemon
- _loop = None
- _top_priority = -1
It’s kinda like a regular Semaphore but you must give each waiter a priority:
``` priority_semaphore = PrioritySemaphore(10)
- async with priority_semaphore[priority]:
await do_stuff()
You can aenter and aexit this semaphore without a priority and it will process those first. Like so:
``` priority_semaphore = PrioritySemaphore(10)
- async with priority_semaphore:
await do_stuff()
- _waiters: List[_AbstractPrioritySemaphoreContextManager[PT]]
- a_sync.ProcessPoolExecutor
alias of
AsyncProcessPoolExecutor
- class a_sync.ProcessingQueue[source]
Bases:
_Queue
[Tuple
[P
,asyncio.Future[V]
]],Generic
[P
,V
]- __call__(*args, **kwargs)[source]
Call self as a function.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
Future[V]
- _format()
- _get()
- _get_loop()
- _init(maxsize)
- _put(item)
- _wakeup_next(waiters)
- empty()
Return True if the queue is empty, False otherwise.
- full()
Return True if there are maxsize items in the queue.
Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True.
- async get()
Remove and return an item from the queue.
If queue is empty, wait until an item is available.
- get_nowait()
Remove and return an item from the queue.
Return an item if one is immediately available, else raise QueueEmpty.
- async join()
Block until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.
- async put(*args, **kwargs)[source]
Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
Future[V]
- put_nowait(*args, **kwargs)[source]
Put an item into the queue without blocking.
If no free slot is immediately available, raise QueueFull.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
Future[V]
- qsize()
Number of items in the queue.
- task_done()
Indicate that a formerly enqueued task is complete.
Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.
If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).
Raises ValueError if called more times than there were items placed in the queue.
- _finished
- _getters
- _loop = None
- _maxsize
- _putters
- _unfinished_tasks
- _worker_coro
- func
- property maxsize
Number of items allowed in the queue.
- num_workers
- class a_sync.PruningThreadPoolExecutor[source]
Bases:
AsyncThreadPoolExecutor
This ThreadPoolExecutor implementation prunes inactive threads after ‘timeout’ seconds without a work item. Pruned threads will be automatically recreated as needed for future workloads. up to ‘max_threads’ can be active at any one time.
- __init__(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), timeout=600)[source]
- async _debug_daemon(fut, fn, *args, **kwargs)
Runs until manually cancelled by the finished work item
- Parameters:
fut (Future)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _initializer_failed()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- map(fn, *iterables, timeout=None, chunksize=1)
Returns an iterator equivalent to map(fn, iter).
- Parameters:
fn – A callable that will take as many arguments as there are passed iterables.
timeout – The maximum number of seconds to wait. If None, then there is no limit on the wait time.
chunksize – The size of the chunks the iterable will be broken into before being passed to a child process. This argument is only used by ProcessPoolExecutor; it is ignored by ThreadPoolExecutor.
- Returns:
map(func, *iterables) but the calls may be evaluated out-of-order.
- Return type:
An iterator equivalent to
- Raises:
TimeoutError – If the entire result iterator could not be generated before the given timeout.
- async run(fn, *args, **kwargs)
A shorthand way to call await asyncio.get_event_loop().run_in_executor(this_executor, fn, *args) Doesn’t await this_executor.run(fn, *args) look so much better?
Oh, and you can also use kwargs!
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
T
- shutdown(wait=True, *, cancel_futures=False)
Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other methods can be called after this one.
- Parameters:
wait – If True then shutdown will not return until all running futures have finished executing and the resources used by the executor have been reclaimed.
cancel_futures – If True then shutdown will cancel all pending futures. Futures that are completed or running will not be cancelled.
- submit(fn, *args, **kwargs)
Submits a job to the executor and returns an asyncio.Future that can be awaited for the result without blocking.
- Parameters:
fn (Callable[[~P], T])
args (~P)
kwargs (~P)
- Return type:
Future[T]
- _adjusting_lock
- _broken
- _counter = <method-wrapper '__next__' of itertools.count object>
- _daemon
- _idle_semaphore
- _initargs
- _initializer
- _shutdown
- _shutdown_lock
- _thread_name_prefix
- _threads
- _timeout
- _work_queue
- class a_sync.Queue[source]
Bases:
_Queue
[T
]- _get_loop()
- full()[source]
Return True if there are maxsize items in the queue.
Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True.
- async get()[source]
Remove and return an item from the queue.
If queue is empty, wait until an item is available.
- Return type:
T
- get_all_nowait()[source]
returns 1 or more items, or raises asyncio.QueueEmpty
- Return type:
List[T]
- get_multi_nowait(i, can_return_less=False)[source]
Just like asyncio.Queue.get_nowait, but will return i items instead of 1. Set can_return_less to True if you want to receive up to i items.
- get_nowait()[source]
Remove and return an item from the queue.
Return an item if one is immediately available, else raise QueueEmpty.
- Return type:
T
- async join()[source]
Block until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.
- async put(item)[source]
Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.
- Parameters:
item (T)
- Return type:
None
- put_nowait(item)[source]
Put an item into the queue without blocking.
If no free slot is immediately available, raise QueueFull.
- Parameters:
item (T)
- Return type:
None
- task_done()[source]
Indicate that a formerly enqueued task is complete.
Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.
If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).
Raises ValueError if called more times than there were items placed in the queue.
- _finished
- _getters
- _loop = None
- _maxsize
- _putters
- _unfinished_tasks
- property maxsize
Number of items allowed in the queue.
- class a_sync.Semaphore[source]
Bases:
Semaphore
,_DebugDaemonMixin
- __init__(value, name=None, **kwargs)[source]
name is used only in debug logs to provide useful context
- Parameters:
value (int)
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _get_loop()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- async acquire()[source]
Acquire a semaphore.
If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True.
- Return type:
Literal[True]
- release()[source]
Release a semaphore, incrementing the internal counter by one.
When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine.
- _daemon
- _loop = None
- _value
- _waiters
- name
- class a_sync.SmartProcessingQueue[source]
Bases:
_VariablePriorityQueueMixin
[T
],ProcessingQueue
[Concatenate
[T
,P
],V
]A PriorityProcessingQueue subclass that will execute jobs with the most waiters first
- __call__(*args, **kwargs)
Call self as a function.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
Future[V]
- __init__(func, num_workers, *, name='', loop=None)[source]
- Parameters:
func (Callable[[Concatenate[T, ~P]], Awaitable[V]])
num_workers (int)
name (str)
loop (AbstractEventLoop | None)
- Return type:
None
- _ensure_workers()
- Return type:
None
- _format()
- _get_loop()
- _init(maxsize)
- _put(item, heappush=<built-in function heappush>)
- _wakeup_next(waiters)
- close()
- Return type:
None
- empty()
Return True if the queue is empty, False otherwise.
- full()
Return True if there are maxsize items in the queue.
Note: if the Queue was initialized with maxsize=0 (the default), then full() is never True.
- async get()
Remove and return an item from the queue.
If queue is empty, wait until an item is available.
- get_nowait()
Remove and return an item from the queue.
Return an item if one is immediately available, else raise QueueEmpty.
- async join()
Block until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue. The count goes down whenever a consumer calls task_done() to indicate that the item was retrieved and all work on it is complete. When the count of unfinished tasks drops to zero, join() unblocks.
- async put(*args, **kwargs)[source]
Put an item into the queue.
Put an item into the queue. If the queue is full, wait until a free slot is available before adding item.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
SmartFuture[V]
- put_nowait(*args, **kwargs)[source]
Put an item into the queue without blocking.
If no free slot is immediately available, raise QueueFull.
- Parameters:
args (~P)
kwargs (~P)
- Return type:
SmartFuture[V]
- qsize()
Number of items in the queue.
- task_done()
Indicate that a formerly enqueued task is complete.
Used by queue consumers. For each get() used to fetch a task, a subsequent call to task_done() tells the queue that the processing on the task is complete.
If a join() is currently blocking, it will resume when all items have been processed (meaning that a task_done() call was received for every item that had been put() into the queue).
Raises ValueError if called more times than there were items placed in the queue.
- _finished
- _futs: WeakValueDictionary[Tuple[Tuple[Any], Tuple[Tuple[str, Any]]], SmartFuture[T]]
- _getters
- _loop = None
- _maxsize
- _no_futs = False
- _putters
- _unfinished_tasks
- _worker_coro
- func
- property maxsize
Number of items allowed in the queue.
- num_workers
- class a_sync.TaskMapping[source]
Bases:
DefaultDict
[K
,asyncio.Task[V]
],AsyncIterable
[Tuple
[K
,V
]]A mapping from keys to asyncio Tasks that asynchronously generates and manages tasks based on input iterables.
- async __aiter__(pop=False)[source]
aiterate thru all key-task pairs, yielding the key-result pair as each task completes
- Parameters:
pop (bool)
- Return type:
AsyncIterator[Tuple[K, V]]
- __cleanup(t)
- Parameters:
t (Task[None])
- Return type:
None
- __init__(wrapped_func=None, *iterables, name='', concurrency=None, **wrapped_func_kwargs)[source]
- Parameters:
wrapped_func (Callable[[Concatenate[K, ~P]], Awaitable[V]] | None) – A function that takes a key (and optional parameters) and returns an Awaitable.
*iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]]) – Any number of iterables whose elements will be used as keys for task generation.
name (str) – An optional name for the tasks created by this mapping.
**wrapped_func_kwargs (~P) – Keyword arguments that will be passed to wrapped_func.
concurrency (int | None)
**wrapped_func_kwargs
- Return type:
None
- __iter__()
Implement iter(self).
- __new__(**kwargs)
- _tasks_for_iterables(*iterables)[source]
Ensure tasks are running for each key in the provided iterables.
- Parameters:
iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]])
- Return type:
AsyncIterator[Tuple[K, Task[V]]]
- copy() a shallow copy of D.
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingValues[K, V]
- keys() a set-like object providing a view on D's keys [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingKeys[K, V]
- map(*iterables, pop=True, yields='both')[source]
Asynchronously map iterables to tasks and yield their results.
Args: *iterables: Iterables to map over. pop: Whether to remove tasks from the internal storage once they are completed. yields: Whether to yield ‘keys’, ‘values’, or ‘both’ (key-value pairs).
Yields: Depending on yields, either keys, values, or tuples of key-value pairs representing the results of completed tasks.
- Parameters:
iterables (AsyncIterable[K] | Iterable[K] | Awaitable[AsyncIterable[K] | Iterable[K]])
pop (bool)
yields (Literal['keys', 'both'])
- Return type:
AsyncIterator[Tuple[K, V]]
- pop(k[, d]) v, remove specified key and return the corresponding value. [source]
If the key is not found, return the default if given; otherwise, raise a KeyError.
- Parameters:
args (K)
cancel (bool)
- Return type:
Task[V] | Future[V]
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values [source]
- Parameters:
pop (bool)
- Return type:
TaskMappingValues[K, V]
- yield_completed(pop=True)[source]
Asynchronously yield tuples of key-value pairs representing the results of any completed tasks.
- Parameters:
pop (bool) – Whether to remove tasks from the internal storage once they are completed.
- Yields:
Tuples of key-value pairs representing the results of completed tasks.
- Return type:
AsyncIterator[Tuple[K, V]]
- __init_loader_coro: Awaitable[None] | None = None
An optional asyncio Coroutine to be run by the _init_loader
- _destroyed: bool = False
Boolean indicating whether his mapping has been consumed and is no longer usable for aggregations.
- property _init_loader: Task[None] | None
An asyncio Task used to preload values from the iterables.
- _init_loader_next: Callable[[], Awaitable[Tuple[Tuple[K, Task[V]]]]] | None = None
A coro function that blocks until the _init_loader starts a new task(s), and then returns a Tuple[Tuple[K, asyncio.Task[V]]] with all of the new tasks and the keys that started them.
- property _queue: ProcessingQueue
- _wrapped_func
The function used to create tasks for each key.
- default_factory
Factory for default value called by __missing__().
- a_sync.ThreadPoolExecutor
alias of
AsyncThreadPoolExecutor
- class a_sync.ThreadsafeSemaphore[source]
Bases:
Semaphore
While its a bit weird to run multiple event loops, sometimes either you or a lib you’re using must do so. When in use in threaded applications, this semaphore will not work as intended but at least your program will function. You may need to reduce the semaphore value for multi-threaded applications.
# TL;DR it’s a janky fix for an edge case problem and will otherwise function as a normal a_sync.Semaphore (which is just an asyncio.Semaphore with extra bells and whistles).
- __call__(fn)
Call self as a function.
- async _debug_daemon()
- Return type:
None
- _ensure_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _get_loop()
- _start_debug_daemon(*args, **kwargs)
- Return type:
Future[None]
- _stop_debug_daemon(t=None)
- Parameters:
t (Task | None)
- Return type:
None
- _wake_up_next()
Wake up the first waiter that isn’t done.
- async acquire()
Acquire a semaphore.
If the internal counter is larger than zero on entry, decrement it by one and return True immediately. If it is zero on entry, block, waiting until some other coroutine has called release() to make it larger than 0, and then return True.
- Return type:
Literal[True]
- decorate(fn)
- locked()
Returns True if semaphore cannot be acquired immediately.
- release()
Release a semaphore, incrementing the internal counter by one.
When it was zero on entry and another coroutine is waiting for it to become larger than zero again, wake up that coroutine.
- _daemon
- _loop = None
- _value
- _waiters
- dummy
- name
- semaphores: DefaultDict[Thread, Semaphore]
- class a_sync.cached_property[source]
Bases:
ASyncCachedPropertyDescriptor
[I
,T
]- __init__(_fget, _fset=None, _fdel=None, field_name=None, **modifiers)
- async _all(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- async _any(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- _asyncify(func)
Applies only async modifiers.
- _check_method_name(method, method_type)
- _check_method_sync(method, method_type)
- async _max(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _min(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _sum(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- already_loaded(instance)
- del_cache_value(instance)
- deleter(method)
- get_cache(instance)
- get_cache_value(instance)
- get_instance_state(instance)
- get_lock(instance)
- Parameters:
instance (I)
- Return type:
Task[T]
- has_cache_value(instance)
- map(instances, owner=None, concurrency=None, name='')
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
owner (Type[I] | None)
concurrency (int | None)
name (str)
- Return type:
TaskMapping[I, T]
- not_loaded(instance)
- pop_lock(instance)
- Parameters:
instance (I)
- Return type:
None
- set_cache_value(instance, value)
- setter(method)
- property all: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- property any: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- field_name
- property max: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- property min: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- modifiers: ModifierManager
- property sum: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- wrapped
- a_sync.filter
alias of
ASyncFilter
- a_sync.map
alias of
TaskMapping
- class a_sync.property[source]
Bases:
ASyncPropertyDescriptor
[I
,T
]- __init__(_fget, field_name=None, **modifiers)
- Parameters:
field_name (str | None)
modifiers (ModifierKwargs)
- Return type:
None
- async _all(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- async _any(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
- _asyncify(func)
Applies only async modifiers.
- async _max(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _min(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- async _sum(*instances, concurrency=None, name='', **kwargs)
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
concurrency (int | None)
name (str)
kwargs (~P)
- Return type:
T
- awaitable_only(instance)
- get_loader(instance)
- map(instances, owner=None, concurrency=None, name='')
- Parameters:
instances (AsyncIterable[I] | Iterable[I])
owner (Type[I] | None)
concurrency (int | None)
name (str)
- Return type:
TaskMapping[I, T]
- property all: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- property any: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], bool]
- field_name
- property max: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- property min: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- modifiers: ModifierManager
- property sum: ASyncFunction[Concatenate[AsyncIterable[I] | Iterable[I], P], T]
- wrapped
- a_sync.sorted
alias of
ASyncSorter
- a_sync.a_sync(coro_fn=None, default=None, **modifiers)[source]
- Parameters:
- Return type:
ASyncDecorator | ASyncFunction[~P, T]
- a_sync.as_completed(fs, *, timeout=None, return_exceptions=False, aiter=False, tqdm=False, **tqdm_kwargs)[source]
Concurrently awaits a list of awaitable objects or mappings of awaitables and returns an iterator of results.
This function extends Python’s asyncio.as_completed, providing additional features for mixed use cases of individual awaitable objects and mappings of awaitables.
Differences from asyncio.as_completed: - Uses type hints for use with static type checkers. - Supports either individual awaitables or a k:v mapping of awaitables. - Can be used as an async iterator which yields the result values. Example below. - Provides progress reporting using tqdm if ‘tqdm’ is set to True.
- Parameters:
fs (Iterable[Awaitable[T] or Mapping[K, Awaitable[V]]]) – The awaitables to await concurrently. It can be a list of individual awaitables or a mapping of awaitables.
timeout (float, optional) – The maximum time, in seconds, to wait for the completion of awaitables. Defaults to None (no timeout).
return_exceptions (bool, optional) – If True, exceptions are returned as results instead of raising them. Defaults to False.
aiter (bool, optional) – If True, returns an async iterator of results. Defaults to False.
tqdm (bool, optional) – If True, enables progress reporting using tqdm. Defaults to False.
**tqdm_kwargs – Additional keyword arguments for tqdm if progress reporting is enabled.
- Returns:
An iterator of results when awaiting individual awaitables or an async iterator when awaiting mappings.
- Return type:
Iterator[Coroutine[Any, Any, T] or ASyncIterator[Tuple[K, V]]]
Examples
Awaiting individual awaitables: ``` awaitables = [async_function1(), async_function2()] for coro in as_completed(awaitables):
val = await coro …
- async for val in as_completed(awaitables, aiter=True):
…
Awaiting mappings of awaitables: ``` mapping = {‘key1’: async_function1(), ‘key2’: async_function2()}
- for coro in as_completed(mapping):
k, v = await coro …
- async for k, v in as_completed(mapping, aiter=True):
…
- async a_sync.as_yielded(*iterators)[source]
- Description:
Merges multiple async iterators into a single async iterator that yields items as they become available from any of the source iterators.
This function is designed to streamline the handling of multiple asynchronous data streams by consolidating them into a single asynchronous iteration context. It enables concurrent fetching and processing of items from multiple sources, improving efficiency and simplifying code structure when dealing with asynchronous operations.
The merging process is facilitated by internally managing a queue where items from the source iterators are placed as they are fetched. This mechanism ensures that the merged stream of items is delivered in an order determined by the availability of items from the source iterators, rather than their original sequence.
- Parameters:
*iterators (AsyncIterator[T]) – Variable length list of AsyncIterator objects to be merged.
- Returns:
An async iterator that yields items from the input async iterators as they become available.
- Return type:
AsyncIterator[T]
Note
This implementation leverages asyncio tasks and queues to efficiently manage the asynchronous iteration and merging process. It handles edge cases such as early termination and exception management, ensuring robustness and reliability.
- a_sync.create_task(coro, *, name=None, skip_gc_until_done=False, log_destroy_pending=True)[source]
Extends asyncio.create_task to support any Awaitable, manage task lifecycle, and enhance error handling.
Unlike asyncio.create_task, which requires a coroutine, this function accepts any Awaitable, ensuring broader compatibility. It optionally prevents the task from being garbage-collected until completion and provides enhanced error management by wrapping exceptions in a custom exception.
- Parameters:
coro (Awaitable[T]) – An Awaitable object from which to create the task.
name (str | None) – Optional name for the task, aiding in debugging.
skip_gc_until_done (bool) – If True, the task is kept alive until it completes, preventing garbage collection.
log_destroy_pending (bool) – If False, asyncio’s default error log when a pending task is destroyed is suppressed.
- Returns:
An asyncio.Task object created from the provided Awaitable.
- Return type:
Task[T]
- async a_sync.gather(*awaitables, return_exceptions=False, exclude_if=None, tqdm=False, **tqdm_kwargs)[source]
Concurrently awaits a list of awaitable objects or mappings of awaitables and returns the results.
This function extends Python’s asyncio.gather, providing additional features for mixed use cases of individual awaitable objects and mappings of awaitables.
Differences from asyncio.gather: - Uses type hints for use with static type checkers. - Supports gathering either individual awaitables or a k:v mapping of awaitables. - Provides progress reporting using tqdm if ‘tqdm’ is set to True.
- Parameters:
*awaitables (Awaitable[T] | Mapping[K, Awaitable[V]]) – The awaitables to await concurrently. It can be a single awaitable or a mapping of awaitables.
return_exceptions (bool, optional) – If True, exceptions are returned as results instead of raising them. Defaults to False.
tqdm (bool, optional) – If True, enables progress reporting using tqdm. Defaults to False.
**tqdm_kwargs – Additional keyword arguments for tqdm if progress reporting is enabled.
- Returns:
A list of results when awaiting individual awaitables or a dictionary of results when awaiting mappings.
- Return type:
Union[List[T], Dict[K, V]]
Examples
Awaiting individual awaitables: results will be a list containing the result of each awaitable in sequential order
` results = await gather(thing1(), thing2()) `
Awaiting mappings of awaitables results will be a dictionary with ‘key1’ mapped to the result of thing1() and ‘key2’ mapped to the result of thing2.
` mapping = {'key1': thing1(), 'key2': thing2()} results = await gather(mapping) `