aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2020-07-29 11:27:16 -0700
committerZac Medico <zmedico@gentoo.org>2020-07-29 21:05:06 -0700
commit709826c0896120e8b3d9995d71678c0b9b290e4c (patch)
treea1864886deaa849c8391dbc4427a2b6ede74a589 /lib/portage/_emirrordist/FetchTask.py
parentSilence 'mixed-indentation' warning. (diff)
downloadportage-709826c0896120e8b3d9995d71678c0b9b290e4c.tar.gz
portage-709826c0896120e8b3d9995d71678c0b9b290e4c.tar.bz2
portage-709826c0896120e8b3d9995d71678c0b9b290e4c.zip
Fix R1705.
The codebase appears to have this pattern like: if foo == bar: return a elif foo == baz: return b else: return c This can often be rewritten as: if foo == bar: return a if foo == baz: return b return c Closes: https://github.com/gentoo/portage/pull/592 Signed-off-by: Alec Warner <antarus@gentoo.org> Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/portage/_emirrordist/FetchTask.py')
-rw-r--r--lib/portage/_emirrordist/FetchTask.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/portage/_emirrordist/FetchTask.py b/lib/portage/_emirrordist/FetchTask.py
index f2cf2aa20..f2342362d 100644
--- a/lib/portage/_emirrordist/FetchTask.py
+++ b/lib/portage/_emirrordist/FetchTask.py
@@ -230,12 +230,11 @@ class FetchTask(CompositeTask):
if self._fs_mirror_stack:
self._fetch_fs(self._fs_mirror_stack.pop())
return
- else:
- uri = self._next_uri()
- if uri is not None:
- self._tried_uris.add(uri)
- self._fetch_uri(uri)
- return
+ uri = self._next_uri()
+ if uri is not None:
+ self._tried_uris.add(uri)
+ self._fetch_uri(uri)
+ return
if self._tried_uris:
msg = "all uris failed"
@@ -350,14 +349,14 @@ class FetchTask(CompositeTask):
self.returncode = os.EX_OK
self.wait()
return
- else:
- self._start_task(
- FileCopier(src_path=src, dest_path=dest,
- background=(self.background and
- self._log_path is not None),
- logfile=self._log_path),
- self._fs_mirror_copier_exit)
- return
+
+ self._start_task(
+ FileCopier(src_path=src, dest_path=dest,
+ background=(self.background and
+ self._log_path is not None),
+ logfile=self._log_path),
+ self._fs_mirror_copier_exit)
+ return
self._try_next_mirror()
@@ -598,11 +597,10 @@ class FetchTask(CompositeTask):
def _select_hash(self):
if default_hash_name in self.digests:
return default_hash_name
- else:
- for hash_name in self.digests:
- if hash_name != "size" and \
- hash_name in portage.checksum.get_valid_checksum_keys():
- return hash_name
+ for hash_name in self.digests:
+ if hash_name != "size" and \
+ hash_name in portage.checksum.get_valid_checksum_keys():
+ return hash_name
return None