Package mvpa :: Package misc :: Package io :: Module hamster :: Class Hamster
[hide private]
[frames] | no frames]

Class Hamster

source code


Simple container class which is derived from the dictionary

It is capable of storing itself in a file, or loading from a file (using cPickle + zlib tandem). Any serializable object can be bound to a hamster to be stored.

To undig burried hamster use Hamster(filename). Here is an example:

>>> h = Hamster(bla='blai')
>>> h.boo = N.arange(5)
>>> h.dump(filename)
...
>>> h = Hamster(filename)
Instance Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kwargs) source code
new empty dictionary

__init__(self, *args, **kwargs)
Initialize Hamster.
source code
 
dump(self, filename)
Bury the hamster into the file
source code
 
__setattr__(self, index, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getattribute__(self, index)
x.__getattribute__('name') <==> x.name
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __repr__, __setitem__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

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

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__new__(cls, *args, **kwargs)

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

__init__(self, *args, **kwargs)
(Constructor)

source code 

Initialize Hamster.

Providing a single parameter string would treat it as a filename from which to undig the data. Otherwise all the parameters are equivalent to the ones of dict

Returns:
new empty dictionary

Overrides: object.__init__

__setattr__(self, index, value)

source code 
x.__setattr__('name', value) <==> x.name = value
Overrides: object.__setattr__
(inherited documentation)

__getattribute__(self, index)

source code 
x.__getattribute__('name') <==> x.name
Overrides: object.__getattribute__
(inherited documentation)