class documentation

class ViewList(object): (source)

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): (source)

Undocumented

def __cmp__(self, other): (source)

Undocumented

def __contains__(self, item): (source)

Undocumented

def __delitem__(self, i): (source)

Undocumented

def __eq__(self, other): (source)

Undocumented

def __ge__(self, other): (source)

Undocumented

def __getitem__(self, i): (source)

Undocumented

def __gt__(self, other): (source)

Undocumented

def __iadd__(self, other): (source)

Undocumented

def __imul__(self, n): (source)

Undocumented

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

Undocumented

def __le__(self, other): (source)

Undocumented

def __len__(self): (source)

Undocumented

def __lt__(self, other): (source)

Undocumented

def __mul__(self, n): (source)

Undocumented

def __ne__(self, other): (source)

Undocumented

def __radd__(self, other): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __setitem__(self, i, item): (source)

Undocumented

def __str__(self): (source)

Undocumented

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

Undocumented

def count(self, item): (source)

Undocumented

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

Undocumented

def index(self, item): (source)

Undocumented

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

Undocumented

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

Undocumented

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

Undocumented

def reverse(self): (source)

Undocumented

def sort(self, *args): (source)

Undocumented

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

Undocumented