<s> import collections <EOL> import pbItem <EOL> class pbRoot ( collections . MutableMapping ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> self . store = dict ( ) <EOL> self . key_storage = set ( ) <EOL> self . update ( dict ( * args , ** kwargs ) ) <EOL> def __internalKeyCheck ( self , key ) : <EOL> safe_key = key <EOL> if type ( safe_key ) == str : <EOL> safe_key = pbItem . pbItemResolver ( safe_key , '<STR_LIT>' ) <EOL> return safe_key <EOL> def __getitem__ ( self , key ) : <EOL> return self . store [ key ] <EOL> def __setitem__ ( self , key , value ) : <EOL> if key not in self . key_storage : <EOL> self . key_storage . add ( self . __internalKeyCheck ( key ) ) <EOL> self . store [ key ] = value <EOL> def __delitem__ ( self , key ) : <EOL> if key in self . key_storage : <EOL> self . key_storage . remove ( key ) <EOL> del self . store [ key ] <EOL> def __iter__ ( self ) : <EOL> return self . key_storage . __iter__ ( ) <EOL> def __len__ ( self ) : <EOL> return self . key_storage . __len__ ( ) <EOL> def __str__ ( self ) : <EOL> return self . store . __str__ ( ) <EOL> def __contains__ ( self , item ) : <EOL> return item in self . key_storage <EOL> def __getattr__ ( self , attrib ) : <EOL> return getattr ( self . store , attrib ) <EOL> def __keytransform__ ( self , key ) : <EOL> if isinstance ( key , pbItem . pbItem ) : <EOL> return key . value <EOL> else : <EOL> return key </s>
