pytilities.delegation.delegationaspect

class pytilities.delegation.delegationaspect.DelegationAspect(*args, **kwargs)

Aspect that delegates calls from the aspected to a target object

The effect of this is that: source_instance.attr actually returns target_instance.attr, same goes for set, and del calls.

The object could be a class, or an instance.

_DelegationAspect__del_advice()
_DelegationAspect__get_advice()
_DelegationAspect__get_target(obj)
_DelegationAspect__init_attributes(target, attributes)

Create a DelegationAspect.

Parameters:
  • attributes (iter(str, ...)) – Names of attribute to delegate. Use ‘*’ for all.
  • target – Descriptor of instance to delegate to. It is passed the

source instance on __get__. :type target: descriptor

_DelegationAspect__init_profile(target, profile)

Create a DelegationAspect.

Parameters:
  • profile (Profile) – attribute profile of what attributes to delegate
  • target – Descriptor of instance to delegate to. It is passed the

source instance on __get__. :type target: descriptor

_DelegationAspect__set_advice()
__init__(*args, **kwargs)

Create a DelegationAspect.

Overloaded:
  • __init_attributes
  • __init_profile

Previous topic

pytilities.delegation

Next topic

pytilities.delegation.profile

This Page