A simple simple item
Project description
SimpleItem
Python SimpleItem Library.
Installing
Install and update using pip3:
$ pip3 install simpleitem
Python 3 and newer.
SimpleItem Example
Easy to define and use features.
>> from simpleitem import SimpleItem
>> item1 = SimpleItem()
>> item1.node1 = 1
>> item1['node2']node3 = 3
>> item1['node1']
1
>> item1.node2.node3
3
>> item1['node2'].node3
3
>> item1.node2['node3']
3
>> item1['node2']['node3']
3
Other Usage Examples
>> item2 = SimpleItem()
>> item2['node1'] = 1
>> item2['node2']['node3'] = 3
>> item3 = SimpleItem(node1=1, node2={'node3': 3})
>> item4 = SimpleItem(**{'node1': 1, 'node2': {'node3': 3}})
>> item5 = SimpleItem()
>> item5(node1=1, node2={'node3': 3})
>> item6 = SimpleItem()
>> item6(**{'node1': 1, 'node2': {'node3': 3}})
path; test.yaml
- settings:
username: admin
host: 0.0.0.0
>> item = SimpleItem()
>> item.from_yaml(path)
>> item.setting.username
admin
>> setting = item.setting
>> setting.host
0.0.0.0
MemoryStorage Example
MemoryStorage designed as singleton pattern, define somewhere use everywhere.
>> from simpleitem import MemoryStorage
>> storage = MemoryStorage()
>> settings = storage.settings
>> settings.sleep = 1
>> settings.sleep
1
>> settings(debug=True)
>> storage.settings.debug
True
Support
Python 3.x
Supports all operating systems
Links
License: MIT License
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
simpleitem-0.0.2.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for simpleitem-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab793e63a8d1fea97c10c44dc25d5ab03b65d0a3978828fdab0497186c5bd643 |
|
MD5 | c8b684d20093a267c14195b3bed591a9 |
|
BLAKE2b-256 | 2e033f5712483a3ca4ae4ac04b00845e90b1c2e2f3496abfdc48a206a43ff0cc |