Skip to content

Commit

Permalink
CCT-118: Fix flake8 error E721
Browse files Browse the repository at this point in the history
* Card ID: CCT-118

E721: do not compare types, for exact checks use `is` / `is not`
  • Loading branch information
m-horky committed Nov 1, 2023
1 parent 65ab1a6 commit b110482
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/cloud_what/providers/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def is_likely_running_on_cloud(self) -> float:
found_amazon_ec2 = False
found_aws = False
for hw_item in self.hw_info.values():
if type(hw_item) != str:
if type(hw_item) is str:
continue
if "amazon ec2" in hw_item.lower():
found_amazon_ec2 = True
Expand Down
2 changes: 1 addition & 1 deletion src/cloud_what/providers/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def is_likely_running_on_cloud(self):
found_microsoft = False
found_azure = False
for hw_item in self.hw_info.values():
if type(hw_item) != str:
if type(hw_item) is str:
continue
if "microsoft" in hw_item.lower():
found_microsoft = True
Expand Down
2 changes: 1 addition & 1 deletion src/cloud_what/providers/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def is_likely_running_on_cloud(self):
found_google = False
found_gcp = False
for hw_item in self.hw_info.values():
if type(hw_item) != str:
if type(hw_item) is str:
continue
if "google" in hw_item.lower():
found_google = True
Expand Down
2 changes: 1 addition & 1 deletion src/rhsmlib/client_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_cmd_line(sender, bus=None):
if bus is None:
bus = dbus.SystemBus()
cmd_line = dbus_utils.command_of_sender(bus, sender)
if cmd_line is not None and type(cmd_line) == str:
if cmd_line is not None and type(cmd_line) is str:
# Store only first argument of command line (no argument including username or password)
cmd_line = cmd_line.split()[0]
return cmd_line
Expand Down
2 changes: 1 addition & 1 deletion src/subscription_manager/productid.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def _get_cert(self, filename):
f = open(filename)
try:
pem = f.read()
if type(pem) == bytes:
if type(pem) is bytes:
pem = pem.decode("utf-8")
cert = create_from_pem(pem)
cert.pem = pem
Expand Down
2 changes: 1 addition & 1 deletion src/syspurpose/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ def detect_changed(base: dict, other: dict, key: str, source: str = "server") ->
return bool(base_val)

# Handle "addons" (the lists might be out of order from the server)
if type(base_val) == list and type(other_val) == list:
if type(base_val) is list and type(other_val) is list:
return sorted(base_val) != sorted(other_val)

# When value is removed from server, then it is set to empty string, but
Expand Down

0 comments on commit b110482

Please sign in to comment.