summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-12-02 11:12:42 +0000
committerBenjamin Schubert <bschubert15@bloomberg.net>2019-12-02 11:51:15 +0000
commit1064374cf19ef5492c3b6b4a23ae14c49ac8ea86 (patch)
tree687dc82b3e4111ffbc3358ba959ba17991906aff
parent069b110c866ecfd652a041d735ca6d261b8d41ba (diff)
downloadbuildstream-1064374cf19ef5492c3b6b4a23ae14c49ac8ea86.tar.gz
lint: remove all unecessary elif/else after break/continue
Newer pylint versions detect and complain about unnecessary elif/else after a continue/break/return clause. Let's remove them
-rw-r--r--src/buildstream/_artifactcache.py4
-rw-r--r--src/buildstream/_basecache.py4
-rw-r--r--src/buildstream/_stream.py2
-rw-r--r--src/buildstream/plugins/sources/tar.py2
-rw-r--r--src/buildstream/plugins/sources/zip.py2
-rw-r--r--src/buildstream/sandbox/_sandboxbwrap.py18
-rw-r--r--src/buildstream/storage/_casbaseddirectory.py4
-rw-r--r--src/buildstream/utils.py6
8 files changed, 21 insertions, 21 deletions
diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index 03c47b906..10ccf1527 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -311,8 +311,8 @@ class ArtifactCache(BaseCache):
if artifact:
element.info("Pulled artifact {} <- {}".format(display_key, remote))
break
- else:
- element.info("Remote ({}) does not have artifact {} cached".format(remote, display_key))
+
+ element.info("Remote ({}) does not have artifact {} cached".format(remote, display_key))
except CASError as e:
element.warn("Could not pull from remote {}: {}".format(remote, e))
errors.append(e)
diff --git a/src/buildstream/_basecache.py b/src/buildstream/_basecache.py
index 516119cd1..15b1d5389 100644
--- a/src/buildstream/_basecache.py
+++ b/src/buildstream/_basecache.py
@@ -315,8 +315,8 @@ class BaseCache:
if on_failure:
on_failure(remote_spec, str(err))
continue
- else:
- raise
+
+ raise
# Finally, we can instantiate the remote. Note that
# NamedTuples are hashable, so we can use them as pretty
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py
index 20e073110..c2945a2f6 100644
--- a/src/buildstream/_stream.py
+++ b/src/buildstream/_stream.py
@@ -647,7 +647,7 @@ class Stream:
if not obj._cached():
self._message(MessageType.WARN, "{} is not cached".format(ref))
continue
- elif not obj._cached_logs():
+ if not obj._cached_logs():
self._message(MessageType.WARN, "{} is cached without log files".format(ref))
continue
diff --git a/src/buildstream/plugins/sources/tar.py b/src/buildstream/plugins/sources/tar.py
index e35b52f85..fc4f5736a 100644
--- a/src/buildstream/plugins/sources/tar.py
+++ b/src/buildstream/plugins/sources/tar.py
@@ -235,7 +235,7 @@ class TarSource(DownloadableFileSource):
# Avoid considering the '.' directory, if any is included in the archive
# this is to avoid the default 'base-dir: *' value behaving differently
# depending on whether the tarball was encoded with a leading '.' or not
- elif member_name == ".":
+ if member_name == ".":
continue
yield member_name
diff --git a/src/buildstream/plugins/sources/zip.py b/src/buildstream/plugins/sources/zip.py
index 47933c8eb..47823dfde 100644
--- a/src/buildstream/plugins/sources/zip.py
+++ b/src/buildstream/plugins/sources/zip.py
@@ -162,7 +162,7 @@ class ZipSource(DownloadableFileSource):
# Avoid considering the '.' directory, if any is included in the archive
# this is to avoid the default 'base-dir: *' value behaving differently
# depending on whether the archive was encoded with a leading '.' or not
- elif member.filename == "." or member.filename == "./":
+ if member.filename == "." or member.filename == "./":
continue
yield member.filename
diff --git a/src/buildstream/sandbox/_sandboxbwrap.py b/src/buildstream/sandbox/_sandboxbwrap.py
index 1405611bc..433b0f754 100644
--- a/src/buildstream/sandbox/_sandboxbwrap.py
+++ b/src/buildstream/sandbox/_sandboxbwrap.py
@@ -493,17 +493,17 @@ class SandboxBwrap(Sandbox):
tries += 1
time.sleep(1 / 100)
continue
- else:
- # We've reached the upper limit of tries, bail out now
- # because something must have went wrong
- #
- raise
- elif e.errno == errno.ENOENT:
+
+ # We've reached the upper limit of tries, bail out now
+ # because something must have went wrong
+ #
+ raise
+ if e.errno == errno.ENOENT:
# Bubblewrap cleaned it up for us, no problem if we cant remove it
break
- else:
- # Something unexpected, reraise this error
- raise
+
+ # Something unexpected, reraise this error
+ raise
else:
# Successfully removed the symlink
break
diff --git a/src/buildstream/storage/_casbaseddirectory.py b/src/buildstream/storage/_casbaseddirectory.py
index df28dc591..f90d5c503 100644
--- a/src/buildstream/storage/_casbaseddirectory.py
+++ b/src/buildstream/storage/_casbaseddirectory.py
@@ -221,12 +221,12 @@ class CasBasedDirectory(Directory):
else:
if path == ".":
continue
- elif path == "..":
+ if path == "..":
if current_dir.parent is not None:
current_dir = current_dir.parent
# In POSIX /.. == / so just stay at the root dir
continue
- elif create:
+ if create:
current_dir = current_dir._add_directory(path)
else:
error = "'{}' not found in {}"
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 7f7bf67b2..0307b8470 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -765,7 +765,7 @@ def _pretty_size(size, dec_places=0):
for unit in units:
if psize < 1024:
break
- elif unit != units[-1]:
+ if unit != units[-1]:
psize /= 1024
return "{size:g}{unit}".format(size=round(psize, dec_places), unit=unit)
@@ -914,8 +914,8 @@ def _process_list(
# Skip this missing file
if ignore_missing:
continue
- else:
- raise UtilError("Source file is missing: {}".format(srcpath)) from e
+
+ raise UtilError("Source file is missing: {}".format(srcpath)) from e
if stat.S_ISDIR(mode):
# Ensure directory exists in destination