本文整理匯總了Python中pyasn1.type.namedval.NamedValues方法的典型用法代碼示例。如果您正苦於以下問題:Python namedval.NamedValues方法的具體用法?Python namedval.NamedValues怎麽用?Python namedval.NamedValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyasn1.type.namedval
的用法示例。
在下文中一共展示了namedval.NamedValues方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: clone
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [as 別名]
def clone(self, value=noValue, tagSet=None, subtypeSpec=None,
namedValues=None):
"""Creates a copy of object representing ASN.1 INTEGER type or value.
If additional parameters are specified, they will be used
in resulting object instead of corresponding parameters of
current object.
Parameters
----------
value : :class:`int`, :class:`str` or :py:class:`~pyasn1.type.univ.Integer` object
Initialization value to pass to new ASN.1 object instead of
inheriting one from the caller.
tagSet: :py:class:`~pyasn1.type.tag.TagSet`
Object representing ASN.1 tag(s) to use in new object instead of inheriting from the caller
subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection`
Object representing ASN.1 subtype constraint(s) to use in new object instead of inheriting from the caller
namedValues: :py:class:`~pyasn1.type.namedval.NamedValues`
Object representing symbolic aliases for numbers to use instead of inheriting from caller
Returns
-------
: :py:class:`~pyasn1.type.univ.Integer`
new instance of INTEGER type/value
"""
if self.isNoValue(value):
if self.isNoValue(tagSet, subtypeSpec, namedValues):
return self
value = self._value
if tagSet is None:
tagSet = self._tagSet
if subtypeSpec is None:
subtypeSpec = self._subtypeSpec
if namedValues is None:
namedValues = self.__namedValues
return self.__class__(value, tagSet, subtypeSpec, namedValues)
示例2: subtype
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [as 別名]
def subtype(self, value=noValue, implicitTag=None, explicitTag=None,
subtypeSpec=None, namedValues=None):
"""Creates a copy of ENUMERATED object representing ASN.1 subtype or a value.
If additional parameters are specified, they will be merged
with the ones of the caller, then applied to newly created object.
Parameters
----------
value : :class:`int`, :class:`str` or :py:class:`~pyasn1.type.univ.Enumerated` object
Initialization value to pass to new ASN.1 object instead of
inheriting one from the caller.
implicitTag: :py:class:`~pyasn1.type.tag.Tag`
Implicitly apply given ASN.1 tag object to caller's
:py:class:`~pyasn1.type.tag.TagSet`, then use the result as
new object's ASN.1 tag(s).
explicitTag: :py:class:`~pyasn1.type.tag.Tag`
Explicitly apply given ASN.1 tag object to caller's
:py:class:`~pyasn1.type.tag.TagSet`, then use the result as
new object's ASN.1 tag(s).
subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection`
Object representing ASN.1 subtype constraint(s) to use in new object instead of inheriting from the caller
namedValues: :py:class:`~pyasn1.type.namedval.NamedValues`
Add given object representing symbolic aliases for numbers
to one of the caller, then use the result as new object's
named numbers.
Returns
-------
: :py:class:`~pyasn1.type.univ.Enumerated`
new instance of ENUMERATED type/value
"""
return Integer.subtype(self, value, implicitTag, explicitTag, subtypeSpec, namedValues)
# "Structured" ASN.1 types
示例3: withNamedValues
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [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
示例4: withNamedBits
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [as 別名]
def withNamedBits(cls, **values):
"""Creates a subclass with discreet named bits constraint.
"""
class X(cls):
namedValues = cls.namedValues + namedval.NamedValues(*values.items())
X.__name__ = cls.__name__
return X
示例5: clone
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [as 別名]
def clone(self, value=noValue, **kwargs):
"""Create a copy of a |ASN.1| type or object.
Any parameters to the *clone()* method will replace corresponding
properties of the |ASN.1| object.
Parameters
----------
value: :class:`int`, :class:`str` or |ASN.1| object
Initialization value to pass to new ASN.1 object instead of
inheriting one from the caller.
tagSet: :py:class:`~pyasn1.type.tag.TagSet`
Object representing ASN.1 tag(s) to use in new object instead of inheriting from the caller
subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection`
Object representing ASN.1 subtype constraint(s) to use in new object instead of inheriting from the caller
namedValues: :py:class:`~pyasn1.type.namedval.NamedValues`
Object representing symbolic aliases for numbers to use instead of inheriting from caller
Returns
-------
:
new instance of |ASN.1| type/value
"""
return base.AbstractSimpleAsn1Item.clone(self, value, **kwargs)
示例6: subtype
# 需要導入模塊: from pyasn1.type import namedval [as 別名]
# 或者: from pyasn1.type.namedval import NamedValues [as 別名]
def subtype(self, value=noValue, **kwargs):
"""Create a copy of a |ASN.1| type or object.
Any parameters to the *subtype()* method will be added to the corresponding
properties of the |ASN.1| object.
Parameters
----------
value: :class:`int`, :class:`str` or |ASN.1| object
Initialization value to pass to new ASN.1 object instead of
inheriting one from the caller.
implicitTag: :py:class:`~pyasn1.type.tag.Tag`
Implicitly apply given ASN.1 tag object to caller's
:py:class:`~pyasn1.type.tag.TagSet`, then use the result as
new object's ASN.1 tag(s).
explicitTag: :py:class:`~pyasn1.type.tag.Tag`
Explicitly apply given ASN.1 tag object to caller's
:py:class:`~pyasn1.type.tag.TagSet`, then use the result as
new object's ASN.1 tag(s).
subtypeSpec: :py:class:`~pyasn1.type.constraint.ConstraintsIntersection`
Add ASN.1 constraints object to one of the caller, then
use the result as new object's ASN.1 constraints.
namedValues: :py:class:`~pyasn1.type.namedval.NamedValues`
Add given object representing symbolic aliases for numbers
to one of the caller, then use the result as new object's
named numbers.
Returns
-------
:
new instance of |ASN.1| type/value
"""
return base.AbstractSimpleAsn1Item.subtype(self, value, **kwargs)
# backward compatibility