Basic Python tools
Project description
cdxbasics
Collection of basic tools for Python development. Highlights are
- Generic(): object which operates both like a dictionary and like an object, e.g. one can write
from cdxbasics import Generic
g = Generic(a=1, b=2) # construction with nice keywords
g.c = 3
a = g.a
a = g['a']
d = g.get('d',None) # with default
e = g('e',None) # with default
del c
del .... - Logger: classic C++ style defensive programming VERIFY tools, e.g.
from cdxbasics import Logger
_log = Logger(__file__)
_log.verify( a==1, "'a' is not one but %s", a)
_log.warn_if( a!=1, "'a' was not one but %s", a)
and other features. - dctkwargs: tool to capture misspelled **kwargs.
Use
from cdxbasics import dctkwargs
def f(**kwargs):
kwargs = dctkwargs(kwargs)
a = kwargs('a') # standard
b = kwargs('b', None) # with default
assert kwargs.isDone(), "Unknown keywords: %s" % str(kwargs) - fmt(): integrated short cut
- uniqueHash(): runs a standard hash over most combinations of standard elements or objects
- plain(): converts most combinations of standards elements or objects into plain list/dict structures
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
cdxbasics-0.0.6.tar.gz
(8.6 kB
view hashes)
Built Distribution
cdxbasics-0.0.6-py3-none-any.whl
(10.1 kB
view hashes)
Close
Hashes for cdxbasics-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b09bf477daff48fb0cd76a08bf416e218827b6c26eecd3f5b5e82f40d9bde79f |
|
MD5 | 03704f78610d0a8427f368898e394c92 |
|
BLAKE2b-256 | dbca698fd37c502e017a194636a7e36a4d4cd9a15fb3795a17341da2286b1425 |