當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。