asyncs
AsyncCollection
A class that allows for asynchronous iteration over a collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection |
iterable
|
The collection to iterate over. |
required |
Attributes:
Name | Type | Description |
---|---|---|
collection |
iterable
|
The collection to iterate over. |
Source code in pypdtools\utils\asyncs.py
__aenter__()
async
__aexit__(exc_type, exc, tb)
async
Exit the async context.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exc_type |
type
|
The type of the exception (if any). |
required |
exc |
Exception
|
The exception instance (if any). |
required |
tb |
traceback
|
The traceback object (if any). |
required |
Source code in pypdtools\utils\asyncs.py
__aiter__()
async
Asynchronously iterate over the collection.
Yields:
Name | Type | Description |
---|---|---|
Any |
Iterator
|
The next item in the collection. |
__anext__()
async
Asynchronously get the next item in the collection.
Raises:
Type | Description |
---|---|
StopAsyncIteration
|
If there are no more items in the collection. |
Returns:
Name | Type | Description |
---|---|---|
Any |
Awaitable
|
The next item in the collection. |
Source code in pypdtools\utils\asyncs.py
map(func)
async
Asynchronously apply a function to each item in the collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func |
callable
|
The function to apply. |
required |
Returns:
Name | Type | Description |
---|---|---|
List |
List
|
A list of the results of applying the function to each item in the collection. |