class ViewList(object): (source)
Known subclasses: docutils.statemachine.StringList
List with extended functionality: slices of ViewList objects are child lists, linked to their parents. Changes made to a child list also affect the parent list. A child list is effectively a "view" (in the SQL sense) of the parent list. Changes to parent lists, however, do not affect active child lists. If a parent list is changed, any active child lists should be recreated.
The start and end of the slice can be trimmed using the trim_start()
and
trim_end()
methods, without affecting the parent list. The link between
child and parent lists can be broken by calling disconnect()
on the
child list.
Also, ViewList objects keep track of the source & offset of each item.
This information is accessible via the source()
, offset()
, and
info()
methods.
Method | __add__ |
Undocumented |
Method | __cmp__ |
Undocumented |
Method | __contains__ |
Undocumented |
Method | __delitem__ |
Undocumented |
Method | __eq__ |
Undocumented |
Method | __ge__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __gt__ |
Undocumented |
Method | __iadd__ |
Undocumented |
Method | __imul__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __le__ |
Undocumented |
Method | __len__ |
Undocumented |
Method | __lt__ |
Undocumented |
Method | __mul__ |
Undocumented |
Method | __ne__ |
Undocumented |
Method | __radd__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | append |
Undocumented |
Method | count |
Undocumented |
Method | disconnect |
Break link between this list and parent list. |
Method | extend |
Undocumented |
Method | index |
Undocumented |
Method | info |
Return source & offset for index i . |
Method | insert |
Undocumented |
Method | offset |
Return offset for index i . |
Method | pop |
Undocumented |
Method | pprint |
Print the list in grep format (source:offset:value lines) |
Method | remove |
Undocumented |
Method | reverse |
Undocumented |
Method | sort |
Undocumented |
Method | source |
Return source for index i . |
Method | trim_end |
Remove items from the end of the list, without touching the parent. |
Method | trim_start |
Remove items from the start of the list, without touching the parent. |
Method | xitems |
Return iterator yielding (source, offset, value) tuples. |
Instance Variable | data |
The actual list of data, flattened from various sources. |
Instance Variable | items |
A list of (source, offset) pairs, same length as self.data : the source of each line and the offset of each line from the beginning of its source. |
Instance Variable | parent |
The parent list. |
Instance Variable | parent_offset |
Offset of this list from the beginning of the parent list. |
Method | __cast |
Undocumented |
Undocumented
self.data
: the
source of each line and the offset of each line from the beginning of
its source.