class documentation
class StringList(ViewList): (source)
Constructor: StringList(initlist, source, items, parent, parent_offset)
A ViewList with string-specific methods.
| Method | get_2 |
Undocumented |
| Method | get |
Extract and return a StringList of indented lines of text. |
| Method | get |
Return a contiguous block of text. |
| Method | pad |
Pad all double-width characters in self by appending pad_char to each. For East Asian language support. |
| Method | replace |
Replace all occurrences of substring old with new. |
| Method | trim |
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 | __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 |
Remove items from the end of the list, without touching the parent. |
| Method | trim |
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 of this list from the beginning of the parent list. |
| Method | __cast |
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 | Stop collecting at the first blank line if true. |
| strip | Strip common leading indent if true (default). |
| block | The indent of the entire block, if known. |
| first | The indent of the first line, if known. |
| Returns | |
| |
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).