at.load.parser#

Classes

StrParameter(parser, expr)

String expression parameter.

StrParser()

Abstract base class for string expression parsers.

class StrParameter(parser, expr)[source]#

Bases: object

String expression parameter.

A StrParameter represents an expression which can be evaluated in the context of a StrParser. This is typically used for MAD-X style parameters where expressions can reference other parameters.

Initialise a string parameter.

Parameters:
  • parser (StrParser) – StrParser instance defining the context for evaluation

  • expr (str) – Expression to be evaluated

The expression may contain parameter names, arithmetic operators and mathematical functions, depending on the capabilities of the parser.

property value: Any#

Current value of the parameter.

class StrParser[source]#

Bases: ABC

Abstract base class for string expression parsers.

This class defines the interface for parsers that can evaluate string expressions. Concrete implementations should provide the evaluate method.

abstractmethod evaluate(expr)[source]#

Evaluate a string expression in the context of this parser.

Parameters:

expr (str) – The string expression to evaluate

Returns:

The result of evaluating the expression