CompilerFilter

class CompilerFilter

A LazyImportsIterator compatible import filter evaluator.

This class allows the filter to skip expensive Python marshalling during filter evaluation to improve performance in the common case.

Note that because the specification requires all filter expressions to be model-level evaluable, invocations of functions is an error.

Members defined in CompilerFilter (5 members)

compiler

RW

The compiler used to evaluate filter expressions.

lib

RW

The standard library context used in filter expression evaluation.

reporter

RW

Callback used to propagate diagnostics from filter expression evaluation.

__call__

Evaluate conjunction of filter conditions on an element target.

__init__

Construct a new filter evaluator with a given compiler and lib.

Attributes

property compiler: syside.Compiler

The compiler used to evaluate filter expressions.

property lib: syside.Stdlib

The standard library context used in filter expression evaluation.

This is required for reflection to be evaluated.

property reporter: Callable[[syside.Element, syside.Diagnostic], None]

Callback used to propagate diagnostics from filter expression evaluation.

The signature is (source: Element, diagnostic: Diagnostic) -> None, where source is the element the diagnostic originates from.

By default, this emits a RuntimeWarning for each diagnostic.

Methods

__call__(arg0: syside.Element, arg1: Sequence[syside.Expression], /) bool

Evaluate conjunction of filter conditions on an element target.

__init__(compiler: syside.Compiler, lib: syside.Stdlib, reporter: Callable[[syside.Element, syside.Diagnostic], None] = ...) None

Construct a new filter evaluator with a given compiler and lib.

reporter is optional and is used to propagate any diagnostics from filter expression evaluation. By default, a RuntimeWarning is emitted on diagnostics.

lib is used to provide the compiler with standard library context required for metadata and reflection evaluation.

Used in