Package pytilities :: Package delegation :: Module delegator :: Class Delegator
[hide private]
[frames] | no frames]

Class Delegator

source code

                             object --+    
                                      |    
attributecollection.AttributeCollection --+
                                          |
                                         Delegator


An AttributeCollection that delegates attributes of one object to another.

Instance properties:

    - `target`: Write-only, target of delegation
    - `profile`: Read-write, profile to use for delegation

Instance Methods [hide private]
 
__init__(self, profile=None, target=None)
Constructs a delegator.
source code
 
__set_target_args(self, args) source code
 
__set_target_object(self, target_object) source code
 
getattr_(self, name)
Try to get the value of an attribute
source code
 
setattr_(self, name, value)
Try to set the value of an attribute
source code
 
delattr_(self, name)
Try to delete an attribute
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  target
Write-only, target for delegation.
  profile
Read-write, the profile to use for attribute mappings.

Inherited from object: __class__

Method Details [hide private]

__init__(self, profile=None, target=None)
(Constructor)

source code 

Constructs a delegator.

Parameters:
    `profile` :: Profile = None
        delegation profile. If None, an empty profile is created for
        you.

    `target` = None
        target of delegation

Overrides: object.__init__

getattr_(self, name)

source code 

Try to get the value of an attribute

Parameters:

    `name` :: string
        name of the attribute to get

Returns whether the attribute was found, and if so, its value
:: (found_attribute::bool, value)

Overrides: attributecollection.AttributeCollection.getattr_
(inherited documentation)

setattr_(self, name, value)

source code 

Try to set the value of an attribute

Parameters:

    `name` :: string
        name of the attribute to set

    `value`
        the new value
            
Returns True, if the attribute was found, False otherwise

Overrides: attributecollection.AttributeCollection.setattr_
(inherited documentation)

delattr_(self, name)

source code 

Try to delete an attribute

Parameters:

    `name` :: string
        name of the attribute to delete

Returns True, if the attribute was found, False otherwise

Overrides: attributecollection.AttributeCollection.delattr_
(inherited documentation)

Property Details [hide private]

target


Write-only, target for delegation.

Delegated attributes will be delegated to this object.

Overloaded, setter parameters:

:a:
    `target_object`
        the object to delegate to
:b:
    `args` :: (object, variable_name::string)
        target object will be resolved on every get/set/del by doing
        getattr(object, variable_name)

Get Method:
unreachable.target(self) - Write-only, target for delegation.
Set Method:
unreachable.__overloaded(*args, **kwargs)

profile


Read-write, the profile to use for attribute mappings.

Returns ::Profile

Setter parameters:

    `value` :: Profile
        the profile

Get Method:
unreachable.profile(self) - Read-write, the profile to use for attribute mappings.
Set Method:
unreachable.profile(self, value)