Package grassyknoll :: Package lib :: Module Norman :: Class ObjectNorman
[hide private]

Class ObjectNorman

source code


Norman that operates on dict or object.__dict__

Attach further Normans as attributes. These will be called on the corresponding input value/attr.

See module docstring for an example.


Warning: instances of this class do some caching on the first __call__. You should not modify attributes after using it to process input data.

Instance Methods [hide private]
 
__init__(self, unknown='error', optional=False, filled=False, prohibited=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__setupCaches(self) source code
 
byKey(self, d, unknown=None) source code
 
byAttr(self, obj, unknown=None) source code
 
__call__(self, obj=None, unknown=None, **kwargs) source code

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

Instance Variables [hide private]
  __unknown
how unknown keys should be handled.

Inherited from Norman: filled, optional, prohibited

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, unknown='error', optional=False, filled=False, prohibited=False)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: Norman.__init__

__call__(self, obj=None, unknown=None, **kwargs)
(Call operator)

source code 
Overrides: Norman.__call__

Instance Variable Details [hide private]

__unknown

how unknown keys should be handled. One of 'ignore', 'delete', 'error'. May also be single-argument callable (perhaps another Norman), which is passed the value.