Class decorator to enable async __init__
Project description
asyncinit -- Enable async __init__
This package provides the asyncinit decorator, which enables an asynchronous constructor
to be called like any other asynchronous function.
Example
from asyncinit import asyncinit
@asyncinit
class MyClass:
async def __init__(self, param):
self.val = await self.deferredFn(param)
async def deferredFn(self, x):
# ...
return x + 2
obj = await MyClass(42)
assert obj.val == 44
Installation
This package requires Python >= 3.5.0 and can be installed with pip:
pip install asyncinit
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncinit-0.2.3.tar.gz
(2.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncinit-0.2.3.tar.gz.
File metadata
- Download URL: asyncinit-0.2.3.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8d8fded72541e39361973d86d6df829ed85b472309747f167eb9510580342f0
|
|
| MD5 |
81318389823cb8a2e237022d4f206ef0
|
|
| BLAKE2b-256 |
86b73e9c838312e7f785db150bfb945386621c68103634490e411572b8eacd8a
|
File details
Details for the file asyncinit-0.2.3-py3-none-any.whl.
File metadata
- Download URL: asyncinit-0.2.3-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9ca71891a8ae9d9a6efd7070fc1d1f8afa7b38fd873a47f351ea7c9092583d8
|
|
| MD5 |
a8aa45c4577756788c18691227d8ba70
|
|
| BLAKE2b-256 |
dfacc9bc8619f35ce7e6f062dde759bc8301344d13ed72c1a81b19a336159d84
|