Skip to content

Commit f4622e5

Browse files
Fix direct import checker
1 parent f7b5056 commit f4622e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ci/pre-commit/check_optional_imports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def visit_ImportFrom(self, node: ast.ImportFrom):
6060
if node.module:
6161
# Check if importing from a checked module directly
6262
for module in CHECKED_MODULES:
63-
if node.module.startswith(module):
63+
module_name = node.module.split(".")[0]
64+
if module_name == module:
6465
self.violations.append(
6566
ImportViolation(
6667
self.filename,

0 commit comments

Comments
 (0)