Run pyupgrade

This commit is contained in:
jeanluc 2023-06-25 21:18:04 +02:00 committed by Daniel Wozniak
parent 41e35b59e7
commit 5be82ae9fb

View file

@ -114,7 +114,7 @@ class FunctionWrapper:
cmd_prefix=None,
aliases=None,
minion_opts=None,
**kwargs
**kwargs,
):
super().__init__()
self.cmd_prefix = cmd_prefix
@ -163,14 +163,14 @@ class FunctionWrapper:
cmd_prefix=cmd,
aliases=self.aliases,
minion_opts=self.minion_opts,
**kwargs
**kwargs,
)
if self.cmd_prefix:
# We're in an inner FunctionWrapper as created by the code block
# above. Reconstruct the original cmd in the form 'cmd.run' and
# then evaluate as normal
cmd = "{}.{}".format(self.cmd_prefix, cmd)
cmd = f"{self.cmd_prefix}.{cmd}"
if cmd in self.wfuncs:
return self.wfuncs[cmd]
@ -199,7 +199,7 @@ class FunctionWrapper:
disable_wipe=True,
fsclient=self.fsclient,
minion_opts=self.minion_opts,
**self.kwargs
**self.kwargs,
)
stdout, stderr, retcode = single.cmd_block()
return parse_ret(stdout, stderr, retcode, result_only=True)
@ -214,15 +214,13 @@ class FunctionWrapper:
# Form of salt.cmd.run in Jinja -- it's expecting a subdictionary
# containing only 'cmd' module calls, in that case. We don't
# support assigning directly to prefixes in this way
raise KeyError(
"Cannot assign to module key {} in the FunctionWrapper".format(cmd)
)
raise KeyError(f"Cannot assign to module key {cmd} in the FunctionWrapper")
if self.cmd_prefix:
# We're in an inner FunctionWrapper as created by the first code
# block in __getitem__. Reconstruct the original cmd in the form
# 'cmd.run' and then evaluate as normal
cmd = "{}.{}".format(self.cmd_prefix, cmd)
cmd = f"{self.cmd_prefix}.{cmd}"
if cmd in self.wfuncs:
self.wfuncs[cmd] = value