def clone(self, value=noValue, tagSet=None, subtypeSpec=None,
encoding=None, binValue=noValue, hexValue=noValue):
"""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:`str`, :class:`bytes` 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
encoding: :py:class:`str`
Unicode codec ID to encode/decode :class:`unicode` (Python 2)
or :class:`str` (Python 3) the payload when |ASN.1|
object is used in string context.
binValue: :py:class:`str`
Binary string initializer. Example: '10110011'.
hexValue: :py:class:`str`
Hexadecimal string initializer. Example: 'DEADBEEF'.
Returns
-------
:
new instance of |ASN.1| type/value
"""
if self.isNoValue(value, binValue, hexValue):
if self.isNoValue(tagSet, subtypeSpec, encoding):
return self
value = self._value
if tagSet is None:
tagSet = self._tagSet
if subtypeSpec is None:
subtypeSpec = self._subtypeSpec
if encoding is None:
encoding = self._encoding
return self.__class__(
value, tagSet, subtypeSpec, encoding, binValue, hexValue
)
评论列表
文章目录