No project description provided
Project description
anyioc
Another simple ioc framework for python.
Usage
from anyioc import ServiceProvider
provider = ServiceProvider()
provider.register_singleton('the key', lambda x: 102) # x will be scoped ServiceProvider
value = provider.get('the key')
assert value == 102
Need global ServiceProvider ? try from anyioc.g import ioc
.
Details
Predefined keys
There are some predefined keys you can use direct, but you still can overwrite it:
ioc
- get current scoped ServiceProvider instance.provider
- alias ofioc
service_provider
- alias ofioc
provider.get()
vs provider[]
provider[]
will raise ServiceNotFoundError
when service was not found;
provider.get()
only return None
without error.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anyioc-0.5.0.tar.gz
(5.6 kB
view details)
Built Distribution
File details
Details for the file anyioc-0.5.0.tar.gz
.
File metadata
- Download URL: anyioc-0.5.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d188b036347212d6e27692a4fb21fd01b8bcecf6734dd34b5130edbdd77b86bb |
|
MD5 | ee005704c28b2c3bcf4d49d9d16a0b42 |
|
BLAKE2b-256 | fcf191ce875433559bf2b6c3fb435f7dedd2b25e1558b58ab80c18e95384038c |
File details
Details for the file anyioc-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: anyioc-0.5.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec5d115d5b6c95ea686c7a868067742a32f565566c8624a5d0f5f59d71d95bcb |
|
MD5 | e766e8f5ba87c4c9edff49aaea4ddb9e |
|
BLAKE2b-256 | cd3d40654ced5c552ef19bff408746386cdb1214ea3448381d8d0dd3a53a9b80 |