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.8.tar.gz
(8.8 kB
view hashes)
Built Distribution
cdxbasics-0.0.8-py3-none-any.whl
(10.2 kB
view hashes)
Close
Hashes for cdxbasics-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 155f9c29670ee3d5517ea6c51469a03cf4a103c6c337c710d26934a002a276d3 |
|
MD5 | 0746e5616f5beb8b2d49e7ba6268fdea |
|
BLAKE2b-256 | a5d26e083110a5ef5fc3ac391958c9abf6826387da36a366bc2527076a038611 |