Package qanda :: Module validators :: Class Synonyms
[hide private]
[frames] | no frames]

Class Synonyms

source code

   object --+    
            |    
BaseValidator --+
                |
               Synonyms

Map values to other values.

Note that this does not explicitly throw errors. If a value is un-mapped, it is simply returned.

Instance Methods [hide private]
 
__init__(self, d)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
convert(self, value)
Transform this value to the desired form.
source code

Inherited from BaseValidator: __call__, validate

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, d)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Parameters:
  • d - a dictionary mapping input values to output values
Overrides: object.__init__

convert(self, value)

source code 

Transform this value to the desired form.

Can throw if conversion fails. Override in subclass if required.

Parameters:
  • value - value to be transformed
Returns:
the transformed value
Overrides: BaseValidator.convert
(inherited documentation)