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 g.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(): C++ style format function.
- 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.
Version 0.20 also contains a few tools to handle file i/o in a transparent way in the new subdir module. For the time being this is experimental. Please share any bugs with the author in case you do end up using them.
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.23.tar.gz
(21.2 kB
view hashes)
Built Distribution
cdxbasics-0.0.23-py3-none-any.whl
(23.4 kB
view hashes)
Close
Hashes for cdxbasics-0.0.23-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aa8df39de37e0dea83f4b3b796d959e7c674f334ebd7149e0df1e5267c334a1 |
|
MD5 | b95d2eb2872d10f082953bbd1dfa0ca4 |
|
BLAKE2b-256 | 08f67be05ae3cedc83a568ba9a9a6b72fb2a5d188011fd929df2efb41e405390 |