Convenience tools for working with Python classes.
Simplified subclassing:
fromclassicalimportargumented_subclassclassMyClass:
def__init__(self, *args, **kwargs):
pass# do whatever# subclass with presetsMySubClass=argumented_subclass(MyClass, 'MySubClass', arg1='value', arg2=4)Various descriptors:
fromclassicalimportArgumentedSubclass, AutoPropertyclassThing:
Red=ArgumentedSubclass(color='red')
book=AutoProperty(has='pages')
def__init__(self, color: str=None, has: str=None):
self.color=colorself.has=hasThing.Red# is a subclass of Thing and is 'red'Thing.Red.book# is an instance of Thing (and Thing.Red), is 'red' and has 'pages'See the full documentation at http://classical.readthedocs.io/en/latest/
pip install classicalmake testYou may need to install [fielded,testing] extras to run tests
make docsYou may need to install [fielded,docs] extras to generate docs