CompilerFilter

class CompilerFilter

Description

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.

context

RW

The interpreter context.

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.vm.Compiler

The compiler used to evaluate filter expressions.

property context: syside.vm.Context

The interpreter context.

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.vm.Compiler, context: syside.vm.Context, 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 by