text_lint.operations.validators.validate_expression.ValidateExpression

class text_lint.operations.validators.validate_expression.ValidateExpression(name: str, new_saved: str, operator: str, saved_a: AliasYamlLookupExpressionSet, saved_b: AliasYamlLookupExpressionSet)[Quellcode]

Bases: ValidationComparisonBase

A validator to combine result lookups into a new save id.

class Parameters[Quellcode]

Bases: Parameters

Parameter validation for this operation.

__init__(name: str, new_saved: str, operator: str, saved_a: AliasYamlLookupExpressionSet, saved_b: AliasYamlLookupExpressionSet) None[Quellcode]

Initialize ValidateExpression instances.

Parameter:
  • name (str) – The configured name of this validator.

  • new_saved (str) – The new saved id to create.

  • operator (str) – An operator applied to the lookup expression result pairs.

  • saved_a (AliasYamlLookupExpressionSet) – A list of YAML lookup expressions to evaluate.

  • saved_b (AliasYamlLookupExpressionSet) – A second list of YAML lookup expressions to evaluate.

Raises:

TypeError

apply(state: ValidatorState) None[Quellcode]

Apply the ValidateCombine validator logic.

comparison(result_a: AliasLookupResult, result_b: AliasLookupResult) bool[Quellcode]

Apply the operator to each pair of lookup expression results.

A new result tree will be created with the expression result.

Parameter:
  • result_a (AliasLookupResult) – A lookup expression result to operate on.

  • result_b (AliasLookupResult) – A second lookup expression result to operate on.

Rückgabe:

Whether the operation could be applied to the result pair.

Raises:

TypeError (which is handled by the base class)

Rückgabetyp:

bool