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.8.2.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

bearlib-0.8.2-py2-none-any.whl (8.9 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for bearlib-0.8.2.tar.gz
Algorithm Hash digest
SHA256 eafd7cd6ff1337a246041499dc33c43df4c4ca393ad901660fb62da799499962
MD5 92e37156bcb7968c977d623cab56b4e7
BLAKE2b-256 1f82ca074a3a91637321e0eb0bfc4067d620ddf1a6d11d05acaa480a9ee6fc10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bearlib-0.8.2-py2-none-any.whl
Algorithm Hash digest
SHA256 90db2e590e1054a0b25009518caf256ac7363f9b8d1176598c6db655d58a2be2
MD5 80d052447a1b62cde51b6ffbcbcfb4d4
BLAKE2b-256 5d6c71a89ff8a375b19aeaeb8e12a22847a2cd7ffafb1107a9ad481eef6a1155

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