aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-08-07 01:21:20 +0100
committerSam James <sam@gentoo.org>2023-08-07 01:21:20 +0100
commit1c44e110a44341f72ea056132dcaf3c4bfff9273 (patch)
treed42f2ee0650c33556df9b460e5a61ba346b2e9b6
parentsetup.py: update homepage (diff)
downloadmirrorselect-1c44e110a44341f72ea056132dcaf3c4bfff9273.tar.gz
mirrorselect-1c44e110a44341f72ea056132dcaf3c4bfff9273.tar.bz2
mirrorselect-1c44e110a44341f72ea056132dcaf3c4bfff9273.zip
Rerun `autopep8` with `--aggressive
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--mirrorselect/configs.py4
-rw-r--r--mirrorselect/output.py2
-rw-r--r--mirrorselect/selectors.py15
3 files changed, 8 insertions, 13 deletions
diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py
index 39dcdab..c7935d7 100644
--- a/mirrorselect/configs.py
+++ b/mirrorselect/configs.py
@@ -164,7 +164,7 @@ def get_filesystem_mirrors(output, config_path):
lex.wordchars = string.digits + letters + r"~!@#$%*_\:;?,./-+{}"
lex.quotes = "\"'"
p = re.compile("rsync://|http://|https://|ftp://", re.IGNORECASE)
- while 1:
+ while True:
key = get_token(lex)
# output.write('get_filesystem_mirrors(): processing key = %s\n' % key, 2)
@@ -181,7 +181,7 @@ def get_filesystem_mirrors(output, config_path):
mirrorlist = val.rsplit()
output.write("get_filesystem_mirrors(): mirrorlist = %s\n" % mirrorlist, 2)
for mirror in mirrorlist:
- if p.match(mirror) == None:
+ if p.match(mirror) is None:
if os.access(mirror, os.F_OK):
output.write(
"get_filesystem_mirrors(): found file system mirror = %s\n"
diff --git a/mirrorselect/output.py b/mirrorselect/output.py
index 8b33cff..87a83b2 100644
--- a/mirrorselect/output.py
+++ b/mirrorselect/output.py
@@ -53,7 +53,7 @@ def decode_selection(selection):
def get_encoding(output):
- if hasattr(output, "encoding") and output.encoding != None:
+ if hasattr(output, "encoding") and output.encoding is not None:
return output.encoding
else:
encoding = locale.getpreferredencoding()
diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py
index 60956d4..7f9fddb 100644
--- a/mirrorselect/selectors.py
+++ b/mirrorselect/selectors.py
@@ -168,8 +168,7 @@ class Shallow:
% (number, block_size, block_index, len(host_blocks))
)
- host_ranking_keys = list(ret_hosts.keys())
- host_ranking_keys.sort()
+ host_ranking_keys = sorted(ret_hosts.keys())
for rank in host_ranking_keys[:number]:
top_hosts.append(ret_hosts[rank])
@@ -283,8 +282,7 @@ class Deep:
# can't just return the dict.values,
# because we want the fastest mirror first...
- keys = list(top_hosts.keys())
- keys.sort()
+ keys = sorted(top_hosts.keys())
rethosts = []
for key in keys:
@@ -521,8 +519,7 @@ class Deep:
)
host_dict.update(dict([time_host]))
- times = list(host_dict.keys())
- times.sort()
+ times = sorted(host_dict.keys())
else: # We need to make room in the dict before we add. Kill the slowest.
self.output.write(
@@ -530,14 +527,12 @@ class Deep:
% (time_host[1], time_host[0]),
2,
)
- times = list(host_dict.keys())
- times.sort()
+ times = sorted(host_dict.keys())
self.output.write("_list_add(): removing %s\n" % host_dict[times[-1]], 2)
del host_dict[times[-1]]
host_dict.update(dict([time_host]))
# done adding. now return the appropriate time
- times = list(host_dict.keys())
- times.sort()
+ times = sorted(host_dict.keys())
if len(host_dict) < maxlen: # check again to choose new timeout
self.output.write(