Guard that provide exclusive access to an object
Python 3.7 or higher.
Install: pip install asyncio-guard
Examples of usage:
- Set a value, get exclusive access to it, set another value
guard = Guard(obj=1)
async with guard as obj:
assert obj == 1
await guard.set(2)
async with guard as obj:
assert obj == 2
- Update a value by using update function.
This update function will be used, if no value was set up.
guard = Guard(obj=1, update_func=lambda: return 2)
async with guard as obj:
assert obj == 1
await guard.update_func()
async with guard as obj:
assert obj == 2
Metadata
Release files for asyncio-guard 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncio_guard-1.0.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncio_guard-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / asyncio_guard-1.0.0.tar.gz
| Download URL | asyncio_guard-1.0.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d5166d36178e165a367da3a7bcdc17666eabed104f1d3cef1533d26f1e0b802
|
|
BLAKE2b-256 checksum How to use checksums |
b4fb3b48eeb8f97aa5745fa9d5f0814c3b105cb546fc8f7eb3aced837f2aff42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|
Release files / asyncio_guard-1.0.0-py3-none-any.whl
| Download URL | asyncio_guard-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2fedecaad836d0a2450503c037eeb7d20f9cd98da0f10f83bcf4ac6813e9550
|
|
BLAKE2b-256 checksum How to use checksums |
52abb06cb86e0002d95729d78b63c9a4cd67d56b23316504b50dcc07813b8ea8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.14
|