Python pyasn1.type.constraint.SingleValueConstraint() Examples

The following are 6 code examples of pyasn1.type.constraint.SingleValueConstraint(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pyasn1.type.constraint , or try the search function .
Example #1
Source File: asn1.py    From CVE-2017-7494 with GNU General Public License v3.0 5 votes vote down vote up
def _msg_type_component(tag_value, values):
    c = constraint.ConstraintsUnion(
        *(constraint.SingleValueConstraint(int(v)) for v in values))
    return _sequence_component('msg-type', tag_value, univ.Integer(),
                               subtypeSpec=c) 
Example #2
Source File: asn1.py    From cracke-dit with MIT License 5 votes vote down vote up
def _msg_type_component(tag_value, values):
    c = constraint.ConstraintsUnion(
        *(constraint.SingleValueConstraint(int(v)) for v in values))
    return _sequence_component('msg-type', tag_value, univ.Integer(),
                               subtypeSpec=c) 
Example #3
Source File: rfc1902.py    From scalyr-agent-2 with Apache License 2.0 5 votes vote down vote up
def withValues(cls, *values):
        """Creates a subclass with discreet values constraint.
        """
        class X(cls):
            subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint(*values)
        X.__name__ = cls.__name__
        return X 
Example #4
Source File: rfc1902.py    From scalyr-agent-2 with Apache License 2.0 5 votes vote down vote up
def withNamedValues(cls, **values):
        """Creates a subclass with discreet named values constraint.
        """
        class X(cls):
            namedValues = cls.namedValues + namedval.NamedValues(*values.items())
            subtypeSpec = cls.subtypeSpec + constraint.SingleValueConstraint(*values.values())
        X.__name__ = cls.__name__
        return X 
Example #5
Source File: asn1.py    From Slackor with GNU General Public License v3.0 5 votes vote down vote up
def _msg_type_component(tag_value, values):
    c = constraint.ConstraintsUnion(
        *(constraint.SingleValueConstraint(int(v)) for v in values))
    return _sequence_component('msg-type', tag_value, univ.Integer(),
                               subtypeSpec=c) 
Example #6
Source File: asn1.py    From PiBunny with MIT License 5 votes vote down vote up
def _msg_type_component(tag_value, values):
    c = constraint.ConstraintsUnion(
        *(constraint.SingleValueConstraint(int(v)) for v in values))
    return _sequence_component('msg-type', tag_value, univ.Integer(),
                               subtypeSpec=c)