class documentation

class StringList(ViewList): (source)

View In Hierarchy

A `ViewList` with string-specific methods.

Method get_2D_block Undocumented
Method get_indented Extract and return a StringList of indented lines of text.
Method get_text_block Return a contiguous block of text.
Method pad_double_width Pad all double-width characters in `self` appending `pad_char`.
Method replace Replace all occurrences of substring `old` with `new`.
Method trim_left Trim `length` characters off the beginning of each item, in-place, from index `start` to `end`. No whitespace-checking is done on the trimmed text. Does not affect slice parent.

Inherited from ViewList:

Method __add__ 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 get_2D_block(self, top, left, bottom, right, strip_indent=True): (source)

Undocumented

def get_indented(self, start=0, until_blank=False, strip_indent=True, block_indent=None, first_indent=None): (source)

Extract and return a StringList of indented lines of text. Collect all lines with indentation, determine the minimum indentation, remove the minimum indentation from all indented lines (unless `strip_indent` is false), and return them. All lines up to but not including the first unindented line will be returned. :Parameters: - `start`: The index of the first line to examine. - `until_blank`: Stop collecting at the first blank line if true. - `strip_indent`: Strip common leading indent if true (default). - `block_indent`: The indent of the entire block, if known. - `first_indent`: The indent of the first line, if known. :Return: - a StringList of indented lines with minimum indent removed; - the amount of the indent; - a boolean: did the indented block finish with a blank line or EOF?

def get_text_block(self, start, flush_left=False): (source)

Return a contiguous block of text. If `flush_left` is true, raise `UnexpectedIndentationError` if an indented line is encountered before the text block ends (with a blank line).

def pad_double_width(self, pad_char): (source)

Pad all double-width characters in `self` appending `pad_char`. For East Asian language support.

def replace(self, old, new): (source)

Replace all occurrences of substring `old` with `new`.

def trim_left(self, length, start=0, end=sys.maxsize): (source)

Trim `length` characters off the beginning of each item, in-place, from index `start` to `end`. No whitespace-checking is done on the trimmed text. Does not affect slice parent.