LazyImportsIterator

class LazyImportsIterator[T: Element]

Description

An internally iterated generator for Element attributes that may include imported members.

for member in package.members.with_import_filter(...).collect():
    ...

Evaluation of import filters requires an explicit evaluator function because the model is treated as a data structure. It has no knowledge of expression evaluation semantics. In addition, this allows reusing virtual machines between different methods for improved performance.

Members defined in LazyImportsIterator (1 member)

with_import_filter

Use the provided function to evaluate import filters.

Members inherited from LazyIterator (7 members)

__bool__

Returns True if this range is not empty.

at

Get value at index. This is computed lazily. Returns None for out of bounds index.

collect

Collect all items into a list.

count

Count the number of items in this range. This is computed lazily.

empty

Check if this range is empty.

for_each

Lazily visit each item in this range. Visitation is stopped on returning False or VisitAction.Stop;

get

Get value at index, This is computed lazily. Throws IndexError on out of bounds.

Methods

with_import_filter(arg: syside.CompilerFilter | Callable[[syside.Element, list[syside.Expression]], bool], /) → syside.LazyImportsIterator[syside.T]

Use the provided function to evaluate import filters.

Note that this creates a copy of self with the new filter function.

Used by