Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake8 fixes #4340

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cloudinit/net/eni.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _iface_add_subnet(iface, subnet):
if key == "address":
value = "%s/%s" % (subnet["address"], subnet["prefix"])
if value and key in valid_map:
if type(value) == list:
if isinstance(value, list):
value = " ".join(value)
if "_" in key:
key = key.replace("_", "-")
Expand Down Expand Up @@ -126,7 +126,7 @@ def _iface_add_attrs(iface, index, ipv4_subnet_mtu):

for key, value in iface.items():
# convert bool to string for eni
if type(value) == bool:
if isinstance(value, bool):
value = "on" if iface[key] else "off"
if not value or key in ignore_map:
continue
Expand All @@ -144,7 +144,7 @@ def _iface_add_attrs(iface, index, ipv4_subnet_mtu):
for v in value:
content.append(" {0} {1}".format(renames.get(key, key), v))
continue
if type(value) == list:
if isinstance(value, list):
value = " ".join(value)
content.append(" {0} {1}".format(renames.get(key, key), value))

Expand Down
4 changes: 2 additions & 2 deletions cloudinit/net/network_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def handle_bridge(self, command):

# convert value to boolean
bridge_stp = iface.get("bridge_stp")
if bridge_stp is not None and type(bridge_stp) != bool:
if bridge_stp is not None and not isinstance(bridge_stp, bool):
if bridge_stp in ["on", "1", 1]:
bridge_stp = True
elif bridge_stp in ["off", "0", 0]:
Expand All @@ -575,7 +575,7 @@ def _parse_dns(self, command):
search = []
if "address" in command:
addrs = command["address"]
if not type(addrs) == list:
if not isinstance(addrs, list):
addrs = [addrs]
for addr in addrs:
nameservers.append(addr)
Expand Down
2 changes: 1 addition & 1 deletion cloudinit/sources/helpers/netlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def unpack_rta_attr(data, offset):
:raises: AssertionError if data is None or offset is not integer.
"""
assert data is not None, "data is none"
assert type(offset) == int, "offset is not integer"
assert isinstance(offset, int), "offset is not integer"
assert (
offset >= RTATTR_START_OFFSET
), "rta offset is less than expected length"
Expand Down
Loading