[Git][NTPsec/ntpsec][master] PEP8: whitespace cleanup

Matt Selsky gitlab at mg.gitlab.com
Sun Dec 3 04:17:04 UTC 2017


Matt Selsky pushed to branch master at NTPsec / ntpsec


Commits:
95d4d081 by Matt Selsky at 2017-12-02T23:03:18-05:00
PEP8: whitespace cleanup

ntpclients/ntpviz.py:61:15: W291 trailing whitespace
ntpclients/ntpviz.py:64:16: W291 trailing whitespace
ntpclients/ntpviz.py:66:5: E301 expected 1 blank line, found 0
pylib/agentx.py:111:1: E302 expected 2 blank lines, found 0
pylib/agentx.py:112:1: E302 expected 2 blank lines, found 0
pylib/agentx.py:1349:1: E302 expected 2 blank lines, found 1
pylib/statfiles.py:195:1: W293 blank line contains whitespace
pylib/statfiles.py:204:5: E303 too many blank lines (2)
tests/pylib/test_agentx.py:2522:27: E203 whitespace before ':'
tests/wscript:4:1: E302 expected 2 blank lines, found 1

- - - - -


10 changed files:

- ntpclients/ntplogtemp.py
- ntpclients/ntpmon.py
- ntpclients/ntpq.py
- ntpclients/ntpviz.py
- pylib/agentx.py
- pylib/statfiles.py
- pylib/util.py
- tests/pylib/test_agentx.py
- tests/wscript
- wafhelpers/fix_python_config.py


Changes:

=====================================
ntpclients/ntplogtemp.py
=====================================
--- a/ntpclients/ntplogtemp.py
+++ b/ntpclients/ntplogtemp.py
@@ -183,6 +183,7 @@ class Temper:
 
 class ZoneTemp:
     "Zone sensors"
+
     def __init__(self):
         base_dir = '/sys/class/thermal/thermal_zone?/'
         self.zones = []


=====================================
ntpclients/ntpmon.py
=====================================
--- a/ntpclients/ntpmon.py
+++ b/ntpclients/ntpmon.py
@@ -160,6 +160,7 @@ filtdisp   = %(filtdisp)s
 
 class Fatal(Exception):
     "Unrecoverable error."
+
     def __init__(self, msg):
         Exception.__init__(self)
         self.msg = msg


=====================================
ntpclients/ntpq.py
=====================================
--- a/ntpclients/ntpq.py
+++ b/ntpclients/ntpq.py
@@ -137,6 +137,7 @@ NTP_FLOAT = 0xa   # Float value
 
 class Ntpq(cmd.Cmd):
     "ntpq command interpreter"
+
     def __init__(self, session):
         cmd.Cmd.__init__(self)
         self.session = session


=====================================
ntpclients/ntpviz.py
=====================================
--- a/ntpclients/ntpviz.py
+++ b/ntpclients/ntpviz.py
@@ -58,11 +58,12 @@ ntpviz: can't find the Python argparse module
 
 if sys.version_info[0] == 2:
     import codecs
-    import sys  
+    import sys
 
     # force UTF-8 strings, otherwise some systems crash on micro.
-    reload(sys)  
+    reload(sys)
     sys.setdefaultencoding('utf8')
+
     def open(file, mode='r', buffering=-1, encoding=None, errors=None):
         return codecs.open(filename=file, mode=mode, encoding=encoding,
             errors=errors, buffering=buffering)


=====================================
pylib/agentx.py
=====================================
--- a/pylib/agentx.py
+++ b/pylib/agentx.py
@@ -108,7 +108,11 @@ class ParseError(Exception):
 
 
 class ParseDataLengthError(ParseError): pass
+
+
 class ParseVersionError(ParseError): pass
+
+
 class ParsePDUTypeError(ParseError): pass
 
 
@@ -1346,6 +1350,7 @@ def bits2Bools(bitString, cropLength=None):
         bits = bits[:cropLength]
     return bits
 
+
 def bools2Bits(bits):
     bitCounter = 0
     octets = []


=====================================
pylib/statfiles.py
=====================================
--- a/pylib/statfiles.py
+++ b/pylib/statfiles.py
@@ -192,7 +192,7 @@ class NTPStats:
             # Morph first fields into Unix time with fractional seconds
             # ut into nice dictionary of dictionary rows
             lines1 = NTPStats.unixize(lines, self.starttime, self.endtime)
-            
+
         # Sort by datestamp
         # by default, a tuple sort()s on the 1st item, which is a nice
         # integer of milli seconds.  This is faster than using
@@ -200,7 +200,6 @@ class NTPStats:
         lines1.sort()
         return lines1
 
-
     def peersplit(self):
         "Return a dictionary mapping peerstats IPs to entry subsets."
         "This is very expensive, so cache the result"


=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -531,6 +531,7 @@ def monoclock():
 
 class Cache:
     "Simple time-based cache"
+
     def __init__(self, defaultTimeout=300):  # 5 min default TTL
         self.defaultTimeout = defaultTimeout
         self._cache = {}
@@ -610,6 +611,7 @@ def termsize():
 
 class PeerStatusWord:
     "A peer status word from readstats(), dissected for display"
+
     def __init__(self, status, pktversion=ntp.magic.NTP_VERSION):
         # Event
         self.event = ntp.control.CTL_PEER_EVENT(status)
@@ -1129,6 +1131,7 @@ class PeerSummary:
 
 class MRUSummary:
     "Reusable class for MRU entry summary generation."
+
     def __init__(self, showhostnames, wideremote=False,
                  debug=0, logfp=sys.stderr):
         self.debug = debug


=====================================
tests/pylib/test_agentx.py
=====================================
--- a/tests/pylib/test_agentx.py
+++ b/tests/pylib/test_agentx.py
@@ -2519,14 +2519,14 @@ class TestNtpclientsNtpsnmpd(unittest.TestCase):
                           (x.OID((23, 1, 1, 42)), None, None),
                           (x.OID((23, 5)), None, None)))
         # subid lambda for dynamic tree testing
-        submaker = (lambda : {0: {"reader": None, "writer": None,
-                                  "static": True, "subids": None},
-                              1: {"reader": None, "writer": None,
-                                  "static": True, "subids":
-                                  {0: {"reader": None, "writer": None,
-                                       "static": True, "subids": None}}},
-                              2: {"reader": None, "writer": None,
-                                  "static": True, "subids": None}})
+        submaker = (lambda: {0: {"reader": None, "writer": None,
+                                 "static": True, "subids": None},
+                             1: {"reader": None, "writer": None,
+                                 "static": True, "subids":
+                                 {0: {"reader": None, "writer": None,
+                                      "static": True, "subids": None}}},
+                             2: {"reader": None, "writer": None,
+                                 "static": True, "subids": None}})
         # Test tree with dynamic nodes
         self.assertEqual(tuple(f({0: {"reader": None, "writer": None,
                                       "static": True, "subids": None},


=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -1,6 +1,7 @@
 import os
 from waflib import Utils  # pylint: disable=import-error
 
+
 def build(ctx):
     srcnode = ctx.srcnode.abspath()
     testsrc = ctx.srcnode.make_node('tests')


=====================================
wafhelpers/fix_python_config.py
=====================================
--- a/wafhelpers/fix_python_config.py
+++ b/wafhelpers/fix_python_config.py
@@ -53,6 +53,7 @@ from waflib.Logs import pprint  # pylint: disable=import-error
 
 class FixConfig(object):
     """Methods and state for working around waf's python-config bugs."""
+
     def __init__(self, conf):
         """Initialize state from conf object."""
         self.conf = conf



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

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/95d4d08108605abff53c4378eedafa1a71fce352
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/20171203/0c97963a/attachment.html>


More information about the vc mailing list