fix flake8 complaints

This commit is contained in:
kingy444 2017-11-22 18:04:04 +11:00 committed by GitHub
parent 0bf7498fee
commit a1b07c569c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

@ -712,7 +712,7 @@ class SpeedtestResults(object):
def csv(self, delimiter=','): def csv(self, delimiter=','):
"""Return data in CSV format""" """Return data in CSV format"""
data = self.dict() data = self.dict()
out = StringIO() out = StringIO()
writer = csv.writer(out, delimiter=delimiter, lineterminator='') writer = csv.writer(out, delimiter=delimiter, lineterminator='')
@ -725,16 +725,16 @@ class SpeedtestResults(object):
def csvShare(self, delimiter=','): def csvShare(self, delimiter=','):
"""Return data in CSV format""" """Return data in CSV format"""
shareInfo = self.share() shareInfo = self.share()
data = self.dict() data = self.dict()
out = StringIO() out = StringIO()
writer = csv.writer(out, delimiter=delimiter, lineterminator='') writer = csv.writer(out, delimiter=delimiter, lineterminator='')
row = [data['server']['id'], data['server']['sponsor'], row = [data['server']['id'], data['server']['sponsor'],
data['server']['name'], data['timestamp'], data['server']['name'], data['timestamp'],
data['server']['d'], data['ping'], data['download'], data['server']['d'], data['ping'], data['download'],
data['upload'],shareInfo] data['upload'], shareInfo]
writer.writerow([to_utf8(v) for v in row]) writer.writerow([to_utf8(v) for v in row])
return out.getvalue() return out.getvalue()
@ -939,7 +939,7 @@ class Speedtest(object):
d = distance(self.lat_lon, d = distance(self.lat_lon,
(float(attrib.get('lat')), (float(attrib.get('lat')),
float(attrib.get('lon')))) float(attrib.get('lon'))))
except: except BaseException:
continue continue
attrib['d'] = d attrib['d'] = d
@ -989,7 +989,7 @@ class Speedtest(object):
for ext in ['php', 'asp', 'aspx', 'jsp']: for ext in ['php', 'asp', 'aspx', 'jsp']:
try: try:
f = urlopen('%s/speedtest/upload.%s' % (url, ext)) f = urlopen('%s/speedtest/upload.%s' % (url, ext))
except: except BaseException:
pass pass
else: else:
data = f.read().strip().decode() data = f.read().strip().decode()
@ -1292,8 +1292,8 @@ def parse_args():
help='Single character delimiter to use in CSV ' help='Single character delimiter to use in CSV '
'output. Default ","') 'output. Default ","')
parser.add_argument('--csv-header', action='store_true', default=False, parser.add_argument('--csv-header', action='store_true', default=False,
help='Print CSV headers, add --share if you intend on that' help='Print CSV headers, add --share if you intend '
'output format') 'on that output format')
parser.add_argument('--json', action='store_true', default=False, parser.add_argument('--json', action='store_true', default=False,
help='Suppress verbose output, only show basic ' help='Suppress verbose output, only show basic '
'information in JSON format. Speeds listed in ' 'information in JSON format. Speeds listed in '