summaryrefslogtreecommitdiff
path: root/contrib/ntpshmviz
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-21 21:43:24 -0700
committerGary E. Miller <gem@rellim.com>2018-09-21 21:43:24 -0700
commitfe278e203d5696a0ddb02d87b888116a4df9519b (patch)
treea3cb2e2ac3a785a312395b266bf0c073dd66a9f5 /contrib/ntpshmviz
parent130c97e64cd4d55d2227d9434732868896ec43d4 (diff)
downloadgpsd-fe278e203d5696a0ddb02d87b888116a4df9519b.tar.gz
ntpshmvis: pylint cleanups
Diffstat (limited to 'contrib/ntpshmviz')
-rwxr-xr-xcontrib/ntpshmviz28
1 files changed, 18 insertions, 10 deletions
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 <daemoneye2@gmail.com>
+'''
+ntpshmviz - graph the drift of NTP servers
+Written by Keane Wolter <daemoneye2@gmail.com>
+'''
#
# 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: <input stream> | ntpshmviz [-h|--help] [-V|--version]
Example: ntpshmmon -n 100 | ntpshmviz