You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:13:02 UTC
[buildstream] 02/07: app.py: str(e) instead of "{}".format(e)
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch aevri/provenance_scope
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit cb97a6ad5f9d620436058d5ee1efbdabcebffac5
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Fri Mar 15 14:54:31 2019 +0000
app.py: str(e) instead of "{}".format(e)
We're not implementing __format__ anywhere, so there's no reason to
prefer format() over the more conventional conversion with str().
---
buildstream/_frontend/app.py | 6 +++---
buildstream/_frontend/widget.py | 2 +-
buildstream/_stream.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py
index 329f9a2..3713e56 100644
--- a/buildstream/_frontend/app.py
+++ b/buildstream/_frontend/app.py
@@ -272,7 +272,7 @@ class App():
self._message(MessageType.FAIL, session_name, elapsed=elapsed)
# Notify session failure
- self._notify("{} failed".format(session_name), "{}".format(e))
+ self._notify("{} failed".format(session_name), str(e))
if self._started:
self._print_summary()
@@ -658,7 +658,7 @@ class App():
#
def _error_exit(self, error, prefix=None):
click.echo("", err=True)
- main_error = "{}".format(error)
+ main_error = str(error)
if prefix is not None:
main_error = "{}: {}".format(prefix, main_error)
@@ -666,7 +666,7 @@ class App():
if error.detail:
indent = " " * INDENT
detail = '\n' + indent + indent.join(error.detail.splitlines(True))
- click.echo("{}".format(detail), err=True)
+ click.echo(detail, err=True)
sys.exit(-1)
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index 15bd9cf..45be6d1 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -486,7 +486,7 @@ class LogLine(Widget):
values["Session Start"] = starttime.strftime('%A, %d-%m-%Y at %H:%M:%S')
values["Project"] = "{} ({})".format(project.name, project.directory)
values["Targets"] = ", ".join([t.name for t in stream.targets])
- values["Cache Usage"] = "{}".format(context.get_cache_usage())
+ values["Cache Usage"] = str(context.get_cache_usage())
text += self._format_values(values)
# User configurations
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index f1600a8..5b22fd1 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -548,7 +548,7 @@ class Stream():
try:
self._artifacts.remove(ref, defer_prune=True)
except CASCacheError as e:
- self._message(MessageType.WARN, "{}".format(e))
+ self._message(MessageType.WARN, str(e))
continue
self._message(MessageType.INFO, "Removed: {}".format(ref))