Address simplifiable-if-expression.

This commit is contained in:
Felix Fontein 2025-10-12 10:19:06 +02:00
parent 23d3b126db
commit 8c18085757
7 changed files with 6 additions and 11 deletions

View File

@ -389,7 +389,6 @@ disable=raw-checker-failed,
not-an-iterable, # TODO: needs better typing info
protected-access,
redefined-outer-name, # needed for test fixtures
simplifiable-if-expression,
subprocess-popen-preexec-fn,
unexpected-keyword-arg,
unnecessary-dunder-call,

View File

@ -239,7 +239,7 @@ class Connection(ConnectionBase):
host=self.get_option("remote_addr"),
)
need_stdin = True if (in_data is not None) or do_become else False
need_stdin = bool((in_data is not None) or do_become)
data = {
"Container": self.get_option("remote_addr"),

View File

@ -42,7 +42,7 @@ class Container(DockerBaseClass):
@property
def exists(self):
return True if self.container else False
return bool(self.container)
@property
def removing(self):

View File

@ -101,7 +101,7 @@ def main():
client.module.exit_json(
changed=False,
exists=(True if container else False),
exists=bool(container),
container=container,
)
except DockerException as e:

View File

@ -204,10 +204,6 @@ def tls_context_to_json(context):
}
def to_bool(value):
return True if value else False
def context_to_json(context, current):
module_config = {}
if "docker" in context.endpoints:
@ -240,7 +236,7 @@ def context_to_json(context, current):
module_config["validate_certs"] = tls_cfg.verify
module_config["tls"] = True
else:
module_config["tls"] = to_bool(endpoint.get("SkipTLSVerify"))
module_config["tls"] = bool(endpoint.get("SkipTLSVerify"))
return {
"current": current,
"name": context.name,

View File

@ -122,7 +122,7 @@ def main():
client.module.exit_json(
changed=False,
exists=(True if network else False),
exists=bool(network),
network=network,
)
except DockerException as e:

View File

@ -106,7 +106,7 @@ def main():
client.module.exit_json(
changed=False,
exists=(True if volume else False),
exists=bool(volume),
volume=volume,
)
except DockerException as e: