当前位置: 首页>>代码示例>>Python>>正文


Python base.noValue方法代码示例

本文整理汇总了Python中pyasn1.type.base.noValue方法的典型用法代码示例。如果您正苦于以下问题:Python base.noValue方法的具体用法?Python base.noValue怎么用?Python base.noValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasn1.type.base的用法示例。


在下文中一共展示了base.noValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def __init__(self, value=None, tagSet=None, subtypeSpec=None,
                 encoding=None, binValue=None, hexValue=None):
        if encoding is None:
            self._encoding = self.encoding
        else:
            self._encoding = encoding
        if binValue is not None:
            value = self.fromBinaryString(binValue)
        if hexValue is not None:
            value = self.fromHexString(hexValue)
        if value is None or value is base.noValue:
            value = self.defaultHexValue
        if value is None or value is base.noValue:
            value = self.defaultBinValue
        self.__asNumbersCache = None
        base.AbstractSimpleAsn1Item.__init__(self, value, tagSet, subtypeSpec) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:18,代码来源:univ.py

示例2: __init__

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def __init__(self, value=None, tagSet=None, subtypeSpec=None,
                 encoding=None, binValue=None, hexValue=None):
        if encoding is None:
            self._encoding = self.encoding
        else:
            self._encoding = encoding
        if binValue is not None:
            value = self.fromBinaryString(binValue)
        if hexValue is not None:
            value = self.fromHexString(hexValue)
        if value is None or value is base.noValue:
            value = self.defaultHexValue
        if value is None or value is base.noValue:
            value = self.defaultBinValue
        self.__intValue = None
        base.AbstractSimpleAsn1Item.__init__(self, value, tagSet, subtypeSpec) 
开发者ID:caronc,项目名称:nzb-subliminal,代码行数:18,代码来源:univ.py

示例3: _createComponent

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def _createComponent(self, asn1Spec, tagSet, value, **options):
        if options.get('native'):
            return value
        elif asn1Spec is None:
            return self.protoComponent.clone(value, tagSet=tagSet)
        elif value is noValue:
            return asn1Spec
        else:
            return asn1Spec.clone(value) 
开发者ID:tp4a,项目名称:teleport,代码行数:11,代码来源:decoder.py

示例4: indefLenValueDecoder

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def indefLenValueDecoder(self, substrate, asn1Spec,
                             tagSet=None, length=None, state=None,
                             decodeFun=None, substrateFun=None,
                             **options):

        if substrateFun:
            return substrateFun(self._createComponent(asn1Spec, tagSet, noValue, **options), substrate, length)

        # All inner fragments are of the same type, treat them as octet string
        substrateFun = self.substrateCollector

        bitString = self.protoComponent.fromOctetString(null, internalFormat=True)

        while substrate:
            component, substrate = decodeFun(substrate, self.protoComponent,
                                             substrateFun=substrateFun,
                                             allowEoo=True, **options)
            if component is eoo.endOfOctets:
                break

            trailingBits = oct2int(component[0])
            if trailingBits > 7:
                raise error.PyAsn1Error(
                    'Trailing bits overflow %s' % trailingBits
                )

            bitString = self.protoComponent.fromOctetString(
                component[1:], internalFormat=True,
                prepend=bitString, padding=trailingBits
            )

        else:
            raise error.SubstrateUnderrunError('No EOO seen before substrate ends')

        return self._createComponent(asn1Spec, tagSet, bitString, **options), substrate 
开发者ID:tp4a,项目名称:teleport,代码行数:37,代码来源:decoder.py

示例5: valueDecoder

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
        head, tail = substrate[:length], substrate[length:]

        if substrateFun:
            return substrateFun(self._createComponent(asn1Spec, tagSet, noValue, **options),
                                substrate, length)

        if tagSet[0].tagFormat == tag.tagFormatSimple:  # XXX what tag to check?
            return self._createComponent(asn1Spec, tagSet, head, **options), tail

        if not self.supportConstructedForm:
            raise error.PyAsn1Error('Constructed encoding form prohibited at %s' % self.__class__.__name__)

        # All inner fragments are of the same type, treat them as octet string
        substrateFun = self.substrateCollector

        header = null

        while head:
            component, head = decodeFun(head, self.protoComponent,
                                        substrateFun=substrateFun,
                                        **options)
            header += component

        return self._createComponent(asn1Spec, tagSet, header, **options), tail 
开发者ID:tp4a,项目名称:teleport,代码行数:30,代码来源:decoder.py

示例6: valueDecoder

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def valueDecoder(self, substrate, asn1Spec,
                     tagSet=None, length=None, state=None,
                     decodeFun=None, substrateFun=None,
                     **options):
        head, tail = substrate[:length], substrate[length:]

        if substrateFun:
            return substrateFun(self._createComponent(asn1Spec, tagSet, noValue, **options),
                                substrate, length)

        if tagSet[0].tagFormat == tag.tagFormatSimple:  # XXX what tag to check?
            return self._createComponent(asn1Spec, tagSet, head, **options), tail

        if not self.supportConstructedForm:
            raise error.PyAsn1Error('Constructed encoding form prohibited at %s' % self.__class__.__name__)

        if LOG:
            LOG('assembling constructed serialization')

        # All inner fragments are of the same type, treat them as octet string
        substrateFun = self.substrateCollector

        header = null

        while head:
            component, head = decodeFun(head, self.protoComponent,
                                        substrateFun=substrateFun,
                                        **options)
            header += component

        return self._createComponent(asn1Spec, tagSet, header, **options), tail 
开发者ID:tp4a,项目名称:teleport,代码行数:33,代码来源:decoder.py

示例7: __repr__

# 需要导入模块: from pyasn1.type import base [as 别名]
# 或者: from pyasn1.type.base import noValue [as 别名]
def __repr__(self):
        if self._value is base.noValue:
            return self.__class__.__name__ + '()'
        if [ x for x in self.asNumbers() if x < 32 or x > 126 ]:
            return self.__class__.__name__ + '(hexValue=\'' + ''.join([ '%.2x' % x for x in self.asNumbers() ])+'\')'
        else:
            return self.__class__.__name__ + '(\'' + self.prettyOut(self._value) + '\')' 
开发者ID:caronc,项目名称:nzb-subliminal,代码行数:9,代码来源:univ.py


注:本文中的pyasn1.type.base.noValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。