Package pytilities :: Package delegation :: Module profile :: Class Profile
[hide private]
[frames] | no frames]

Class Profile

source code

object --+
         |
        Profile


States what attributes to delegate, and to which target attributes.

Instance methods:
    
    - `has_readable`: Check for read-access mapping of attribute
    - `has_writable`: Check for read-access mapping of attribute
    - `has_deletable`: Check for read-access mapping of attribute
    - `get_readable`: Get read-access mapping for attribute
    - `get_writable`: Get read-access mapping for attribute
    - `get_deletable`: Get read-access mapping for attribute
    - `remove_mappings`: Remove attribute mappings
    - `add_mappings`: Add attribute mappings

Operators:

    self |= b::Profile
        union of this profile and the other

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
has_readable(self, attribute)
Check for read-access mapping of attribute
source code
 
has_writable(self, attribute)
Check for write-access mapping of attribute
source code
 
has_deletable(self, attribute)
Check for delete-access mapping of attribute
source code
 
get_readable(self, attribute)
Get the mapped value of a readable attribute
source code
 
get_writable(self, attribute)
Get the mapped value of a writable attribute
source code
 
get_deletable(self, attribute)
Get the mapped value of a deletable attribute
source code
 
__ior__(self, other)
union of this profile and the other
source code
 
remove_mappings(self, modifiers, *names)
Remove attribute mappings
source code
 
add_mappings(self, modifiers, *names, **mapped_names)
Map source to target attribute names, for delegation.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

has_readable(self, attribute)

source code 

Check for read-access mapping of attribute

Returns True if the mapping exists

has_writable(self, attribute)

source code 

Check for write-access mapping of attribute

Returns True if the mapping exists

has_deletable(self, attribute)

source code 

Check for delete-access mapping of attribute

Returns True if the mapping exists

get_readable(self, attribute)

source code 

Get the mapped value of a readable attribute

Returns ::string

get_writable(self, attribute)

source code 

Get the mapped value of a writable attribute

Returns ::string

get_deletable(self, attribute)

source code 

Get the mapped value of a deletable attribute

Returns ::string

__ior__(self, other)

source code 

union of this profile and the other

Parameters:

    - `other` :: Profile
        the other profile

remove_mappings(self, modifiers, *names)

source code 

Remove attribute mappings

Parameters:

    `modifiers` :: string
        the types of delegation access to the target to remove. Valid 
        modifiers are combinations of:
            
            - `r`: read
            - `w`: write
            - `d`: delete

    `names` :: (source_name::string...)
        names of source_name parts of, the mappings to remove

add_mappings(self, modifiers, *names, **mapped_names)

source code 

Map source to target attribute names, for delegation.

Parameters:

    `modifiers` :: string
        the types of delegation access to the target. Valid modifiers
        are combinations of:
            
            - `r`: read
            - `w`: write
            - `d`: delete

    `names` :: (source_name::string...)
        names of the attribute names to delegate. The target attribute
        name is the same as `source_name`. This is the same as adding a
        {source_name : source_name} mapping, using the mapped_names
        argument.

    `mapped_names` :: {source_name::string : target_name::string ...}
        names of source and target attributes to map and delegate.

        `target_name`s will be mangled if they have a __ prefix.
        Mangling will occur every time it is delegated to, so you can
        change the target object any time.