From fe278e203d5696a0ddb02d87b888116a4df9519b Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Fri, 21 Sep 2018 21:43:24 -0700 Subject: ntpshmvis: pylint cleanups --- contrib/ntpshmviz | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'contrib/ntpshmviz') diff --git a/contrib/ntpshmviz b/contrib/ntpshmviz index dab9ae0a..0d46402c 100755 --- a/contrib/ntpshmviz +++ b/contrib/ntpshmviz @@ -1,7 +1,8 @@ #!/usr/bin/env python -# -# ntpshmviz - graph the drift of NTP servers -# Written by Keane Wolter +''' +ntpshmviz - graph the drift of NTP servers +Written by Keane Wolter +''' # # To do: # @@ -9,14 +10,15 @@ # 2. Allow for a continuous stream of data to be graphed # +from __future__ import absolute_import, print_function, division + import sys # need numpy for float128, normal python floats are too small to # hold a timespec import numpy try: import matplotlib.pyplot as PLT - from matplotlib.figure import Figure -except: +except ImportError: print("Please make sure matplotlib is installed properly:", sys.exc_info()[0]) sys.exit(1) @@ -24,8 +26,12 @@ except: gps_version = '3.18-dev' -class ntpOffset: +class ntpOffset(object): + "The master Class" + def __init__(self, stream): + "Initialize class ntpOffset" + # get the data self.read_data(stream) @@ -33,7 +39,7 @@ class ntpOffset: self.display() def display(self): - # display the graphs + "display the graphs" # Alert the user that closing the graphs can be done with "Ctrl-w" print ("Please note that the graph can be closed with the " @@ -61,7 +67,9 @@ class ntpOffset: PLT.show() def read_data(self, stream): - # Reads data from a ntp log file. Layout is: + "Read data from a ntp log file." + + # Layout is: # # - The keyword "sample" # - The NTP unit from which it was collected. @@ -104,13 +112,13 @@ class ntpOffset: if __name__ == "__main__": - if (len(sys.argv) >= 2): + if len(sys.argv) >= 2: if (sys.argv[1] == "-V" or sys.argv[1] == "--version"): sys.stderr.write("ntpshmviz: Version %s\n" % gps_version) sys.exit(0) if (sys.argv[1] == "-h" or sys.argv[1] == "--help"): - print (""" + print(""" Usage: | ntpshmviz [-h|--help] [-V|--version] Example: ntpshmmon -n 100 | ntpshmviz -- cgit v1.2.1