Package mvpa :: Package misc :: Module state :: Class Collection
[hide private]
[frames] | no frames]

Class Collection

source code


Container of some CollectableAttributes.
Instance Methods [hide private]
 
__init__(self, items=None, owner=None)
Initialize the Collection
source code
 
__str__(self)
str(x)
source code
 
isKnown(self, index)
Returns True if state index is known at all
source code
 
isSet(self, index)
Returns True if state index has value set
source code
 
_checkIndex(self, index)
Verify that given index is a known/registered state.
source code
 
add(self, item)
Add a new CollectableAttribute to the collection
source code
 
remove(self, index)
Remove item from the collection
source code
 
__getattribute__(self, index)
x.__getattribute__('name') <==> x.name
source code
 
__setattr__(self, index, value)
x.__setattr__('name', value) <==> x.name = value
source code
 
__getitem__(self, index) source code
 
getvalue(self, index)
Returns the value by index
source code
 
setvalue(self, index, value)
Sets the value by index
source code
 
_action(self, index, func, missingok=False, **kwargs)
Run specific func either on a single item or on all of them
source code
 
reset(self, index=None)
Reset the state variable defined by index
source code
 
_getListing(self)
Return a list of registered states along with the documentation
source code
 
_getNames(self)
Return ids for all registered state variables
source code
 
_getOwner(self) source code
 
_setOwner(self, owner) source code
 
_updateOwner(self, index=None, register=True)
Define an entry within owner's __dict__ so ipython could easily complete it
source code

Inherited from object: __delattr__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__

Class Variables [hide private]
  listing = VProperty(fget= _getListing)
Instance Variables [hide private]
  _items
Dictionary to contain registered states as keys and values signal either they are enabled
Properties [hide private]
  names
Return ids for all registered state variables
  items
  owner

Inherited from object: __class__

Method Details [hide private]

__init__(self, items=None, owner=None)
(Constructor)

source code 
Initialize the Collection
Parameters:
  • items (dict of CollectableAttribute's) - items to initialize with
  • enable_states (list) - list of states to enable. If it contains 'all' (in any casing), then all states (besides the ones in disable_states) will be enabled
  • disable_states (list) - list of states to disable
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 
str(x)
Overrides: object.__str__
(inherited documentation)

_checkIndex(self, index)

source code 
Verify that given index is a known/registered state.
Raises:
  • KeyError - if given index is not known

add(self, item)

source code 

Add a new CollectableAttribute to the collection

TODO: we should make it stricter to don't add smth of

wrong type into Collection since it might lead to problems

Also we might convert to __setitem__

Parameters:
  • item (CollectableAttribute) - or of derived class. Must have 'name' assigned

__getattribute__(self, index)

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

__setattr__(self, index, value)

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

_action(self, index, func, missingok=False, **kwargs)

source code 
Run specific func either on a single item or on all of them
Parameters:
  • index (basestr) - Name of the state variable
  • func - Function (not bound) to call given an item, and **kwargs
  • missingok (bool) - If True - do not complain about wrong index

_updateOwner(self, index=None, register=True)

source code 

Define an entry within owner's __dict__ so ipython could easily complete it

XXX Needs refactoring since we duplicate the logic of expansion of index value

Parameters:
  • index (basestring or list of basestring) - Name of the attribute. If None -- all known get registered
  • register (bool) - Register if True or unregister if False

Property Details [hide private]

names

Return ids for all registered state variables
Get Method:
_getNames(self) - Return ids for all registered state variables

items

Get Method:
unreachable(x)

owner

Get Method:
_getOwner(self)
Set Method:
_setOwner(self, owner)