[Git][NTPsec/ntpsec][master] 4 commits: cpu-temp-log: confirm to pep8

Gary E. Miller gitlab at mg.gitlab.com
Tue Jan 3 05:21:35 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
bafe62de by Gary E. Miller at 2017-01-02T21:16:30-08:00
cpu-temp-log: confirm to pep8

- - - - -
85fc66d0 by Gary E. Miller at 2017-01-02T21:19:19-08:00
smartctl-temp-log: conform to pep8

- - - - -
8b093836 by Gary E. Miller at 2017-01-02T21:20:37-08:00
temper-temp-log: confirm to pep8

- - - - -
dd59a3c4 by Gary E. Miller at 2017-01-02T21:21:06-08:00
zone-temp-log: confirm to pep8

- - - - -


4 changed files:

- contrib/cpu-temp-log
- contrib/smartctl-temp-log
- contrib/temper-temp-log
- contrib/zone-temp-log


Changes:

=====================================
contrib/cpu-temp-log
=====================================
--- a/contrib/cpu-temp-log
+++ b/contrib/cpu-temp-log
@@ -37,27 +37,30 @@ temperatures will be hardware specific.
 """
 
 
-import sys, re, time, subprocess
+import sys
+import re
+import time
+import subprocess
 
 try:
-    output = subprocess.check_output(["sensors", "-u"], universal_newlines=True)
+    output = subprocess.check_output(["sensors", "-u"],
+                                     universal_newlines=True)
 except:
     print("Unable to run 'sensors -u'")
     exit(0)
 
-lines = output.split( '\n' )
+lines = output.split('\n')
 
 # this regex matches temperature output lines from 'sensors -u'
 pat = re.compile('^\s+temp\d+_input:\s+([\d\.]+).*$')
 
 now = int(time.time())
 
-#lines = sys.stdin.readlines()
 line = ''
 index = 0
 for line in lines:
-    match = pat.match( line )
+    match = pat.match(line)
     if match and match.group(1):
         temp = match.group(1)
-        sys.stdout.write( '%d LM%d %s\n' % (now, index, temp))
+        sys.stdout.write('%d LM%d %s\n' % (now, index, temp))
         index += 1


=====================================
contrib/smartctl-temp-log
=====================================
--- a/contrib/smartctl-temp-log
+++ b/contrib/smartctl-temp-log
@@ -38,7 +38,10 @@ temperatures will be hardware specific.
 """
 
 
-import re, subprocess, sys, time
+import re
+import subprocess
+import sys
+import time
 
 # check for device on command line, otherwise use /dev/sda
 device = '/dev/sda'
@@ -47,31 +50,30 @@ if 1 < len(sys.argv):
     device = sys.argv[1]
 
 try:
-    output = subprocess.check_output(["smartctl", "-a", device], \
-        stderr=subprocess.STDOUT, \
-        universal_newlines=True)
+    output = subprocess.check_output(["smartctl", "-a", device],
+                                     stderr=subprocess.STDOUT,
+                                     universal_newlines=True)
 
 except subprocess.CalledProcessError as e:
-    sys.stderr.write( "ERROR: 'smartctl -a %s' failed\n" % device)
-    sys.stderr.write( e.output )
-    sys.stderr.write( "Return code: %s\n" % e.returncode )
+    sys.stderr.write("ERROR: 'smartctl -a %s' failed\n" % device)
+    sys.stderr.write(e.output)
+    sys.stderr.write("Return code: %s\n" % e.returncode)
     raise SystemExit(2)
 except OSError as e:
     sys.stderr.write("ERROR: Could not start smartctl: %s\n" % e.strerror)
     raise SystemExit(2)
 
 
-lines = output.split( '\n' )
+lines = output.split('\n')
 
 # this regex matches temperature output lines from 'sensors -u'
 pat = re.compile('194 Temperature_Celsius\s+\S+\s+(\d+)\s+')
 
 now = int(time.time())
 
-#lines = sys.stdin.readlines()
 line = ''
 for line in lines:
-    match = pat.match( line )
+    match = pat.match(line)
     if match and match.group(1):
         temp = match.group(1)
-        sys.stdout.write( '%d SMART %s\n' % (now, temp))
+        sys.stdout.write('%d SMART %s\n' % (now, temp))


=====================================
contrib/temper-temp-log
=====================================
--- a/contrib/temper-temp-log
+++ b/contrib/temper-temp-log
@@ -30,15 +30,17 @@ Sample crontab usage:
 
 from __future__ import print_function
 
-import time, subprocess
+import time
+import subprocess
 
-output = subprocess.check_output(["temper-poll", "-c"], universal_newlines=True)
+output = subprocess.check_output(["temper-poll", "-c"],
+                                 universal_newlines=True)
 
 now = int(time.time())
 
 try:
-    temp = float( output )
-    print( str(now) + ' TEMPER ' + str(temp))
+    temp = float(output)
+    print(str(now) + ' TEMPER ' + str(temp))
 except:
     # bad data, ignore it
     raise SystemExit(1)


=====================================
contrib/zone-temp-log
=====================================
--- a/contrib/zone-temp-log
+++ b/contrib/zone-temp-log
@@ -46,4 +46,3 @@ while True:
         print('{0} ZONE{1} {2}'.format(now, zone, temp))
     f.close()
     zone = zone + 1
-



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/e0cd3f4a0bece01a0c3554518f1a3dfeef9e93b0...dd59a3c4dd40e0218d3d338a813f1fd92bc8374d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170103/0f70f662/attachment.html>


More information about the vc mailing list