mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-02 16:32:56 +00:00
[PR #11043/3478863e backport][stable-12] Address issues reported by ruff check (#11047)
Address issues reported by ruff check (#11043)
* Resolve E713 and E714 (not in/is tests).
* Address UP018 (unnecessary str call).
* UP045 requires Python 3.10+.
* Address UP007 (X | Y for type annotations).
* Address UP035 (import Callable from collections.abc).
* Address UP006 (t.Dict -> dict).
* Address UP009 (UTF-8 encoding comment).
* Address UP034 (extraneous parantheses).
* Address SIM910 (dict.get() with None default).
* Address F401 (unused import).
* Address UP020 (use builtin open).
* Address B009 and B010 (getattr/setattr with constant name).
* Address SIM300 (Yoda conditions).
* UP029 isn't in use anyway.
* Address FLY002 (static join).
* Address B034 (re.sub positional args).
* Address B020 (loop variable overrides input).
* Address B017 (assert raise Exception).
* Address SIM211 (if expression with false/true).
* Address SIM113 (enumerate for loop).
* Address UP036 (sys.version_info checks).
* Remove unnecessary UP039.
* Address SIM201 (not ==).
* Address SIM212 (if expr with twisted arms).
* Add changelog fragment.
* Reformat.
(cherry picked from commit 3478863ef0)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
11b802372b
commit
16f1d07509
77 changed files with 196 additions and 222 deletions
|
|
@ -226,10 +226,10 @@ class TemplateModule(OpenNebulaModule):
|
|||
return None
|
||||
|
||||
def get_template_by_id(self, template_id, filter):
|
||||
return self.get_template(lambda template: (template.ID == template_id), filter)
|
||||
return self.get_template(lambda template: (template_id == template.ID), filter)
|
||||
|
||||
def get_template_by_name(self, name, filter):
|
||||
return self.get_template(lambda template: (template.NAME == name), filter)
|
||||
return self.get_template(lambda template: (name == template.NAME), filter)
|
||||
|
||||
def get_template_instance(self, requested_id, requested_name, filter):
|
||||
if requested_id:
|
||||
|
|
@ -270,7 +270,7 @@ class TemplateModule(OpenNebulaModule):
|
|||
result["changed"] = True
|
||||
else:
|
||||
# if the previous parsed template data is not equal to the updated one, this has changed
|
||||
result["changed"] = template.TEMPLATE != result["template"]
|
||||
result["changed"] = result["template"] != template.TEMPLATE
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue