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__ inherited

Metaclass for properties.

Attributes

KEY

Subclasses can override this attribute so that PropertyBase.from_key() knows that it can call their _from_key() method for that key.

Properties

val

Value “payload” of the property.

key inherited

Key of the instance.

Methods

__copy__()

__getattr__()

Be as transparent as possible, so that this sort of call would work: self.__prop.__and__(self).

__rand__()

from_key()

Alternative constructor that is available with the same signature for all properties.

with_wrapped()

Build a new instance with modified wrapped property.

HASH_COERCE() inherited

Used to coerce the values of self.__dict__ to hashable values.

__and__() inherited

Combine two instances of the same property together.

find_cls() inherited

Find 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.__copy__()[source]#
PropertyWrapper.__getattr__(attr)[source]#

Be as transparent as possible, so that this sort of call would work: self.__prop.__and__(self)

PropertyWrapper.__rand__(other)[source]#
classmethod PropertyWrapper.from_key(key, val, **kwargs)[source]#

Alternative constructor that is available with the same signature for all properties.

Parameters:
  • key (str) – Key passed by the user. It will be checked with _check_key() before building an instance.

  • val (object) – Value passed by the user.

PropertyWrapper.with_wrapped(wrapped)[source]#

Build a new instance with modified wrapped property.

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.