Skip to main content

bear's toolkit

Project description

bearlib

A simple collection of helper routines that I use in a lot of projects.

Wheel Status

I used to just copy the directory into each project…

yes, a build/release person was breaking all the rules - sigh

Config

A dictionary based config class:

c = Config({ 'a': 1, 'b': 2, 'c': {'d': 1}}
print("c.a =", c.a)
print("c.c.d" =", c.c.d)

generates:

c.a = 1
c.c.d = 1

It also has three helper methods:

fromDict(dictionary)
fromJson(filename)
fromEtcd(host='127.0.0.1', port=4001, base='/')

fromDict() walks thru the keys of the given dictionary recursively and adds them to the object. Any key found that has a list or dictionary value is handled with instances of Config created as needed.

fromJson() uses json.load() to process the given filename and then calls fromDict() to store the values.

fromEtcd() walks the directory tree at the base location in the etcd server, builds a dictionary and then passes that to fromDict() for storage.

Install

from PyPI:

pip install bearlib

from git:

cd /base/of/your/virtualenv
pip install -e git+https://github.com/bear/bearlib.git#egg=bearlib

to update the from-git install:

cd /base/of/your/virtualenv pip install –upgrade -e git+https://github.com/bear/bearlib.git#egg=bearlib

Tests

From the source directory:

make test

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

bearlib-0.7.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

bearlib-0.7.1-py2-none-any.whl (7.9 kB view details)

Uploaded Python 2

File details

Details for the file bearlib-0.7.1.tar.gz.

File metadata

  • Download URL: bearlib-0.7.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bearlib-0.7.1.tar.gz
Algorithm Hash digest
SHA256 335d278d2ae53b20031d97493343d176c031947185069134412923e38eb16c23
MD5 3233e0eb2b96c71f3146636a02a4f13e
BLAKE2b-256 e7b61edfd510c38e76b53b085bfaa9334d0d59e55108a4f7259eb330af4c3bd4

See more details on using hashes here.

File details

Details for the file bearlib-0.7.1-py2-none-any.whl.

File metadata

File hashes

Hashes for bearlib-0.7.1-py2-none-any.whl
Algorithm Hash digest
SHA256 7beae69e51b35d1f7b3dde76ce87b2e7bb1cf3cf4c4c7171a3e6b62a1ffbb256
MD5 c6da45e6c4ae31e1c0bd1f86edc24501
BLAKE2b-256 95b4435780379210867c906e9183d5f024b1cd05ba786443a66a6404ffe12cab

See more details on using hashes here.

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