pwtools.common.dict2class

pwtools.common.dict2class(dct, name='Dummy')[source]

Convert a dict to a class.

Examples

>>> dct={'a':1, 'b':2}
>>> dct2class(dct, 'Foo')
<Foo instance at 0x3615ab8>
>>> dct2class(dct, 'Bar')
<Bar instance at 0x3615b48>
>>> dct2class(dct, 'Bar').__dict__
{'a':1, 'b':2}