decorators

Full name: ase2sprkkr.bindings.xband.tests.decorators

Module class hierarchy

Inheritance diagram of ase2sprkkr.bindings.xband.tests.decorators.cached_class_property, ase2sprkkr.bindings.xband.tests.decorators.cached_property, ase2sprkkr.bindings.xband.tests.decorators.class_property, ase2sprkkr.bindings.xband.tests.decorators.maybeclassmethod

Description

Various decorators, mainly for class methods

Module Attributes

std_cached_property

Functools.cached_property decorator - the value is computed only once and then stored as an (same-name) instance attribute.

Functions

add_called_class_as_argument(decorator)

If a decorator is used on a method, the information about the defining class is lost.

add_to_signature(func[, prepend, excluding, ...])

Add the arguments in the func function to the list of arguments of the resulting function (as keyword_only arguments) The modified function has to have its arguments defined as in the following example:

warnings_from_here([stacklevel])

Classes

cached_class_property([method])

Decorator that converts a method with a single cls argument into a property that can be accessed directly from the class.

cached_property(func[, fset, fdel])

Cached property, that allows setter and deleter

class_property([method])

Decorator that converts a method with a single cls argument into a property that can be accessed directly from the class.

maybeclassmethod(method)

This decorator creates a method, that can behawes both as classmethod and normal method - it provides both self and cls, when self can be None