touketsu.core.class_decorator_factory

touketsu.core.class_decorator_factory(dectype=None, docmod=None)

touketsu class decorator factory.

The returned decorator is able to automatically modify the docstrings of the wrapped class, provided they follow the docstring format specified in PEP 257.

Note

It is possible to tell which classes have been wrapped a decorator returned by class_decorator_factory() because the decoration process introduces additional class attributes prepended by _touketsu. Using urt_class() on any of these decorated classes undos the decoration and returns the class to its original definition.

Parameters
  • dectype (str) – The decorator type. Pass "immutable" to return a class decorator that makes a class instance immutable or "nondynamic" to make a class instance nondynamic.

  • docmod (str, optional) – How to modify the docstring of the class the returned decorator is applied to. Either "brief", or "identity". The default value is "brief".

Returns

A class decorator that either makes disables dynamic attribute creation for class instances or makes class instances immutable.

Type

function