aminghadersohi opened a new pull request, #44930: URL: https://github.com/apache/superset/pull/44930
## TL;DR - `superset/commands/importers/v1/utils.py` had two type annotations for the same `config` local, which trips mypy's `no-redef` check and makes the `pre-commit (current)` CI job red on `master` and on every PR that merges it. - Removes the redundant inner annotation; behavior is unchanged. ## Why https://github.com/apache/superset/commit/ece8b8bd7b added `config: Any = None` inside the `if schema:` block to fix an `UnboundLocalError` when `load_yaml` raises before `config` is assigned. That fix is correct, but `config` was already declared a few lines above (`config: dict[str, Any] | None = None`, before the `if schema:` check), so the inner annotation re-declares the same variable with a different type and mypy reports `no-redef`. Since `config` is already bound to `None` before entering the `if schema:` block, the inner re-binding was redundant for both typing and runtime behavior. ## What Removes the inner `config: Any = None` line (and its explanatory comment) from `load_configs`. The outer `config: dict[str, Any] | None = None` declaration already guarantees `config` is bound before the `try`/`except` runs, so the `except ValidationError` diagnostic that inspects `config` still works exactly as before. ## How to test ```bash pre-commit run --files superset/commands/importers/v1/utils.py pytest tests/unit_tests/commands/importers/v1 -q ``` Both pass locally, including the existing `UnboundLocalError` regression test. -- 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]
