jason810496 commented on code in PR #66519:
URL: https://github.com/apache/airflow/pull/66519#discussion_r3200047898


##########
scripts/ci/prek/check_sdk_imports.py:
##########
@@ -41,18 +43,31 @@ def check_file_for_sdk_imports(file_path: Path) -> 
list[tuple[int, str]]:
     except (OSError, UnicodeDecodeError, SyntaxError):
         return []
 
+    source_lines = source.splitlines()
     mismatches = []
 
     for node in ast.walk(tree):
         if isinstance(node, ast.ImportFrom):
             if node.module and ("airflow.sdk" in node.module):
+                if _has_nocheck_marker(source_lines, node):
+                    continue
                 import_names = ", ".join(alias.name for alias in node.names)
                 statement = f"from {node.module} import {import_names}"
                 mismatches.append((node.lineno, statement))
 
     return mismatches
 
 
+def _has_nocheck_marker(source_lines: list[str], node: ast.Import | 
ast.ImportFrom) -> bool:

Review Comment:
   Good idea!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to