Class pyglet.text.runlist.FilteredRunIterator

AbstractRunIterator --+
                      |
                     FilteredRunIterator
Iterate over an AbstractRunIterator with filtered values replaced by a default value.

Methods

  __init__(self, base_iterator, filter, default)
Create a filtered run iterator.
iterator ranges(self, start, end)
Iterate over a subrange of the run list.
object __getitem__(self, index)
Get the value at a given index.

Method Details

__init__

(Constructor) __init__(self, base_iterator, filter, default)
Create a filtered run iterator.
Parameters:
base_iterator : AbstractRunIterator
Source of runs.
filter : lambda object: bool
Function taking a value as parameter, and returning True if the value is acceptable, and False if the default value should be substituted.
default : object
Default value to replace filtered values.

ranges

ranges(self, start, end)

Iterate over a subrange of the run list.

See the class documentation for examples of valid usage.

Returns:
iterator: Iterator over (start, end, value) tuples.
Overrides:
AbstractRunIterator.ranges

__getitem__

(Indexing operator) __getitem__(self, index)

Get the value at a given index.

See the class documentation for examples of valid usage.

Returns: object
Overrides:
AbstractRunIterator.__getitem__