Skip to main content

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

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

simpleitem-0.0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

simpleitem-0.0.2-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page