FrancescoCastaldi commented on code in PR #43695:
URL: https://github.com/apache/superset/pull/43695#discussion_r4159565635


##########
superset/db_engine_specs/lint_metadata.py:
##########
@@ -272,10 +276,17 @@ def get_all_engine_specs_ast() -> list[dict[str, Any]]:  
# noqa: C901
                     if isinstance(item, ast.Assign):
                         for target in item.targets:
                             if isinstance(target, ast.Name) and target.id == 
"engine":
-                                # Check if engine value is non-empty string
                                 if isinstance(item.value, ast.Constant):
                                     has_non_empty_engine = 
bool(item.value.value)
                                 break
+                    elif isinstance(item, ast.AnnAssign):

Review Comment:
   Added in `tests/unit_tests/db_engine_specs/test_lint_metadata.py`: creates a 
temporary engine spec file defining `TypedBaseEngineSpec(BaseEngineSpec)` with 
type-annotated `engine`, `engine_name`, and `metadata`, then asserts 
`get_all_engine_specs_ast()` discovers it and preserves the annotated 
attributes. Reverting any of the `AnnAssign` branches causes the test to fail 
as expected.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to