You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/10/03 04:57:22 UTC
(superset) 01/01: fix(import): remove duplicate config redefinition in load_configs
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fix/importers-utils-config-redef
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9be6912f706fae9e09c262de6fd58e7267cb4032
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Fri Oct 2 21:55:58 2026 -0700
fix(import): remove duplicate config redefinition in load_configs
#43232 and #44390 merged the same day, each independently binding
config up front in load_configs for the same reason (so the except
ValidationError diagnostic below stays valid even when load_yaml
raises before the assignment completes). Landing side by side, they
left two annotated bindings of the same name with different types,
which mypy correctly flags as a redefinition -- config: dict[str, Any]
| None = None outside the if schema: block, then config: Any = None
again just inside it, right before the try. The first binding alone
already covers it; the second was always redundant.
This surfaced on master's post-merge pre-commit check once an
unrelated commit's mypy invocation happened to pull utils.py into its
type-checked graph for the first time since the two PRs landed --
neither PR's own CI had any reason to type-check the other's
untouched lines.
Co-Authored-By: Claude Sonnet 5 <no...@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1UbxU1PCUDVwqVVUk4Uc5
---
superset/commands/importers/v1/utils.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/superset/commands/importers/v1/utils.py b/superset/commands/importers/v1/utils.py
index 6c9349702c5..484daf768f1 100644
--- a/superset/commands/importers/v1/utils.py
+++ b/superset/commands/importers/v1/utils.py
@@ -192,14 +192,13 @@ def load_configs(
if not content:
continue
+ # Bound up front so the ``except ValidationError`` diagnostic below
+ # stays valid even when ``load_yaml`` raises before the assignment
+ # completes (unparseable YAML).
config: dict[str, Any] | None = None
prefix = file_name.split("/")[0]
schema = schemas.get(f"{prefix}/")
if schema:
- # Bind ``config`` up front so the ``except ValidationError``
- # diagnostic below stays valid even when ``load_yaml`` raises
- # before the assignment completes (unparseable YAML).
- config: Any = None
try:
config = load_yaml(file_name, content)
if not isinstance(config, dict):