From 1f39c63ca8f18291b43ad0dd0a007e3951b0557d Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Tue, 21 Nov 2017 00:22:28 +0900 Subject: Removing unneeded str() statements in "{}".format() statements Since these changes were effected in 3b17762a4cab23c238762ca32baa348788347473, these stringifications are now implied and no longer needed. --- buildstream/_frontend/main.py | 8 ++++---- buildstream/_loader.py | 4 ++-- buildstream/_yaml.py | 6 +++--- buildstream/plugins/sources/git.py | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py index 63051af66..e345b268c 100644 --- a/buildstream/_frontend/main.py +++ b/buildstream/_frontend/main.py @@ -499,7 +499,7 @@ def shell(app, element, sysroot, build, command): sys.exit(exitcode) except BstError as e: click.echo("") - click.echo("Errors shelling into this pipeline: {}".format(str(e))) + click.echo("Errors shelling into this pipeline: {}".format(e)) sys.exit(-1) @@ -776,7 +776,7 @@ class App(): self.context = Context(self.main_options['option']) self.context.load(config) except BstError as e: - click.echo("Error loading user configuration: {}".format(str(e))) + click.echo("Error loading user configuration: {}".format(e)) sys.exit(-1) # Override things in the context from our command line options, @@ -834,7 +834,7 @@ class App(): try: self.project = Project(directory, self.context) except BstError as e: - click.echo("Error loading project: {}".format(str(e))) + click.echo("Error loading project: {}".format(e)) sys.exit(-1) try: @@ -847,7 +847,7 @@ class App(): remote_ticker=self.remote_ticker, cache_ticker=self.cache_ticker) except BstError as e: - click.echo("Error loading pipeline: {}".format(str(e))) + click.echo("Error loading pipeline: {}".format(e)) sys.exit(-1) # Create our status printer, only available in interactive diff --git a/buildstream/_loader.py b/buildstream/_loader.py index f086625d5..39feeeb06 100644 --- a/buildstream/_loader.py +++ b/buildstream/_loader.py @@ -155,7 +155,7 @@ def extract_depends_from_node(owner, data): provenance = _yaml.node_get_provenance(dep, key=Symbol.TYPE) raise LoadError(LoadErrorReason.INVALID_DATA, "{}: Dependency type '{}' is not 'build', 'runtime' or 'all'" - .format(str(provenance), dep_type)) + .format(provenance, dep_type)) filename = _yaml.node_get(dep, str, Symbol.FILENAME) dependency = Dependency(owner, filename, filename=filename, @@ -167,7 +167,7 @@ def extract_depends_from_node(owner, data): raise LoadError(LoadErrorReason.INVALID_DATA, "{}: List '{}' element {:d} is not a list or dict" - .format(str(provenance), Symbol.DEPENDS, index)) + .format(provenance, Symbol.DEPENDS, index)) output_deps.append(dependency) diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py index eb6719360..6b1464272 100644 --- a/buildstream/_yaml.py +++ b/buildstream/_yaml.py @@ -326,7 +326,7 @@ def node_get(node, expected_type, key, indices=[], default_value=None): provenance = node_get_provenance(node) if value is None: raise LoadError(LoadErrorReason.INVALID_DATA, - "{}: Dictionary did not contain expected key '{}'".format(str(provenance), key)) + "{}: Dictionary did not contain expected key '{}'".format(provenance, key)) path = key if indices: @@ -360,7 +360,7 @@ def node_get(node, expected_type, key, indices=[], default_value=None): provenance = node_get_provenance(node, key=key, indices=indices) raise LoadError(LoadErrorReason.INVALID_DATA, "{}: Value of '{}' is not of the expected type '{}'" - .format(str(provenance), path, expected_type.__name__)) + .format(provenance, path, expected_type.__name__)) # Trim it at the bud, let all loaded strings from yaml be stripped of whitespace if isinstance(value, str): @@ -755,7 +755,7 @@ def composite(target, source): except CompositeTypeError as e: error_prefix = "" if source_provenance: - error_prefix = "{}: ".format(str(source_provenance)) + error_prefix = "{}: ".format(source_provenance) raise LoadError(LoadErrorReason.ILLEGAL_COMPOSITE, "{}Expected '{}' type for configuration '{}', instead received '{}'" .format(error_prefix, diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index 4aca57ffb..c1e40e506 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -105,7 +105,7 @@ class GitMirror(): shutil.move(tmpdir, self.mirror) except (shutil.Error, OSError) as e: raise SourceError("{}: Failed to move cloned git repository {} from '{}' to '{}'" - .format(str(self.source), self.url, tmpdir, self.mirror)) from e + .format(self.source, self.url, tmpdir, self.mirror)) from e def fetch(self): self.source.call([self.source.host_git, 'fetch', 'origin', '--prune'], @@ -127,7 +127,7 @@ class GitMirror(): def assert_ref(self): if not self.has_ref(): raise SourceError("{}: expected ref '{}' was not found in git repository: '{}'" - .format(str(self.source), self.ref, self.url)) + .format(self.source, self.ref, self.url)) def latest_commit(self, tracking): _, output = self.source.check_output( @@ -213,13 +213,13 @@ class GitMirror(): # fail if the commit hash is invalid if len(submodule_commit) != 40: raise SourceError("{}: Error reading commit information for submodule '{}'" - .format(str(self.source), submodule)) + .format(self.source, submodule)) return submodule_commit else: raise SourceError("{}: Failed to read commit information for submodule '{}'" - .format(str(self.source), submodule)) + .format(self.source, submodule)) class GitSource(Source): -- cgit v1.2.1