class documentation

class ViewList(object):

Known subclasses: docutils.statemachine.StringList

View In Hierarchy

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
def __add__(self, other):

Undocumented

def __cmp__(self, other):

Undocumented

def __contains__(self, item):

Undocumented

def __delitem__(self, i):

Undocumented

def __eq__(self, other):

Undocumented

def __ge__(self, other):

Undocumented

def __getitem__(self, i):

Undocumented

def __gt__(self, other):

Undocumented

def __iadd__(self, other):

Undocumented

def __imul__(self, n):

Undocumented

def __init__(self, initlist=None, source=None, items=None, parent=None, parent_offset=None):

Undocumented

def __le__(self, other):

Undocumented

def __len__(self):

Undocumented

def __lt__(self, other):

Undocumented

def __mul__(self, n):

Undocumented

def __ne__(self, other):

Undocumented

def __radd__(self, other):

Undocumented

def __repr__(self):

Undocumented

def __setitem__(self, i, item):

Undocumented

def __str__(self):

Undocumented

def append(self, item, source=None, offset=0):

Undocumented

def count(self, item):

Undocumented

def disconnect(self):
Break link between this list and parent list.
def extend(self, other):

Undocumented

def index(self, item):

Undocumented

def info(self, i):
Return source & offset for index i.
def insert(self, i, item, source=None, offset=0):

Undocumented

def offset(self, i):
Return offset for index i.
def pop(self, i=-1):

Undocumented

def pprint(self):
Print the list in grep format (source:offset:value lines)
def remove(self, item):

Undocumented

def reverse(self):

Undocumented

def sort(self, *args):

Undocumented

def source(self, i):
Return source for index i.
def trim_end(self, n=1):
Remove items from the end of the list, without touching the parent.
def trim_start(self, n=1):
Remove items from the start of the list, without touching the parent.
def xitems(self):
Return iterator yielding (source, offset, value) tuples.
data =
The actual list of data, flattened from various sources.
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.
parent =
The parent list.
parent_offset =
Offset of this list from the beginning of the parent list.
def __cast(self, other):

Undocumented