Reformatted code base using black.

This commit is contained in:
Goffi 2024-06-19 18:44:57 +02:00
commit 53fdaa9d09

View file

@ -194,10 +194,10 @@ class InputCommon(base.CommandBase):
error=True,
)
self.host.quit(C.EXIT_DATA_ERROR)
end = '\n' if self.args.debug else ' '
end = "\n" if self.args.debug else " "
self.disp(
A.color(C.A_HEADER, _("command {idx}").format(idx=self.idx)),
end = end,
end=end,
)
stdin = "".join(self._stdin)
if self.args.debug:
@ -206,7 +206,7 @@ class InputCommon(base.CommandBase):
C.A_SUBHEADER,
_("values: "),
A.RESET,
", ".join([shlex.quote(a) for a in self._values_ori])
", ".join([shlex.quote(a) for a in self._values_ori]),
),
2,
)
@ -227,7 +227,7 @@ class InputCommon(base.CommandBase):
)
self.disp("\n")
else:
self.disp(" (" + ", ".join(self._values_ori) + ")", 2, end=' ')
self.disp(" (" + ", ".join(self._values_ori) + ")", 2, end=" ")
args = [sys.argv[0]] + self.args.command + self._opts + self._pos
p = await asyncio.create_subprocess_exec(
*args,
@ -235,18 +235,24 @@ class InputCommon(base.CommandBase):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
stdout, stderr = await p.communicate(stdin.encode('utf-8'))
stdout, stderr = await p.communicate(stdin.encode("utf-8"))
log = self.args.log
log_err = self.args.log_err
log_tpl = "{command}\n{buff}\n\n"
if log:
log.write(log_tpl.format(
command=" ".join(shlex.quote(a) for a in args),
buff=stdout.decode('utf-8', 'replace')))
log.write(
log_tpl.format(
command=" ".join(shlex.quote(a) for a in args),
buff=stdout.decode("utf-8", "replace"),
)
)
if log_err:
log_err.write(log_tpl.format(
command=" ".join(shlex.quote(a) for a in args),
buff=stderr.decode('utf-8', 'replace')))
log_err.write(
log_tpl.format(
command=" ".join(shlex.quote(a) for a in args),
buff=stderr.decode("utf-8", "replace"),
)
)
ret = p.returncode
if ret == 0:
self.disp(A.color(C.A_SUCCESS, _("OK")))