Module declare4py.enums.mp_constants

Expand source code
from enum import Enum


class Template(str, Enum):

    def __new__(cls, *args, **kwds):
        value = len(cls.__members__) + 1
        obj = str.__new__(cls)
        obj._value_ = value
        return obj

    def __init__(self, templ_str: str, is_binary: bool, is_negative: bool, supports_cardinality: bool):
        self.templ_str = templ_str
        self.is_binary = is_binary
        self.is_negative = is_negative
        self.supports_cardinality = supports_cardinality

    EXISTENCE   = "Existence",  False, False, True
    ABSENCE     = "Absence",    False, False, True
    EXACTLY     = "Exactly",    False, False, True

    INIT        = "Init",       False, False, False

    CHOICE              = "Choice",                 True, False, False
    EXCLUSIVE_CHOICE    = "Exclusive Choice",       True, False, False
    RESPONDED_EXISTENCE = "Responded Existence",    True, False, False
    RESPONSE            = "Response",               True, False, False
    ALTERNATE_RESPONSE  = "Alternate Response",     True, False, False
    CHAIN_RESPONSE      = "Chain Response",         True, False, False
    PRECEDENCE          = "Precedence",             True, False, False
    ALTERNATE_PRECEDENCE = "Alternate Precedence",  True, False, False
    CHAIN_PRECEDENCE    = "Chain Precedence",       True, False, False

    NOT_RESPONDED_EXISTENCE = "Not Responded Existence",    True, True, False
    NOT_RESPONSE            = "Not Response",               True, True, False
    NOT_CHAIN_RESPONSE      = "Not Chain Response",         True, True, False
    NOT_PRECEDENCE          = "Not Precedence",             True, True, False
    NOT_CHAIN_PRECEDENCE    = "Not Chain Precedence",       True, True, False

    @classmethod
    def get_template_from_string(cls, template_str):
        return next(filter(lambda t: t.templ_str == template_str, Template), None)

    @classmethod
    def get_unary_templates(cls):
        return tuple(filter(lambda t: not t.is_binary, Template))

    @classmethod
    def get_binary_templates(cls):
        return tuple(filter(lambda t: t.is_binary, Template))

    @classmethod
    def get_positive_templates(cls):
        return tuple(filter(lambda t: not t.is_negative, Template))

    @classmethod
    def get_negative_templates(cls):
        return tuple(filter(lambda t: t.is_negative, Template))


class TraceState(str, Enum):
    VIOLATED = "Violated"
    SATISFIED = "Satisfied"
    POSSIBLY_VIOLATED = "Possibly Violated"
    POSSIBLY_SATISFIED = "Possibly Satisfied"

Classes

class Template (templ_str: str, is_binary: bool, is_negative: bool, supports_cardinality: bool)

An enumeration.

Expand source code
class Template(str, Enum):

    def __new__(cls, *args, **kwds):
        value = len(cls.__members__) + 1
        obj = str.__new__(cls)
        obj._value_ = value
        return obj

    def __init__(self, templ_str: str, is_binary: bool, is_negative: bool, supports_cardinality: bool):
        self.templ_str = templ_str
        self.is_binary = is_binary
        self.is_negative = is_negative
        self.supports_cardinality = supports_cardinality

    EXISTENCE   = "Existence",  False, False, True
    ABSENCE     = "Absence",    False, False, True
    EXACTLY     = "Exactly",    False, False, True

    INIT        = "Init",       False, False, False

    CHOICE              = "Choice",                 True, False, False
    EXCLUSIVE_CHOICE    = "Exclusive Choice",       True, False, False
    RESPONDED_EXISTENCE = "Responded Existence",    True, False, False
    RESPONSE            = "Response",               True, False, False
    ALTERNATE_RESPONSE  = "Alternate Response",     True, False, False
    CHAIN_RESPONSE      = "Chain Response",         True, False, False
    PRECEDENCE          = "Precedence",             True, False, False
    ALTERNATE_PRECEDENCE = "Alternate Precedence",  True, False, False
    CHAIN_PRECEDENCE    = "Chain Precedence",       True, False, False

    NOT_RESPONDED_EXISTENCE = "Not Responded Existence",    True, True, False
    NOT_RESPONSE            = "Not Response",               True, True, False
    NOT_CHAIN_RESPONSE      = "Not Chain Response",         True, True, False
    NOT_PRECEDENCE          = "Not Precedence",             True, True, False
    NOT_CHAIN_PRECEDENCE    = "Not Chain Precedence",       True, True, False

    @classmethod
    def get_template_from_string(cls, template_str):
        return next(filter(lambda t: t.templ_str == template_str, Template), None)

    @classmethod
    def get_unary_templates(cls):
        return tuple(filter(lambda t: not t.is_binary, Template))

    @classmethod
    def get_binary_templates(cls):
        return tuple(filter(lambda t: t.is_binary, Template))

    @classmethod
    def get_positive_templates(cls):
        return tuple(filter(lambda t: not t.is_negative, Template))

    @classmethod
    def get_negative_templates(cls):
        return tuple(filter(lambda t: t.is_negative, Template))

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var ABSENCE
var ALTERNATE_PRECEDENCE
var ALTERNATE_RESPONSE
var CHAIN_PRECEDENCE
var CHAIN_RESPONSE
var CHOICE
var EXACTLY
var EXCLUSIVE_CHOICE
var EXISTENCE
var INIT
var NOT_CHAIN_PRECEDENCE
var NOT_CHAIN_RESPONSE
var NOT_PRECEDENCE
var NOT_RESPONDED_EXISTENCE
var NOT_RESPONSE
var PRECEDENCE
var RESPONDED_EXISTENCE
var RESPONSE

Static methods

def get_binary_templates()
Expand source code
@classmethod
def get_binary_templates(cls):
    return tuple(filter(lambda t: t.is_binary, Template))
def get_negative_templates()
Expand source code
@classmethod
def get_negative_templates(cls):
    return tuple(filter(lambda t: t.is_negative, Template))
def get_positive_templates()
Expand source code
@classmethod
def get_positive_templates(cls):
    return tuple(filter(lambda t: not t.is_negative, Template))
def get_template_from_string(template_str)
Expand source code
@classmethod
def get_template_from_string(cls, template_str):
    return next(filter(lambda t: t.templ_str == template_str, Template), None)
def get_unary_templates()
Expand source code
@classmethod
def get_unary_templates(cls):
    return tuple(filter(lambda t: not t.is_binary, Template))
class TraceState (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class TraceState(str, Enum):
    VIOLATED = "Violated"
    SATISFIED = "Satisfied"
    POSSIBLY_VIOLATED = "Possibly Violated"
    POSSIBLY_SATISFIED = "Possibly Satisfied"

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var POSSIBLY_SATISFIED
var POSSIBLY_VIOLATED
var SATISFIED
var VIOLATED