Package ndg :: Package xacml :: Package utils :: Class VettedDict
[hide private]

Class VettedDict

source code

UserDict.DictMixin --+
                     |
                    VettedDict
Known Subclasses:

Enforce custom checking on keys and items before addition to a dictionary

Instance Methods [hide private]
 
__init__(self, *args)
Initialise setting the allowed type or types for keys and items
source code
 
_verifyKeyValPair(self, key, val)
Check given key value pair and return False if they should be filtered out.
source code
 
__setitem__(self, key, val)
Enforce type checking when setting new items
source code
any
__getitem__(self, key)
Provide implementation for getting items
source code
 
get(self, key, *arg)
Provide implementation of get item with default
source code
 
__repr__(self) source code
 
keys(self) source code
 
items(self) source code
 
values(self) source code
 
__contains__(self, val) source code

Inherited from UserDict.DictMixin: __cmp__, __iter__, __len__, clear, has_key, iteritems, iterkeys, itervalues, pop, popitem, setdefault, update

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 

Initialise setting the allowed type or types for keys and items

Parameters:
  • args (tuple) - two arguments: the first is a callable which filters for permissable keys in this dict, the second sets the type or list of types permissable for items in this dict

_verifyKeyValPair(self, key, val)

source code 

Check given key value pair and return False if they should be filtered out. Filter functions may also raise an exception if they wish to abort completely

Parameters:
  • key (basestring) - dict key to check
  • val (any) - value to check

__setitem__(self, key, val)
(Index assignment operator)

source code 

Enforce type checking when setting new items

Parameters:
  • key (any) - key for item to set
  • val (any) - value to set for this key

__getitem__(self, key)
(Indexing operator)

source code 

Provide implementation for getting items

Parameters:
  • key (any) - key for item to retrieve
Returns: any
value for input key

get(self, key, *arg)

source code 

Provide implementation of get item with default

Parameters:
  • key (any) - key for item to retrieve
  • arg (tuple) - use to set a default argument
Overrides: UserDict.DictMixin.get

__repr__(self)
(Representation operator)

source code 
Overrides: UserDict.DictMixin.__repr__

items(self)

source code 
Overrides: UserDict.DictMixin.items

values(self)

source code 
Overrides: UserDict.DictMixin.values

__contains__(self, val)
(In operator)

source code 
Overrides: UserDict.DictMixin.__contains__