Skip to content

Commit 27c3929

Browse files
committed
Pylintified for neatness
1 parent accaa26 commit 27c3929

9 files changed

+216
-181
lines changed

check_sepa.py

100755100644
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@
1414
if __name__ == "__main__":
1515
LOG_LEVEL = DEFAULT_LOG_LEVEL
1616
PARSER = OptionParser()
17-
GROUP = OptionGroup(PARSER, "Verbosity Options",
17+
GROUP = OptionGroup(
18+
PARSER, "Verbosity Options",
1819
"Options to change the level of output")
19-
GROUP.add_option("-q", "--quiet", action="store_true",
20-
dest="quiet", default=False,
21-
help="Supress all but critical errors")
22-
GROUP.add_option("-v", "--verbose", action="store_true",
20+
GROUP.add_option(
21+
"-q", "--quiet", action="store_true",
22+
dest="quiet", default=False,
23+
help="Supress all but critical errors")
24+
GROUP.add_option(
25+
"-v", "--verbose", action="store_true",
2326
dest="verbose", default=False,
2427
help="Print all information available")
2528
PARSER.add_option_group(GROUP)
26-
PARSER.add_option("-c", "--config", action="store",
27-
type="string", dest="config_file",
28-
help="Config file containing database credentials")
29+
PARSER.add_option(
30+
"-c", "--config", action="store",
31+
type="string", dest="config_file",
32+
help="Config file containing database credentials")
2933
(OPTIONS, ARGS) = PARSER.parse_args()
3034
if OPTIONS.quiet:
3135
LOG_LEVEL = logging.CRITICAL
@@ -41,17 +45,19 @@
4145
DIFF = -1
4246
DIFF = DB.get_sepa_difference()
4347
if DIFF > CRITICAL_THRESHOLD:
44-
print("CRITICAL: No data for more than %d minutes" %
48+
print(
49+
"CRITICAL: No data for more than %d minutes" %
4550
CRITICAL_THRESHOLD)
4651
exit(2)
4752
elif DIFF > WARN_THRESHOLD:
48-
print("WARNING: No data for more than %d minutes" %
53+
print(
54+
"WARNING: No data for more than %d minutes" %
4955
WARN_THRESHOLD)
5056
exit(1)
5157
elif DIFF >= 0:
52-
print("OK: Latest data is %d minutes old" % DIFF)
58+
print "OK: Latest data is %d minutes old" % DIFF
5359
exit(0)
5460
else:
55-
print("UNKNOWN: Unable to get difference")
61+
print "UNKNOWN: Unable to get difference"
5662
exit(3)
5763

check_wunderground.py

100755100644
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@
1414
if __name__ == "__main__":
1515
LOG_LEVEL = DEFAULT_LOG_LEVEL
1616
PARSER = OptionParser()
17-
GROUP = OptionGroup(PARSER, "Verbosity Options",
17+
GROUP = OptionGroup(
18+
PARSER, "Verbosity Options",
1819
"Options to change the level of output")
19-
GROUP.add_option("-q", "--quiet", action="store_true",
20-
dest="quiet", default=False,
21-
help="Supress all but critical errors")
22-
GROUP.add_option("-v", "--verbose", action="store_true",
20+
GROUP.add_option(
21+
"-q", "--quiet", action="store_true",
22+
dest="quiet", default=False,
23+
help="Supress all but critical errors")
24+
GROUP.add_option(
25+
"-v", "--verbose", action="store_true",
2326
dest="verbose", default=False,
2427
help="Print all information available")
2528
PARSER.add_option_group(GROUP)
26-
PARSER.add_option("-c", "--config", action="store",
27-
type="string", dest="config_file",
28-
help="Config file containing database credentials")
29+
PARSER.add_option(
30+
"-c", "--config", action="store",
31+
type="string", dest="config_file",
32+
help="Config file containing database credentials")
2933
(OPTIONS, ARGS) = PARSER.parse_args()
3034
if OPTIONS.quiet:
3135
LOG_LEVEL = logging.CRITICAL
@@ -41,17 +45,19 @@
4145
DIFF = -1
4246
DIFF = DB.get_wunderground_difference()
4347
if DIFF > CRITICAL_THRESHOLD:
44-
print("CRITICAL: No data for more than %d minutes" %
48+
print(
49+
"CRITICAL: No data for more than %d minutes" %
4550
CRITICAL_THRESHOLD)
4651
exit(2)
4752
elif DIFF > WARN_THRESHOLD:
48-
print("WARNING: No data for more than %d minutes" %
53+
print(
54+
"WARNING: No data for more than %d minutes" %
4955
WARN_THRESHOLD)
5056
exit(1)
5157
elif DIFF >= 0:
52-
print("OK: Latest data is %d minutes old" % DIFF)
58+
print"OK: Latest data is %d minutes old" % DIFF
5359
exit(0)
5460
else:
55-
print("UNKNOWN: Unable to get difference")
61+
print"UNKNOWN: Unable to get difference"
5662
exit(3)
5763

db.ini.default

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
database=MyDatabase
2-
user=Username
3-
pass=123456
4-
server=localhost
1+
database=feshie
2+
user=feshie
3+
pass="lT#sN9Z!yf"
4+
server=env.ecs.soton.ac.uk

feshie_reading.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
import logging
2-
import protocol_buffers.readings_pb2 as readings
31
from math import atan2, sqrt, pi, pow
42

53
def printReading(reading):
6-
print ("Time: %s" % reading.time)
7-
print ("Temp: %i" % reading.temp)
8-
print("Batv: %i" % reading.batt)
4+
print "Time: %s" % reading.time
5+
print "Temp: %i" % reading.temp
6+
print "Batv: %i" % reading.batt
97
pitch, roll = convert_accel(
108
reading.accX, reading.accY, reading.accZ)
11-
print("Accel: %.2f,%.2f"% (round(pitch,2), round(roll,2)))
9+
print "Accel: %.2f,%.2f"% (round(pitch, 2), round(roll, 2))
1210
if reading.HasField("ADC1"):
13-
print("ADC1: %i" % reading.ADC1)
11+
print "ADC1: %i" % reading.ADC1
1412
if reading.HasField("ADC2"):
15-
print("ADC2: %i" % reading.ADC2)
13+
print "ADC2: %i" % reading.ADC2
1614
if reading.HasField("rain"):
17-
print("Rain: %i" % reading.rain)
15+
print "Rain: %i" % reading.rain
1816
if reading.HasField("AVR"):
19-
print("Have %i bytes of AVR data" % len(reading.AVR))
17+
print "Have %i bytes of AVR data" % len(reading.AVR)
2018

2119

2220
def convert_accel(x, y, z):
2321
pitch = atan2(y, z) * 180 / pi
24-
roll = atan2(x, sqrt(pow(y,2) + pow(z,2))) * 180 / pi
22+
roll = atan2(x, sqrt(pow(y, 2) + pow(z, 2))) * 180 / pi
2523
return (pitch, roll)

0 commit comments

Comments
 (0)