Package mvpa :: Package misc :: Module attributes :: Class AttributeWithUnique

[hide private]
[frames] | no frames]

# Class AttributeWithUnique

source code

Container which also takes care about recomputing unique values

XXX may be we could better link original attribute to additional attribute which actually stores the values (and do reverse there as well).

Pros:
  - don't need to mess with getattr since it would become just another attribute
Cons:
  - might be worse design in terms of comprehension
  - take care about _set, since we shouldn't allow change it externally

For now lets do it within a single class and tune up getattr

Instance Methods | [hide private]

__init__(self, name=None, hasunique=True, doc="Attribute with unique") x.__init__(...) initializes x; see help(type(x)) for signature | source code

reset(self) Simply reset the flag | source code

_resetUnique(self) | source code

_set(self, *args, **kwargs) | source code

_getUniqueValues(self) | source code

Inherited from `CollectableAttribute`: `__str__`, `isSet`, `name` Inherited from `CollectableAttribute` (private): `_get`, `_getName`, `_getVirtual`, `_setName`, `_setVirtual` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Variables | [hide private]

| uniqueValues = `property(fget= _getUniqueValues)`
| hasunique = `property(fget= lambda self: self._hasunique)`
Inherited from `CollectableAttribute`: `value` Inherited from `CollectableAttribute` (private): `_instance_index`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, name=None, hasunique=True, doc="Attribute with unique")
(Constructor)

source code

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

Overrides: object.__init__
  (inherited documentation)

### reset(self)

source code

Simply reset the flag

Overrides: CollectableAttribute.reset
  (inherited documentation)

### _set(self, *args, **kwargs)

source code

Overrides: CollectableAttribute._set