我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用pyasn1.type.constraint.ValueSizeConstraint()。
def withSize(cls, minimum, maximum): """Creates a subclass with value size constraint. """ class X(cls): subtypeSpec = cls.subtypeSpec + constraint.ValueSizeConstraint(minimum, maximum) X.__name__ = cls.__name__ return X
def withSize(cls, minimum, maximum): """Creates a subclass with value size constraint. """ class X(cls): subtypeSpec = cls.subtypeSpec + constraint.ValueSizeConstraint(minimum, maximum) X.__name__ = cls.__name__ return X # modern pyasn1 does this all by itself