codeant-ai-for-open-source[bot] commented on code in PR #38490:
URL: https://github.com/apache/superset/pull/38490#discussion_r3522425088
##########
superset/databases/schemas.py:
##########
@@ -277,6 +277,35 @@ def extra_validator(value: str) -> str:
)
]
)
+
+ metadata_cache_timeout = extra_.get("metadata_cache_timeout")
+ if metadata_cache_timeout is None:
+ metadata_cache_timeout = {}
+ if not isinstance(metadata_cache_timeout, dict):
+ raise ValidationError(
+ [
+ _(
+ "The metadata_cache_timeout must be a mapping from "
+ "string keys to non-negative integer values."
+ )
+ ]
+ )
+ for key in (
+ "schema_cache_timeout",
+ "table_cache_timeout",
+ "catalog_cache_timeout",
+ ):
+ timeout = metadata_cache_timeout.get(key)
Review Comment:
**Suggestion:** Add explicit type annotations for the new local variables
used in metadata cache timeout validation to satisfy the type-hint requirement
for newly introduced logic. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The new validation logic introduces local variables whose types can be
annotated, and they currently lack explicit type hints. This matches the custom
rule requiring type hints on relevant newly added Python variables.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ae5d3e0f16b14a8d8ffa5784f3e14846&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ae5d3e0f16b14a8d8ffa5784f3e14846&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/databases/schemas.py
**Line:** 281:298
**Comment:**
*Custom Rule: Add explicit type annotations for the new local variables
used in metadata cache timeout validation to satisfy the type-hint requirement
for newly introduced logic.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38490&comment_hash=125f84e754deec034436cff923f5237a025773623cfc82556462d51a50335c76&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38490&comment_hash=125f84e754deec034436cff923f5237a025773623cfc82556462d51a50335c76&reaction=dislike'>👎</a>
--
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]