aboutsummaryrefslogtreecommitdiff
path: root/pyasn1/codec
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-09-17 00:56:29 +0200
committerIlya Etingof <etingof@gmail.com>2017-09-17 00:56:29 +0200
commit3dc7bd1d781e6d7a8e6a79c1c4ee94e305e4ec6b (patch)
tree53e5251690b7d076fcbec1ec2feda1219d8d6858 /pyasn1/codec
parentc01e1e3be03537451e332031cde07c286582f826 (diff)
parent3182ecf81839ae4072a46706c3d0426a03f80be8 (diff)
downloadpyasn1-3dc7bd1d781e6d7a8e6a79c1c4ee94e305e4ec6b.tar.gz
Merge branch 'master' into open-types-support
Diffstat (limited to 'pyasn1/codec')
-rw-r--r--pyasn1/codec/ber/decoder.py7
-rw-r--r--pyasn1/codec/ber/encoder.py8
-rw-r--r--pyasn1/codec/native/decoder.py2
3 files changed, 9 insertions, 8 deletions
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index 4a1ef01..ddd9a75 100644
--- a/pyasn1/codec/ber/decoder.py
+++ b/pyasn1/codec/ber/decoder.py
@@ -707,6 +707,7 @@ class UniversalConstructedTypeDecoder(AbstractConstructedDecoder):
return asn1Object, substrate
+
class SequenceOrSequenceOfDecoder(UniversalConstructedTypeDecoder):
protoRecordComponent = univ.Sequence()
protoSequenceComponent = univ.SequenceOf()
@@ -809,7 +810,7 @@ class AnyDecoder(AbstractSimpleDecoder):
decodeFun=None, substrateFun=None,
**options):
if asn1Spec is None or asn1Spec is not None and tagSet != asn1Spec.tagSet:
- fullSubstrate=options['fullSubstrate']
+ fullSubstrate = options['fullSubstrate']
# untagged Any container, recover inner header substrate
length += len(fullSubstrate) - len(substrate)
@@ -831,7 +832,7 @@ class AnyDecoder(AbstractSimpleDecoder):
# tagged Any type -- consume header substrate
header = null
else:
- fullSubstrate=options['fullSubstrate']
+ fullSubstrate = options['fullSubstrate']
# untagged Any, recover header substrate
header = fullSubstrate[:-len(substrate)]
@@ -1232,7 +1233,7 @@ class Decoder(object):
)
if logger:
- logger('codec %s yields type %s, value:\n%s\n...remaining substrate is: %s' % (concreteDecoder.__class__.__name__, value.__class__.__name__, isinstance(value, base.Asn1Item) and value.prettyPrint() or repr(value), substrate and debug.hexdump(substrate) or '<none>'))
+ logger('codec %s yields type %s, value:\n%s\n...remaining substrate is: %s' % (concreteDecoder.__class__.__name__, value.__class__.__name__, isinstance(value, base.Asn1Item) and value.prettyPrint() or value, substrate and debug.hexdump(substrate) or '<none>'))
state = stStop
break
diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py
index c970726..2c5ba14 100644
--- a/pyasn1/codec/ber/encoder.py
+++ b/pyasn1/codec/ber/encoder.py
@@ -23,9 +23,9 @@ class AbstractItemEncoder(object):
if isConstructed:
encodedTag |= tag.tagFormatConstructed
if tagId < 31:
- return (encodedTag | tagId,)
+ return encodedTag | tagId,
else:
- substrate = (tagId & 0x7f,)
+ substrate = tagId & 0x7f,
tagId >>= 7
while tagId:
substrate = (0x80 | (tagId & 0x7f),) + substrate
@@ -36,7 +36,7 @@ class AbstractItemEncoder(object):
if not defMode and self.supportIndefLenMode:
return (0x80,)
if length < 0x80:
- return (length,)
+ return length,
else:
substrate = ()
while length:
@@ -398,7 +398,7 @@ class ChoiceEncoder(AbstractItemEncoder):
class AnyEncoder(OctetStringEncoder):
def encodeValue(self, value, encodeFun, **options):
- return value.asOctets(), options.get('defMode', True) == False, True
+ return value.asOctets(), not options.get('defMode', True), True
tagMap = {
diff --git a/pyasn1/codec/native/decoder.py b/pyasn1/codec/native/decoder.py
index ba9811b..70b22a8 100644
--- a/pyasn1/codec/native/decoder.py
+++ b/pyasn1/codec/native/decoder.py
@@ -38,7 +38,7 @@ class SequenceOfOrSetOfDecoder(object):
asn1Value = asn1Spec.clone()
for pyValue in pyObject:
- asn1Value.append(decodeFun(pyValue, asn1Spec.componentType.asn1Object), **options)
+ asn1Value.append(decodeFun(pyValue, asn1Spec.componentType), **options)
return asn1Value