Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Sep 21, 2024
1 parent a22015a commit 18b79e5
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pylint/plugins/hass_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,12 @@ def _visit_importfrom_relative(
split_package = current_package.split(".")
if not node.modname and len(split_package) == node.level + 1:
for name in node.names:
if name[0] == split_package[2]:
# from .. import self
self.add_message("hass-import-relative-self", node=node)
if name[0] != split_package[2]:
# from .. import other
self.add_message("hass-absolute-import", node=node)
return
# from .. import other
self.add_message("hass-absolute-import", node=node)
return
# from .. import self
self.add_message("hass-import-relative-self", node=node)
return
if len(split_package) < node.level + 2:
self.add_message("hass-absolute-import", node=node)
Expand Down

0 comments on commit 18b79e5

Please sign in to comment.