ssg.boolean_expression module

class ssg.boolean_expression.Algebra(symbol_cls, function_cls)[source]

Bases: BooleanAlgebra

Base class for boolean algebra

Algebra class will parse and evaluate boolean expressions, where operators could be any combination of “~, &, |, !, *, +, not, and, or” and variable symbols could contain version specifiers as described in PEP440 and PEP508.

Limitations: - no white space is allowed inside specifier expressions; - ~= specifier operator is not supported.

For example: “(oranges>=2.0.8,<=5 | fried[banana]) and !pie[apple]”

class ssg.boolean_expression.Function(*args)[source]

Bases: Function

Base class for boolean functions

Subclass it and pass to the Algebra as function_cls to enrich expression elements with domain-specific methods.

Provides is_and, is_or and is_not methods to distinguish instances between different boolean functions.

The as_id method will generate a unique string identifier usable as an XML id based on the properties of the entity.

as_id()[source]
is_and()[source]
is_not()[source]
is_or()[source]
class ssg.boolean_expression.Symbol(obj)[source]

Bases: Symbol

Base class for boolean symbols

Subclass it and pass to the Algebra as symbol_cls to enrich expression elements with domain-specific methods.

The as_id method will generate a unique string identifier usable as an XML id based on the properties of the entity.

property arg
as_dict()[source]
as_id()[source]
static get_base_of_parametrized_name(name)[source]
has_version_specs()[source]
static is_parametrized(name)[source]
property name