Constraints exclusion

class pyasn1.type.constraint.ConstraintsExclusion(constraint)

Create a ConstraintsExclusion logic operator object.

The ConstraintsExclusion logic operator succeeds when the value does not satisfy the operand constraint.

The ConstraintsExclusion object can be applied to any constraint and logic operator object.

Parameters:

*constraints – Constraint or logic operator objects.

Examples

class LuckyNumber(Integer):
    subtypeSpec = ConstraintsExclusion(
        SingleValueConstraint(13)
    )

# this will succeed
luckyNumber = LuckyNumber(12)

# this will raise ValueConstraintError
luckyNumber = LuckyNumber(13)

Note

The FROM … EXCEPT … ASN.1 clause should be modeled by combining constraint objects into one. See PermittedAlphabetConstraint for more information.