pygritia.attr module

Provides AttrMixin mixin class It provides attribute accessor support to the Lazy class

class pygritia.attr.Attr(target: pygritia.core.LazyMixin, attr: str)[source]

Bases: pygritia.core.LazyAction

Attr accessor

attr
evaluate(namespace: Mapping[Union[str, LazyMixin], Any]) → Any[source]

Evaluate expression

To substitute actual value for specific symbol, give value with keyword argument.

target
update(val: Any, namespace: Mapping[Union[str, LazyMixin], Any]) → None[source]

Update value of expression

If the expression is readonly, it raises AttributeError

class pygritia.attr.AttrMixin(action: pygritia.core.LazyAction, origin: Optional[LazyMixin] = None)[source]

Bases: pygritia.core.LazyMixin

Attribute access support

Substitution to lazy expression is not supported

NOTICE: Dunder magic methods are not lazily evaluated and applied to expression object.

pygritia.attr.getattr_

Return getattr(self, name).