Package elisa :: Package plugins :: Package bad :: Package poblenou_frontend :: Module list_cache :: Class CacheList
[hide private]
[frames] | no frames]

Class CacheList

source code



A proxy list which purpose is to delay creation of its elements. In order
to achieve that the items inserted are callable that return the actual
elements. At any time a given number of elements are really instantiated
(cached).
Their choice is driven by this number and the L{current_index} in the list.
They are chosen so that the item at L{current_index} and those around it
are instantiated.

Example: for 3 cached elements in a list of 10 with current_index = 4, the
         instantiated elements are the 3rd, 4th and 5th (3, 4, 5).

@ivar current_index: index of the item currently selected
@type current_index: int



Instance Methods [hide private]
 
__init__(self, cached, real_list)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_in_real_list(self, key) source code
 
insert(self, position, element)
insert object before index
source code
 
_update_real_index(self) source code
 
pop(self, position=-1)
remove and return item at index (default last)
source code
 
append(self, element)
append object to end
source code
 
extend(self, elements)
extend list by appending elements from the iterable
source code
 
remove(self, element)
remove first occurrence of value
source code
 
reverse(self)
reverse *IN PLACE*
source code
 
sort(self, key='frontend')
stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
source code
 
__iadd__(self, elements)
x+=y
source code
 
__imul__(self, mult)
x*=y
source code
 
current_index__set(self, index) source code
 
current_index__get(self) source code

Inherited from list: __add__, __contains__, __delitem__, __delslice__, __eq__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, count, index

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

Properties [hide private]
  current_index

Inherited from object: __class__

Method Details [hide private]

__init__(self, cached, real_list)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Parameters:
  • cached (int) - number of cached elements; must be odd
  • real_list (list) - list to progressively fill; must be empty
Returns:
new list

Overrides: list.__init__

insert(self, position, element)

source code 
insert object before index
Overrides: list.insert
(inherited documentation)

pop(self, position=-1)

source code 
remove and return item at index (default last)
Returns:
item

Overrides: list.pop
(inherited documentation)

append(self, element)

source code 
append object to end
Overrides: list.append
(inherited documentation)

extend(self, elements)

source code 
extend list by appending elements from the iterable
Overrides: list.extend
(inherited documentation)

remove(self, element)

source code 
remove first occurrence of value
Overrides: list.remove
(inherited documentation)

reverse(self)

source code 
reverse *IN PLACE*
Overrides: list.reverse
(inherited documentation)

sort(self, key='frontend')

source code 
stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
Overrides: list.sort
(inherited documentation)

__iadd__(self, elements)

source code 
x+=y
Overrides: list.__iadd__
(inherited documentation)

__imul__(self, mult)

source code 
x*=y
Overrides: list.__imul__
(inherited documentation)

Property Details [hide private]

current_index

Get Method:
elisa.plugins.bad.poblenou_frontend.list_cache.CacheList.current_index__get(self)
Set Method:
elisa.plugins.bad.poblenou_frontend.list_cache.CacheList.current_index__set(self, index)
Delete Method:
'frontend'