lisa.wlgen.rta.PropertyWrapper#
- class lisa.wlgen.rta.PropertyWrapper(prop)[source]#
Bases:
ContaminatingProperty
Base class for properties that are merely wrapper around another property instance.
It is advised that subclasses use name mangling for attributes (name starting with
__
), so that the wrapper’s attribute will not conflict with the attributes of the wrapped property, so that the wrapper is as transparent as possible.Classes
__class__
inheritedMetaclass for properties.
Attributes
Subclasses can override this attribute so that
PropertyBase.from_key()
knows that it can call their_from_key()
method for that key.Properties
Methods
Be as transparent as possible, so that this sort of call would work:
self.__prop.__and__(self)
.Alternative constructor that is available with the same signature for all properties.
Build a new instance with modified wrapped property.
HASH_COERCE()
inheritedUsed to coerce the values of
self.__dict__
to hashable values.__and__()
inheritedCombine two instances of the same property together.
find_cls()
inheritedFind which subclass can handle
key
.
Classes#
- PropertyWrapper.__class__#
alias of
PropertyMeta
Attributes#
- PropertyWrapper.KEY = None#
Subclasses can override this attribute so that
PropertyBase.from_key()
knows that it can call their_from_key()
method for that key.Note
This class attribute will not be inherited automatically so that each class can be uniquely identified by its key. Subclass that do not override the value explicitly will get
None
.
Properties#
- property PropertyWrapper.val[source]#
Value “payload” of the property.
Ideally, it should be a valid value that can be given to
from_key()
, but it’s not mandatory. For complex properties that are not isomorphic to a Python basic type (int, tuple etc.),self
should be returned.
- property PropertyWrapper.key#
Inherited property, see
lisa.wlgen.rta.PropertyBase.key
Key of the instance.
Methods#
- PropertyWrapper.__getattr__(attr)[source]#
Be as transparent as possible, so that this sort of call would work:
self.__prop.__and__(self)
- classmethod PropertyWrapper.from_key(key, val, **kwargs)[source]#
Alternative constructor that is available with the same signature for all properties.
- PropertyWrapper.HASH_COERCE(x, coerce)#
Inherited method, see
lisa.utils.SimpleHash.HASH_COERCE()
Used to coerce the values of
self.__dict__
to hashable values.
- abstract PropertyWrapper.__and__(other)#
Inherited method, see
lisa.wlgen.rta.PropertyBase.__and__()
Combine two instances of the same property together.
- classmethod PropertyWrapper.find_cls(key)#
Inherited method, see
lisa.wlgen.rta.PropertyBase.find_cls()
Find which subclass can handle
key
.