aioconfig-0.4.8
توضیحات
-
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aioconfig-0.4.8 |
| نام | aioconfig |
| نسخه کتابخانه | 0.4.8 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Johann Chang |
| ایمیل نویسنده | mr.changyuheng@gmail.com |
| آدرس صفحه اصلی | https://github.com/changyuheng/aioconfig.py |
| آدرس اینترنتی | https://pypi.org/project/aioconfig/ |
| مجوز | MPL-2.0 |
# aioconfig
`aioconfig` **efficiently** and **thread-safely** stores configurations in the
background (**asynchronously**).
## Installation
```sh
pip install aioconfig
```
## Usage
The interface of `aioconfig` is dramatically easy to use.
For example, both `set(key, value)` and `await set(key, value)` store a pair of
key/value, which the former one is a fire-and-forget asynchronous function call
while the latter one blocks until the data written onto the disk.
### Init
```py
import aioconfig
storage = aioconfig.get_storage(await aioconfig.attach('example.db'))
section = await aioconfig.get('default')
```
### Delete
```py
section.delete(key='foo')
```
#### Blocking delete (wait until it's done)
```py
await section.delete(key='foo')
```
### Get
```py
value1 = await section.get(key='foo', default='bar')
value2 = await section.get(key='baz', default=12.3)
```
### Get all
```py
value = await section.get_all()
```
### Set (fire-and-forget)
```py
section.set(key='foo', value='bar')
section.set(key='baz', value=12.3)
```
#### Blocking set (wait until it's done)
```py
await section.set(key='foo', value='bar')
await section.set(key='baz', value=12.3)
```
### Batch set (fire-and-forget) (TBD)
```py
with storage.transation():
storage.set(
key='foo', value='bar',
section='default_section')
storage.set(
key='baz', value=12.3,
section='default_section')
```
#### Blocking batch set (wait until it's done) (TBD)
```py
async with storage.transation():
storage.set(
key='foo', value='bar',
section='default_section')
storage.set(
key='baz', value=12.3,
section='default_section')
```
نیازمندی
| مقدار | نام |
|---|---|
| >=1.1.2,<2.0.0 | dataset |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.5,<4.0 | Python |
نحوه نصب
نصب پکیج whl aioconfig-0.4.8:
pip install aioconfig-0.4.8.whl
نصب پکیج tar.gz aioconfig-0.4.8:
pip install aioconfig-0.4.8.tar.gz