neosqlite.collection.expr_evaluator.python_evaluators.core module

Core Python evaluation: dispatcher, logical/comparison, conditionals, operands.

class neosqlite.collection.expr_evaluator.python_evaluators.core.CorePythonMixin[source]

Bases: BasePythonMixin

Entry point, operator dispatch, and basic evaluation helpers.

evaluate_python(expr: dict[str, Any], document: dict[str, Any]) bool[source]

Python fallback evaluation for $expr.

This ensures identical results to SQL evaluation and provides the kill switch functionality.

Parameters:
  • expr – The $expr expression

  • document – Document to evaluate against

Returns:

Boolean result of expression evaluation

_evaluate_expr_python(expr: dict[str, Any], document: dict[str, Any]) Any[source]

Recursively evaluate expression in Python.

_evaluate_logical_python(operator: str, operands: list[Any], document: dict[str, Any]) bool[source]

Evaluate logical operators in Python.

_evaluate_comparison_python(operator: str, operands: list[Any], document: dict[str, Any]) bool[source]

Evaluate comparison operators in Python.

_evaluate_cmp_python(operands: list[Any], document: dict[str, Any]) int[source]

Evaluate $cmp operator in Python.

_evaluate_cond_python(operands: dict[str, Any], document: dict[str, Any]) Any[source]

Evaluate $cond operator in Python.

_evaluate_ifNull_python(operands: list[Any], document: dict[str, Any]) Any[source]

Evaluate $ifNull operator in Python.

_evaluate_switch_python(operands: dict[str, Any], document: dict[str, Any]) Any[source]

Evaluate $switch operator in Python.

_evaluate_literal_python(operands: Any, document: dict[str, Any]) Any[source]

Evaluate $literal operator in Python.

_evaluate_operand_python(operand: Any, document: dict[str, Any]) Any[source]

Evaluate an operand in Python context.