ExpressionFactory

class lsst.daf.butler.queries.expression_factory.ExpressionFactory(universe: DimensionUniverse)

Bases: object

A factory for creating column expressions that uses operator overloading to form a mini-language.

Instances of this class are usually obtained from Query.expression_factory; see that property’s documentation for more information.

Parameters:
universeDimensionUniverse

Object that describes all dimensions.

Methods Summary

all(first, /, *args)

Combine a sequence of boolean expressions with logical AND.

any(first, /, *args)

Combine a sequence of boolean expressions with logical OR.

literal(value)

Return an expression proxy that represents a literal value.

not_(operand)

Apply a logical NOT operation to a boolean expression.

unwrap(proxy)

Return the column expression object that backs a proxy.

Methods Documentation

all(first: Predicate, /, *args: Predicate) Predicate

Combine a sequence of boolean expressions with logical AND.

Parameters:
firsttree.Predicate

First operand (required).

*args

Additional operands.

Returns:
logical_andtree.Predicate

A boolean expression that evaluates to True only if all operands evaluate to `True.

any(first: Predicate, /, *args: Predicate) Predicate

Combine a sequence of boolean expressions with logical OR.

Parameters:
firsttree.Predicate

First operand (required).

*args

Additional operands.

Returns:
logical_ortree.Predicate

A boolean expression that evaluates to True if any operand evaluates to `True.

static literal(value: object) ExpressionProxy

Return an expression proxy that represents a literal value.

Expression proxy objects obtained from this factory can generally be compared directly to literals, so calling this method directly in user code should rarely be necessary.

Parameters:
valueobject

Value to include as a literal in an expression tree.

Returns:
expressionExpressionProxy

Expression wrapper for this literal.

not_(operand: Predicate) Predicate

Apply a logical NOT operation to a boolean expression.

Parameters:
operandtree.Predicate

Expression to invetree.

Returns:
logical_nottree.Predicate

A boolean expression that evaluates to the opposite of operand.

static unwrap(proxy: ExpressionProxy) IntColumnLiteral | StringColumnLiteral | FloatColumnLiteral | HashColumnLiteral | UUIDColumnLiteral | DateTimeColumnLiteral | TimespanColumnLiteral | RegionColumnLiteral | DimensionKeyReference | DimensionFieldReference | DatasetFieldReference | UnaryExpression | BinaryExpression

Return the column expression object that backs a proxy.

Parameters:
proxyExpressionProxy

Proxy constructed via an ExpressionFactory.

Returns:
expressiontree.ColumnExpression

Underlying column expression object.