[Git][NTPsec/ntpsec][master] pep8/pyflakes fixes

Ian Bruene gitlab at mg.gitlab.com
Sun Oct 22 16:44:05 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
daaaab30 by Ian Bruene at 2017-10-22T11:43:33-05:00
pep8/pyflakes fixes

- - - - -


2 changed files:

- pylib/agentx.py
- tests/pylib/test_agentx.py


Changes:

=====================================
pylib/agentx.py
=====================================
--- a/pylib/agentx.py
+++ b/pylib/agentx.py
@@ -1255,6 +1255,7 @@ def decode_packet(data):
         parsedPkt = decoder(packetSlice, header)
     return parsedPkt, newData
 
+
 def mibTree2List(mibtree, currentPath=()):
     "Takes a tree of nested dicts representing OIDs and flattens it to a list"
     if (mibtree is None) or (mibtree == {}):
@@ -1268,19 +1269,20 @@ def mibTree2List(mibtree, currentPath=()):
         paths += mibTree2List(mibtree[branch], branchPath)
     return tuple(paths)
 
+
 def mibList2Tree(miblist, rootPath=()):
     "Takes a list of OIDs and inflates it into a tree"
     tree = {}
     for oid in miblist:
         node = oid.subids
         rootlen = len(rootPath)
-        if node[:rootlen] != rootPath:  # OID is not decended from the root, bail
-            raise ValueError("Node %s does not have root %s" % (node, rootPath))
+        if node[:rootlen] != rootPath:  # OID not decended from the root, bail
+            raise ValueError("Node %s does not have root %s" %
+                             (node, rootPath))
         node = node[rootlen:]  # clip the root off for the tree
         branch = tree
         nodePos = 0
         nodeSize = len(node)
-        maxNode = nodeSize - 1
         while nodePos < nodeSize:
             subid = node[nodePos]
             if subid not in branch:  # First time at this position


=====================================
tests/pylib/test_agentx.py
=====================================
--- a/tests/pylib/test_agentx.py
+++ b/tests/pylib/test_agentx.py
@@ -2292,10 +2292,14 @@ class TestNtpclientsNtpsnmpd(unittest.TestCase):
                            b"\x00\x00\x00\x01\x00\x00\x00\x02"
                            b"\x00\x00\x00\x03\x00\x00\x00\x34"
                            b"\x00\x01\x00\x05"
-                           b"\x02\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02"
-                           b"\x02\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04"
-                           b"\x02\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x07"
-                           b"\x02\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x09"),
+                           b"\x02\x00\x00\x00"
+                           b"\x00\x00\x00\x01\x00\x00\x00\x02"
+                           b"\x02\x00\x00\x00"
+                           b"\x00\x00\x00\x03\x00\x00\x00\x04"
+                           b"\x02\x00\x01\x00"
+                           b"\x00\x00\x00\x06\x00\x00\x00\x07"
+                           b"\x02\x00\x00\x00"
+                           b"\x00\x00\x00\x08\x00\x00\x00\x09"),
                          (x.GetBulkPDU(True, 1, 2, 3, 1, 5,
                                        (srch((1, 2), (3, 4), False),
                                         srch((6, 7), (8, 9), True))),
@@ -2483,11 +2487,11 @@ class TestNtpclientsNtpsnmpd(unittest.TestCase):
         # Test flat tree
         self.assertEqual(f((x.OID((0,)), x.OID((1,)),
                             x.OID((3,)), x.OID((4,)))),
-                         {0: None, 1: None, 3: None, 4:None})
+                         {0: None, 1: None, 3: None, 4: None})
         # Test flat tree with root path
         self.assertEqual(f((x.OID((42, 23, 0)), x.OID((42, 23, 1)),
                             x.OID((42, 23, 3)), x.OID((42, 23, 4))), (42, 23)),
-                         {0: None, 1: None, 3: None, 4:None})
+                         {0: None, 1: None, 3: None, 4: None})
         # Test nested tree
         self.assertEqual(f((x.OID((0,)),
                             x.OID((2,)), x.OID((2, 0)), x.OID((2, 1)),



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/daaaab30ab53091c32e9a1d26d290a7c58523d00

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/daaaab30ab53091c32e9a1d26d290a7c58523d00
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171022/daee187c/attachment.html>


More information about the vc mailing list