From ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Sat, 11 Mar 2023 06:46:20 +0000 Subject: Format codebase with black and check formatting in CQ Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger Tested-by: Gavin Mak Commit-Queue: Gavin Mak --- error.py | 130 +++++++++++++++++++++++++++++---------------------------------- 1 file changed, 60 insertions(+), 70 deletions(-) (limited to 'error.py') diff --git a/error.py b/error.py index cbefcb7e..3cf34d54 100644 --- a/error.py +++ b/error.py @@ -14,122 +14,112 @@ class ManifestParseError(Exception): - """Failed to parse the manifest file. - """ + """Failed to parse the manifest file.""" class ManifestInvalidRevisionError(ManifestParseError): - """The revision value in a project is incorrect. - """ + """The revision value in a project is incorrect.""" class ManifestInvalidPathError(ManifestParseError): - """A path used in or is incorrect. - """ + """A path used in or is incorrect.""" class NoManifestException(Exception): - """The required manifest does not exist. - """ + """The required manifest does not exist.""" - def __init__(self, path, reason): - super().__init__(path, reason) - self.path = path - self.reason = reason + def __init__(self, path, reason): + super().__init__(path, reason) + self.path = path + self.reason = reason - def __str__(self): - return self.reason + def __str__(self): + return self.reason class EditorError(Exception): - """Unspecified error from the user's text editor. - """ + """Unspecified error from the user's text editor.""" - def __init__(self, reason): - super().__init__(reason) - self.reason = reason + def __init__(self, reason): + super().__init__(reason) + self.reason = reason - def __str__(self): - return self.reason + def __str__(self): + return self.reason class GitError(Exception): - """Unspecified internal error from git. - """ + """Unspecified internal error from git.""" - def __init__(self, command): - super().__init__(command) - self.command = command + def __init__(self, command): + super().__init__(command) + self.command = command - def __str__(self): - return self.command + def __str__(self): + return self.command class UploadError(Exception): - """A bundle upload to Gerrit did not succeed. - """ + """A bundle upload to Gerrit did not succeed.""" - def __init__(self, reason): - super().__init__(reason) - self.reason = reason + def __init__(self, reason): + super().__init__(reason) + self.reason = reason - def __str__(self): - return self.reason + def __str__(self): + return self.reason class DownloadError(Exception): - """Cannot download a repository. - """ + """Cannot download a repository.""" - def __init__(self, reason): - super().__init__(reason) - self.reason = reason + def __init__(self, reason): + super().__init__(reason) + self.reason = reason - def __str__(self): - return self.reason + def __str__(self): + return self.reason class NoSuchProjectError(Exception): - """A specified project does not exist in the work tree. - """ + """A specified project does not exist in the work tree.""" - def __init__(self, name=None): - super().__init__(name) - self.name = name + def __init__(self, name=None): + super().__init__(name) + self.name = name - def __str__(self): - if self.name is None: - return 'in current directory' - return self.name + def __str__(self): + if self.name is None: + return "in current directory" + return self.name class InvalidProjectGroupsError(Exception): - """A specified project is not suitable for the specified groups - """ + """A specified project is not suitable for the specified groups""" - def __init__(self, name=None): - super().__init__(name) - self.name = name + def __init__(self, name=None): + super().__init__(name) + self.name = name - def __str__(self): - if self.name is None: - return 'in current directory' - return self.name + def __str__(self): + if self.name is None: + return "in current directory" + return self.name class RepoChangedException(Exception): - """Thrown if 'repo sync' results in repo updating its internal - repo or manifest repositories. In this special case we must - use exec to re-execute repo with the new code and manifest. - """ + """Thrown if 'repo sync' results in repo updating its internal + repo or manifest repositories. In this special case we must + use exec to re-execute repo with the new code and manifest. + """ - def __init__(self, extra_args=None): - super().__init__(extra_args) - self.extra_args = extra_args or [] + def __init__(self, extra_args=None): + super().__init__(extra_args) + self.extra_args = extra_args or [] class HookError(Exception): - """Thrown if a 'repo-hook' could not be run. + """Thrown if a 'repo-hook' could not be run. - The common case is that the file wasn't present when we tried to run it. - """ + The common case is that the file wasn't present when we tried to run it. + """ -- cgit v1.2.3-54-g00ecf