Skip to content

fix(import): drop duplicate config annotation (mypy no-redef) - #44930

Closed
aminghadersohi wants to merge 1 commit into
apache:masterfrom
aminghadersohi:fix-importers-config-no-redef
Closed

aminghadersohi wants to merge 1 commit into
apache:masterfrom
aminghadersohi:fix-importers-config-no-redef

Conversation

@aminghadersohi

Copy link
Copy Markdown
Contributor

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

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

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.

config was already declared as dict[str, Any] | None above the if
schema: block. The inner config: Any = None re-annotation is
redundant and trips mypy's no-redef check, since config is still
bound to None before load_yaml runs either way.
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.43%. Comparing base (3fa06db) to head (e3bebd1).
⚠️ Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #44930      +/-   ##
==========================================
+ Coverage   82.26%   82.43%   +0.17%     
==========================================
  Files        2995     2995              
  Lines      185026   186898    +1872     
  Branches    42820    43316     +496     
==========================================
+ Hits       152212   154071    +1859     
+ Misses      30052    30027      -25     
- Partials     2762     2800      +38     
Flag Coverage Δ
hive 36.78% <ø> (+0.48%) ⬆️
mysql 55.52% <ø> (+0.18%) ⬆️
postgres 55.53% <ø> (+0.18%) ⬆️
presto 38.63% <ø> (+0.46%) ⬆️
python 86.45% <ø> (+0.24%) ⬆️
sqlite 55.26% <ø> (+0.19%) ⬆️
unit 79.57% <ø> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aminghadersohi
aminghadersohi marked this pull request as ready for review October 3, 2026 08:17
@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Superseded by #44932, which merged the same fix.

@bito-code-review

bito-code-review Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #86264b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: e3bebd1..e3bebd1
    • superset/commands/importers/v1/utils.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers an incremental AI Review.

  • /review full - Manually triggers a full AI Review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant