]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
PEP8
authorSergey Matveev <stargrave@stargrave.org>
Wed, 25 Mar 2020 10:19:31 +0000 (13:19 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 25 Mar 2020 11:16:50 +0000 (14:16 +0300)
pyderasn.py
tests/test_pyderasn.py

index f611efa195369727b2a2a20455a8c5b796431389..54f2027f914df7db6d147dacde4d3daebf519a9e 100755 (executable)
@@ -1287,11 +1287,13 @@ def file_mmaped(fd):
     """
     return memoryview(mmap(fd.fileno(), 0, prot=PROT_READ))
 
+
 def pureint(value):
     if not set(value) <= DECIMALS:
         raise ValueError("non-pure integer")
     return int(value)
 
+
 def fractions2float(fractions_raw):
     pureint(fractions_raw)
     return float("0." + fractions_raw)
@@ -1304,7 +1306,7 @@ def get_def_by_path(defines_by_path, sub_decode_path):
         if len(path) != len(sub_decode_path):
             continue
         for p1, p2 in zip(path, sub_decode_path):
-            if (not p1 is any) and (p1 != p2):
+            if (p1 is not any) and (p1 != p2):
                 break
         else:
             return define
@@ -1963,7 +1965,7 @@ class Obj(object):
                     yield None
                     return
                 _decode_path, obj, tail = result
-                if not _decode_path is decode_path:
+                if _decode_path is not decode_path:
                     yield result
         else:
             try:
@@ -2005,7 +2007,7 @@ class Obj(object):
                         yield None
                         return
                     _decode_path, obj, tail = result
-                    if not _decode_path is decode_path:
+                    if _decode_path is not decode_path:
                         yield result
                 eoc_expected, tail = tail[:EOC_LEN], tail[EOC_LEN:]
                 if eoc_expected.tobytes() != EOC:
@@ -2044,7 +2046,7 @@ class Obj(object):
                         yield None
                         return
                     _decode_path, obj, tail = result
-                    if not _decode_path is decode_path:
+                    if _decode_path is not decode_path:
                         yield result
                 if obj.tlvlen < l and not ctx.get("allow_expl_oob", False):
                     raise DecodeError(
@@ -3373,7 +3375,7 @@ class BitString(Obj):
                 int2byte(0),
                 octets[offset:offset + 999],
             )))
-        tail = octets[offset+999:]
+        tail = octets[offset + 999:]
         if len(tail) > 0:
             tail = int2byte((8 - bit_len % 8) % 8) + tail
             write_full(writer, b"".join((
@@ -3833,7 +3835,7 @@ class OctetString(Obj):
                 LEN1K,
                 octets[offset:offset + 1000],
             )))
-        tail = octets[offset+1000:]
+        tail = octets[offset + 1000:]
         if len(tail) > 0:
             write_full(writer, b"".join((
                 OctetString.tag_default,
index b16c6f6cc7fd318c6534599d3887ef1415688dbc..d112a60c9a2ae7302f8dbf83afaeb5537a47e159 100644 (file)
@@ -2662,7 +2662,6 @@ class TestNull(CommonMixin, TestCase):
             repr(obj)
             list(obj.pps())
 
-
     @given(integers(min_value=1))
     def test_invalid_len(self, l):
         with self.assertRaises(InvalidLength):
@@ -6274,6 +6273,7 @@ class SeqMixing(object):
             min_size=len(_schema),
             max_size=len(_schema),
         ))]
+
         class Wahl(Choice):
             schema = (("int", Integer()),)
 
@@ -7046,6 +7046,7 @@ class TestSequenceOf(SeqOfMixing, CommonMixin, TestCase):
             schema = Integer()
             bounds = (10, 20)
         seqof = None
+
         def gen(n):
             for i in six_xrange(n):
                 yield Integer(i)
@@ -7065,6 +7066,7 @@ class TestSequenceOf(SeqOfMixing, CommonMixin, TestCase):
         class SeqOf(SequenceOf):
             schema = Integer()
             bounds = (1, float("+inf"))
+
         def gen():
             for i in six_xrange(10):
                 yield Integer(i)
@@ -7079,6 +7081,7 @@ class TestSequenceOf(SeqOfMixing, CommonMixin, TestCase):
         class SeqOf(SequenceOf):
             schema = Integer()
             bounds = (1, float("+inf"))
+
         def gen():
             for i in six_xrange(10):
                 yield Integer(i)
@@ -7613,6 +7616,7 @@ class TestDefinesByPath(TestCase):
 
     def test_remaining_data(self):
         oid = ObjectIdentifier("1.2.3")
+
         class Seq(Sequence):
             schema = (
                 ("oid", ObjectIdentifier(defines=((("tgt",), {
@@ -7630,6 +7634,7 @@ class TestDefinesByPath(TestCase):
 
     def test_remaining_data_seqof(self):
         oid = ObjectIdentifier("1.2.3")
+
         class SeqOf(SetOf):
             schema = OctetString()