base.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:AshsSDK 作者: thehappydinoa 项目源码 文件源码
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:`tuple`, :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.

         Returns
         -------
         :
             new instance of |ASN.1| type/value
        """
        if value is None or value is noValue:
            if not kwargs:
                return self

            value = self._value

        for arg in self.readOnly:
            if arg in kwargs:
                kwargs[arg] += getattr(self, arg)
            else:
                kwargs[arg] = getattr(self, arg)

        try:
            kwargs['tagSet'] = self.tagSet.tagImplicitly(kwargs['implicitTag'])

        except KeyError:
            pass

        try:
            kwargs['tagSet'] = self.tagSet.tagExplicitly(kwargs['explicitTag'])

        except KeyError:
            pass

        return self.__class__(value, **kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号