From: Sergey Matveev Date: Sun, 20 May 2018 15:13:44 +0000 (+0300) Subject: Remove msg kwarg for consistence X-Git-Tag: 3.7~3 X-Git-Url: http://www.git.cypherpunks.ru/?p=pyderasn.git;a=commitdiff_plain;h=32a63d6d527c2a86799231114e695d3d557f9a8f Remove msg kwarg for consistence --- diff --git a/pyderasn.py b/pyderasn.py index ee39e57..278db2c 100755 --- a/pyderasn.py +++ b/pyderasn.py @@ -914,9 +914,7 @@ class Obj(object): self.tag = getattr(self, "impl", self.tag_default) if impl is None else impl self._expl = getattr(self, "expl", None) if expl is None else expl if self.tag != self.tag_default and self._expl is not None: - raise ValueError( - "implicit and explicit tags can not be set simultaneously" - ) + raise ValueError("implicit and explicit tags can not be set simultaneously") if default is not None: optional = True self.optional = optional @@ -1058,7 +1056,7 @@ class Obj(object): eoc_expected, tail = tail[:EOC_LEN], tail[EOC_LEN:] if eoc_expected.tobytes() != EOC: raise DecodeError( - msg="no EOC", + "no EOC", decode_path=decode_path, offset=offset, ) @@ -2204,7 +2202,7 @@ class BitString(Obj): if t == self.tag_constructed: if not ctx.get("bered", False): raise DecodeError( - msg="unallowed BER constructed encoding", + "unallowed BER constructed encoding", decode_path=decode_path, offset=offset, ) @@ -2249,7 +2247,7 @@ class BitString(Obj): break if vlen > l: raise DecodeError( - msg="chunk out of bounds", + "chunk out of bounds", decode_path=len(chunks) - 1, offset=chunks[-1].offset, ) @@ -2264,7 +2262,7 @@ class BitString(Obj): ) except TagMismatch: raise DecodeError( - msg="expected BitString encoded chunk", + "expected BitString encoded chunk", decode_path=sub_decode_path, offset=sub_offset, ) @@ -2274,7 +2272,7 @@ class BitString(Obj): v = v_tail if len(chunks) == 0: raise DecodeError( - msg="no chunks", + "no chunks", decode_path=decode_path, offset=offset, ) @@ -2283,7 +2281,7 @@ class BitString(Obj): for chunk_i, chunk in enumerate(chunks[:-1]): if chunk.bit_len % 8 != 0: raise DecodeError( - msg="BitString chunk is not multiple of 8 bit", + "BitString chunk is not multiple of 8 bit", decode_path=decode_path + (str(chunk_i),), offset=chunk.offset, ) @@ -2567,7 +2565,7 @@ class OctetString(Obj): if t == self.tag_constructed: if not ctx.get("bered", False): raise DecodeError( - msg="unallowed BER constructed encoding", + "unallowed BER constructed encoding", decode_path=decode_path, offset=offset, ) @@ -2612,7 +2610,7 @@ class OctetString(Obj): break if vlen > l: raise DecodeError( - msg="chunk out of bounds", + "chunk out of bounds", decode_path=len(chunks) - 1, offset=chunks[-1].offset, ) @@ -2627,7 +2625,7 @@ class OctetString(Obj): ) except TagMismatch: raise DecodeError( - msg="expected OctetString encoded chunk", + "expected OctetString encoded chunk", decode_path=sub_decode_path, offset=sub_offset, ) @@ -2637,7 +2635,7 @@ class OctetString(Obj): v = v_tail if len(chunks) == 0: raise DecodeError( - msg="no chunks", + "no chunks", decode_path=decode_path, offset=offset, ) @@ -4706,7 +4704,7 @@ class Set(Sequence): obj._value = values if not obj.ready: raise DecodeError( - msg="not all values are ready", + "not all values are ready", klass=self.__class__, decode_path=decode_path, offset=offset,