Python源码示例:pyasn1.type.constraint.SingleValueConstraint()
示例1
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)
示例2
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)
示例3
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
示例4
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
示例5
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)
示例6
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)