Package couchdbkit :: Package schema :: Module properties :: Class LazyDict
[hide private]
[frames] | no frames]

Class LazyDict

source code

object --+    
         |    
      dict --+
             |
            LazyDict

object to make sure we keep updated of dict in _doc. We just override a dict and maintain change in doc reference (doc[keyt] obviously).

if init_vals is specified, doc is overwritten with the dict given. Otherwise, the values already in doc are used.

Instance Methods [hide private]
new empty dictionary

__init__(self, doc, item_type=None, init_vals=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_wrap(self) source code
 
__setitem__(self, key, value)
x[i]=y
source code
 
__delitem__(self, key)
del x[y]
source code
v, remove specified key and return the corresponding value
pop(self, key, *args)
If key is not found, d is returned if given, otherwise KeyError is raised
source code
D.get(k,d), also set D[k]=d if k not in D
setdefault(self, key, default) source code
None
update(self, value)
Update D from dict/iterable E and F.
source code
(k, v), remove and return some (key, value) pair as a
popitem(self, value)
2-tuple; but raise KeyError if D is empty.
source code
None
clear(self)
Remove all items from D.
source code

Inherited from dict: __cmp__, __contains__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __sizeof__, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, doc, item_type=None, init_vals=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns:
new empty dictionary

Overrides: object.__init__
(inherited documentation)

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

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

__delitem__(self, key)
(Index deletion operator)

source code 

del x[y]

Overrides: dict.__delitem__
(inherited documentation)

pop(self, key, *args)

source code 

If key is not found, d is returned if given, otherwise KeyError is raised

Returns: v, remove specified key and return the corresponding value
Overrides: dict.pop
(inherited documentation)

setdefault(self, key, default)

source code 
Returns: D.get(k,d), also set D[k]=d if k not in D
Overrides: dict.setdefault
(inherited documentation)

update(self, value)

source code 

Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

Returns: None
Overrides: dict.update
(inherited documentation)

popitem(self, value)

source code 

2-tuple; but raise KeyError if D is empty.

Returns: (k, v), remove and return some (key, value) pair as a
Overrides: dict.popitem
(inherited documentation)

clear(self)

source code 

Remove all items from D.

Returns: None
Overrides: dict.clear
(inherited documentation)