1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-03 23:41:51 +00:00

fix ruff case E721 (#11121)

* fix ruff case E721

* add changelog frag
This commit is contained in:
Alexei Znamensky 2025-11-13 09:14:04 +13:00 committed by GitHub
parent 41923e43bd
commit c45fba549f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- nmcli - fix comparison of type (https://github.com/ansible-collections/community.general/pull/11121).

View file

@ -2489,7 +2489,7 @@ class Nmcli:
if key and len(pair) > 1:
raw_value = pair[1].lstrip()
if raw_value == "--":
if key_type == list:
if key_type is list:
conn_info[key] = []
else:
conn_info[key] = None
@ -2504,7 +2504,7 @@ class Nmcli:
conn_info[alias_key] = alias_value
elif key in ("ipv4.routes", "ipv6.routes"):
conn_info[key] = [s.strip() for s in raw_value.split(";")]
elif key_type == list:
elif key_type is list:
conn_info[key] = [s.strip() for s in raw_value.split(",")]
else:
m_enum = p_enum_value.match(raw_value)

View file

@ -21,7 +21,6 @@ ignore = [
"B905", # zip-without-explicit-strict - needs Python 3.10+
"UP045", # Use `X | None` for type annotations - needs Python 3.10+
# To fix:
"E721", # Type comparison
"UP014", # Convert `xxx` from `NamedTuple` functional to class syntax
"UP024", # Replace aliased errors with `OSError`
"UP028", # Replace `yield` over `for` loop with `yield from`