本文整理匯總了Python中pyasn1.type.constraint.SingleValueConstraint方法的典型用法代碼示例。如果您正苦於以下問題:Python constraint.SingleValueConstraint方法的具體用法?Python constraint.SingleValueConstraint怎麽用?Python constraint.SingleValueConstraint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyasn1.type.constraint
的用法示例。
在下文中一共展示了constraint.SingleValueConstraint方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _msg_type_component
# 需要導入模塊: from pyasn1.type import constraint [as 別名]
# 或者: from pyasn1.type.constraint import SingleValueConstraint [as 別名]
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: withValues
# 需要導入模塊: from pyasn1.type import constraint [as 別名]
# 或者: from pyasn1.type.constraint import SingleValueConstraint [as 別名]
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
示例3: withNamedValues
# 需要導入模塊: from pyasn1.type import constraint [as 別名]
# 或者: from pyasn1.type.constraint import SingleValueConstraint [as 別名]
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