1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

Fix python style issues reported by flake8

Additionally some python2-only "print" statements are now compatible
with python3.
This commit is contained in:
Lars Kruse 2019-12-18 00:25:39 +01:00
parent 73f885e382
commit 7063330e03
17 changed files with 102 additions and 103 deletions

View file

@ -3,7 +3,7 @@
import os
import re
import sys
import urllib
from urllib.request import urlopen
url = 'http://www.weather.com/weather/today/%s'
@ -19,7 +19,7 @@ if not code:
elif len(sys.argv) == 2 and sys.argv[1] == "autoconf":
print("yes")
elif len(sys.argv) == 2 and sys.argv[1] == "config":
u = urllib.urlopen(url % code)
u = urlopen(url % code)
txt = u.read()
u.close()
@ -39,7 +39,7 @@ elif len(sys.argv) == 2 and sys.argv[1] == "config":
print('graph_args --base 1000 -l 0')
else:
u = urllib.urlopen(url % code)
u = urlopen(url % code)
txt = u.read()
u.close()
@ -53,7 +53,7 @@ else:
if len(TMP_F_list):
TMP_F = TMP_F_list[0]
TMP_C = (int(TMP_F) - 32) * 5/9
TMP_C = (int(TMP_F) - 32) * 5 / 9
else:
sys.exit(1)

View file

@ -21,7 +21,7 @@ url = 'http://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT'
re_hpa = re.compile(r'Pressure.*\((\d+) hPa\)')
code = sys.argv[0][(sys.argv[0].rfind('_')+1):]
code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
if not code:
sys.exit(1)
elif len(sys.argv) == 2 and sys.argv[1] == "autoconf":

View file

@ -21,7 +21,7 @@ url = 'http://tgftp.nws.noaa.gov/data/observations/metar/decoded/%s.TXT'
re_C = re.compile(r'Temperature:.*\((-?\d+\.?\d?) C\)')
re_DewC = re.compile(r'Dew.*\((-?\d+\.?\d?) C\)')
code = sys.argv[0][(sys.argv[0].rfind('_')+1):]
code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
if not code: