psamm.expression.boolean – Boolean expressions¶
Representations of boolean expressions and variables.
These classes can be used to represent simple boolean expressions and do evaluation with substitutions of particular variables.
-
class
psamm.expression.boolean.Variable(symbol)¶ Represents a variable in a boolean expression
-
class
psamm.expression.boolean.And(*args)¶ Represents an AND term in an expression.
-
class
psamm.expression.boolean.Or(*args)¶ Represents an OR term in an expression.
-
exception
psamm.expression.boolean.SubstitutionError¶ Error substituting into expression.
-
class
psamm.expression.boolean.Expression(arg, _vars=None)¶ Boolean expression representation.
The expression can be constructed from an expression string of variables, operators (“and”, “or”) and parenthesis groups. For example,
>>> e = Expression('a and (b or c)')
-
root¶ Return root term, variable or boolean of the expression.
-
variables¶ Immutable set of variables in the expression.
-
has_value()¶ Return True if the expression has no variables.
-
value¶ The value of the expression if fully evaluated.
-
substitute(mapping)¶ Substitute variables using mapping function.
-
-
exception
psamm.expression.boolean.ParseError(*args, **kwargs)¶ Signals error parsing boolean expression.