Reformat everything with black.

I had to undo the u string prefix removals to not drop Python 2 compatibility.
That's why black isn't enabled in antsibull-nox.toml yet.
This commit is contained in:
Felix Fontein
2025-04-28 09:51:33 +02:00
parent 04a0d38e3b
commit aec1826c34
118 changed files with 11780 additions and 7565 deletions

View File

@@ -22,9 +22,9 @@ class PluginGPGRunner(GPGRunner):
def __init__(self, executable=None, cwd=None):
if executable is None:
try:
executable = get_bin_path('gpg')
executable = get_bin_path("gpg")
except ValueError:
raise GPGError('Cannot find the `gpg` executable on the controller')
raise GPGError("Cannot find the `gpg` executable on the controller")
self.executable = executable
self.cwd = cwd
@@ -41,15 +41,19 @@ class PluginGPGRunner(GPGRunner):
Raises a ``GPGError`` in case of errors.
"""
command = [self.executable] + command
p = Popen(command, shell=False, cwd=self.cwd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
p = Popen(
command, shell=False, cwd=self.cwd, stdin=PIPE, stdout=PIPE, stderr=PIPE
)
stdout, stderr = p.communicate(input=data)
stdout = to_native(stdout, errors='surrogate_or_replace')
stderr = to_native(stderr, errors='surrogate_or_replace')
stdout = to_native(stdout, errors="surrogate_or_replace")
stderr = to_native(stderr, errors="surrogate_or_replace")
if check_rc and p.returncode != 0:
raise GPGError('Running {cmd} yielded return code {rc} with stdout: "{stdout}" and stderr: "{stderr}")'.format(
cmd=' '.join(command),
rc=p.returncode,
stdout=to_native(stdout, errors='surrogate_or_replace'),
stderr=to_native(stderr, errors='surrogate_or_replace'),
))
raise GPGError(
'Running {cmd} yielded return code {rc} with stdout: "{stdout}" and stderr: "{stderr}")'.format(
cmd=" ".join(command),
rc=p.returncode,
stdout=to_native(stdout, errors="surrogate_or_replace"),
stderr=to_native(stderr, errors="surrogate_or_replace"),
)
)
return p.returncode, stdout, stderr