當前位置: 首頁>>代碼示例>>Python>>正文


Python encoder.OctetStringEncoder方法代碼示例

本文整理匯總了Python中pyasn1.codec.ber.encoder.OctetStringEncoder方法的典型用法代碼示例。如果您正苦於以下問題:Python encoder.OctetStringEncoder方法的具體用法?Python encoder.OctetStringEncoder怎麽用?Python encoder.OctetStringEncoder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyasn1.codec.ber.encoder的用法示例。


在下文中一共展示了encoder.OctetStringEncoder方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: encodeValue

# 需要導入模塊: from pyasn1.codec.ber import encoder [as 別名]
# 或者: from pyasn1.codec.ber.encoder import OctetStringEncoder [as 別名]
def encodeValue(self, encodeFun, client, defMode, maxChunkSize):
        return encoder.OctetStringEncoder.encodeValue(
            self, encodeFun, client, defMode, 1000
        ) 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:6,代碼來源:encoder.py

示例2: encodeValue

# 需要導入模塊: from pyasn1.codec.ber import encoder [as 別名]
# 或者: from pyasn1.codec.ber.encoder import OctetStringEncoder [as 別名]
def encodeValue(self, value, asn1Spec, encodeFun, **options):
        # Encoding constraints:
        # - minutes are mandatory, seconds are optional
        # - subseconds must NOT be zero
        # - no hanging fraction dot
        # - time in UTC (Z)
        # - only dot is allowed for fractions

        if asn1Spec is not None:
            value = asn1Spec.clone(value)

        octets = value.asOctets()

        if not self.minLength < len(octets) < self.maxLength:
            raise error.PyAsn1Error('Length constraint violated: %r' % value)

        if self.pluschar in octets or self.minuschar in octets:
            raise error.PyAsn1Error('Must be UTC time: %r' % octets)

        if octets[-1] != self.zchar:
            raise error.PyAsn1Error('Missing "Z" time zone specifier: %r' % octets)

        if self.commachar in octets:
            raise error.PyAsn1Error('Comma in fractions disallowed: %r' % value)

        options.update(maxChunkSize=1000)

        return encoder.OctetStringEncoder.encodeValue(
            self, value, asn1Spec, encodeFun, **options
        ) 
開發者ID:tp4a,項目名稱:teleport,代碼行數:32,代碼來源:encoder.py

示例3: encodeValue

# 需要導入模塊: from pyasn1.codec.ber import encoder [as 別名]
# 或者: from pyasn1.codec.ber.encoder import OctetStringEncoder [as 別名]
def encodeValue(self, encodeFun, client, defMode, maxChunkSize):
        return encoder.OctetStringEncoder.encodeValue(
            self, encodeFun, client, defMode, 1000
            )

# specialized RealEncoder here
# specialized GeneralStringEncoder here
# specialized GeneralizedTimeEncoder here
# specialized UTCTimeEncoder here 
開發者ID:caronc,項目名稱:nzb-subliminal,代碼行數:11,代碼來源:encoder.py

示例4: encodeValue

# 需要導入模塊: from pyasn1.codec.ber import encoder [as 別名]
# 或者: from pyasn1.codec.ber.encoder import OctetStringEncoder [as 別名]
def encodeValue(self, value, asn1Spec, encodeFun, **options):
        # Encoding constraints:
        # - minutes are mandatory, seconds are optional
        # - sub-seconds must NOT be zero
        # - no hanging fraction dot
        # - time in UTC (Z)
        # - only dot is allowed for fractions

        if asn1Spec is not None:
            value = asn1Spec.clone(value)

        octets = value.asOctets()

        if not self.minLength < len(octets) < self.maxLength:
            raise error.PyAsn1Error('Length constraint violated: %r' % value)

        if self.pluschar in octets or self.minuschar in octets:
            raise error.PyAsn1Error('Must be UTC time: %r' % octets)

        if octets[-1] != self.zchar:
            raise error.PyAsn1Error('Missing "Z" time zone specifier: %r' % octets)

        if self.commachar in octets:
            raise error.PyAsn1Error('Comma in fractions disallowed: %r' % value)

        options.update(maxChunkSize=1000)

        return encoder.OctetStringEncoder.encodeValue(
            self, value, asn1Spec, encodeFun, **options
        ) 
開發者ID:gkrizek,項目名稱:bash-lambda-layer,代碼行數:32,代碼來源:encoder.py


注:本文中的pyasn1.codec.ber.encoder.OctetStringEncoder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。