Skip to content

Commit

Permalink
manifest: Fix type comparisons
Browse files Browse the repository at this point in the history
Fix errors for: E721 Use `is` and `is not` for type comparisons

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
  • Loading branch information
pdgendt committed Nov 4, 2024
1 parent 531e330 commit 306b0a2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/west/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ def _import_from_self(self, imp: Any) -> None:
# system) with a fallback on self._ctx.project_importer.

imptype = type(imp)
if imptype == bool:
if imptype is bool:
self._malformed(f'got "self: import: {imp}" of boolean')
elif self._ctx.import_flags & ImportFlag.IGNORE:
# If we're ignoring imports altogether, this is fine.
Expand All @@ -2171,12 +2171,12 @@ def _import_from_self(self, imp: Any) -> None:
self._assert_imports_ok()
self.has_imports = True

if imptype == str:
if imptype is str:
self._import_path_from_self(imp)
elif imptype == list:
elif imptype is list:
for subimp in imp:
self._import_from_self(subimp)
elif imptype == dict:
elif imptype is dict:
self._import_map_from_self(imp)
else:
self._malformed(
Expand Down Expand Up @@ -2505,16 +2505,16 @@ def _import_from_project(self, project: Project, imp: Any):
self.has_imports = True

imptype = type(imp)
if imptype == bool:
if imptype is bool:
# We should not have been called unless the import was truthy.
assert imp
self._import_path_from_project(project, _WEST_YML)
elif imptype == str:
elif imptype is str:
self._import_path_from_project(project, imp)
elif imptype == list:
elif imptype is list:
for subimp in imp:
self._import_from_project(project, subimp)
elif imptype == dict:
elif imptype is dict:
self._import_map_from_project(project, imp)
else:
self._malformed(f'{project.name_and_path}: invalid import {imp} '
Expand Down

0 comments on commit 306b0a2

Please sign in to comment.