Package svnmailer :: Module typedstruct :: Class MemberDescriptor
[hide private]

Class MemberDescriptor

source code

object --+
         |
        MemberDescriptor
Known Subclasses:

Base class for members descriptors

Instance Methods [hide private]
 
__init__(self, name, private, param=None)
Initialization
source code
 
__get__(self, instance, owner)
Gets the member value
source code
 
__set__(self, instance, value)
Sets the members value
source code
 
__delete__(self, instance)
Raises an AttributeError
source code
 
premap(self, value, mapper, arg)
Premapper - passes through by default
source code
any
transform(self, value, arg)
Transformer - passes through by default
source code
any
substitute(self, value, subst, arg)
Substituter - passes through by default
source code
 
postmap(self, value, mapper, arg)
Postmapper - passes through by default
source code

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

Instance Variables [hide private]
StructPrivate __private
The reference to the private container
str name
The name of the member
any param
The descriptor parameter
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, private, param=None)
(Constructor)

source code 

Initialization

Overrides: object.__init__

premap(self, value, mapper, arg)

source code 

Premapper - passes through by default

The premapper is called if the value is set before doing anything else.

Parameters:
  • value (any) - The value to premap
  • mapper (any) - The mapping argument
  • arg (any) - The argument used for struct initialization

Note: It is not called if no mapper function is defined (or it is None).

transform(self, value, arg)

source code 

Transformer - passes through by default

Override this method in order to do any value transformation, e.g. compile the input string as regex or split it into a list.

The transform method is called with the value returned from the premap method. The result is stored as final member value.

Parameters:
  • value (any) - The value to tranform
  • arg (any) - The argument used for struct initialization
Returns: any
The transformed value

substitute(self, value, subst, arg)

source code 

Substituter - passes through by default

Use this method to do any dynamic processing on the retrieved value before it's being postmapped.

Parameters:
  • value (any) - The value to substitute
  • subst (dict) - The substitution dictionary
  • arg (any) - The argument used for struct initialization
Returns: any
The substituted value

postmap(self, value, mapper, arg)

source code 

Postmapper - passes through by default

The postmapper is called before the value is finally returned to the caller (after being substituted).

Parameters:
  • value (any) - The value to postmap
  • mapper (any) - The mapping argument
  • arg (any) - The argument used for struct initialization

Note: The postmapper is not called if no mapper function is defined (or it is None).