pytilities.delegation.profile.Profile

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
> self | b::Profile
>   union of this profile and the other
> self &= b::Profile
>   intersection of this profile and the other
> self & b::Profile
>   intersection of this profile and the other
> self - b::Profile
>   difference of this profile and the other
> self -= b::Profile
>   difference of this profile and the other
> self ^ b::Profile
>   symetric difference of this profile and the other
> self ^= b::Profile
>   symetric difference 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
__are_conflict_free(self, other) Returns True if mappings of self don't conflict with those of other | source code
__or__(self, other) See __ior__ | source code
__ior__(self, other) union of this profile and the other | source code
__and__(self, other) | source code
__iand__(self, other) intersection of this profile and the other | source code
__sub__(self, other) | source code
__isub__(self, other) difference of this profile and the other | source code
__xor__(self, other) | source code
__ixor__(self, other) symetric difference 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
copy(self) | 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 Preconditions: 1. The mappings of the two profiles musn't conflict. Two profiles conflict when they have at least one mapping with the same source name, but a different target name.

### __iand__(self, other) | source code
intersection of this profile and the other Parameters: `other` :: Profile the other profile Preconditions: 1. The mappings of the two profiles musn't conflict. Two profiles conflict when they have at least one mapping with the same source name, but a different target name.

### __isub__(self, other) | source code
difference of this profile and the other Parameters: `other` :: Profile the other profile

### __ixor__(self, other) | source code
symetric difference 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.