fix flake8

This commit is contained in:
ewwink 2018-07-30 16:45:30 +07:00
parent bd18a593f1
commit d51941f492
1 changed files with 12 additions and 13 deletions

View File

@ -1588,10 +1588,10 @@ class Speedtest(object):
for k in servers: for k in servers:
if len(servers[k]) > 1: if len(servers[k]) > 1:
for srv in servers[k]: for srv in servers[k]:
if value in srv[key].lower(): if value.lower() in srv[key].lower():
filteredServer.append(srv) filteredServer.append(srv)
else: else:
if value in servers[k][0][key].lower(): if value.lower() in servers[k][0][key].lower():
filteredServer.append(servers[k][0]) filteredServer.append(servers[k][0])
if not filteredServer: if not filteredServer:
print_('No server available for this criteria') print_('No server available for this criteria')
@ -1681,16 +1681,16 @@ def parse_args():
parser.add_argument('--server', type=PARSER_TYPE_INT, action='append', parser.add_argument('--server', type=PARSER_TYPE_INT, action='append',
help='Specify a server ID to test against. Can be ' help='Specify a server ID to test against. Can be '
'supplied multiple times') 'supplied multiple times')
parser.add_argument('--country', type=str.lower, parser.add_argument('--country', type=str,
help='Select the best server matching country name') help='Select the best server matching country name')
parser.add_argument('--cc', type=str.lower, parser.add_argument('--cc', type=str,
help='Select the best server matching country code' help='Select the best server matching country code'
'valid input 2-letter country codes') 'valid input 2-letter country codes')
parser.add_argument('--city', type=str.lower, parser.add_argument('--city', type=str,
help='Select the best server matching city name') help='Select the best server matching city name')
parser.add_argument('--sponsor', type=str.lower, parser.add_argument('--sponsor', type=str,
help='Select the best server matching sponsor name') help='Select the best server matching sponsor name')
parser.add_argument('--host', type=str.lower, parser.add_argument('--host', type=str,
help='Select the best server matching host name') help='Select the best server matching host name')
parser.add_argument('--exclude', type=PARSER_TYPE_INT, action='append', parser.add_argument('--exclude', type=PARSER_TYPE_INT, action='append',
help='Exclude a server from selection. Can be ' help='Exclude a server from selection. Can be '
@ -1886,7 +1886,6 @@ def shell():
filteredServers = speedtest.filter_server("host", args.host) filteredServers = speedtest.filter_server("host", args.host)
else: else:
printer('Selecting best server based on ping...', quiet) printer('Selecting best server based on ping...', quiet)
if args.country or args.cc or args.city or args.sponsor or args.host: if args.country or args.cc or args.city or args.sponsor or args.host:
speedtest.get_best_server(filteredServers) speedtest.get_best_server(filteredServers)
else: else: