Repository navigation
Remove unused type: ignore comments in airflow-core - #75078
Merged
Merged
Conversation
mypy --warn-unused-ignores (exposed locally as SHOW_UNUSED_MYPY_WARNINGS=true) flags stale `# type: ignore` comments: 61 that suppress nothing at all and 3 whose bracket lists an error code next to a live one. Stale suppressions make it hard to tell which ignores are still load-bearing, so drop the dead ones and keep the remaining brackets limited to the codes they actually need.
HsuehYi
requested review from
Lee-W,
amoghrajesh,
ashb,
bolkedebruin,
bugraoz93,
choo121600,
dstandish,
ephraimbuddy,
henry3260,
hussein-awala,
jason810496,
pierrejeambrun,
rawwar,
shubhamraj-git and
uranusjr
as code owners
October 19, 2026 09:38
hussein-awala
approved these changes
Oct 19, 2026
hussein-awala
left a comment
Member
There was a problem hiding this comment.
LGTM if the CI is green
Lee-W
approved these changes
Oct 19, 2026
Lee-W
left a comment
Member
There was a problem hiding this comment.
Nice clean up. Let's see how CI says 🚀
HsuehYi
commented
Oct 19, 2026
`mypy --warn-unused-ignores` only reports the `[return]` ignore in memray_utils.py as unused when the optional memray extra is not installed (the dedicated local mypy venv does not install it). With memray installed, as in the CI image, `Tracker.__exit__` may suppress exceptions, so mypy cannot prove that every path returns. Restore the ignore and add a comment so that a future cleanup does not drop it again.
HsuehYi
force-pushed
the
remove-unused-mypy-ignores
branch
from
October 19, 2026 11:42
d28882a to
2977a75
Compare
vincbeck
approved these changes
Oct 19, 2026
potiuk
added a commit
that referenced
this pull request
Oct 19, 2026
#75078 dropped the type: ignores in this expression, which only held while mypy did not check the body; typing cls as type[Backfill] keeps it clean on SQLAlchemy 2.0 and 2.1, as dag_display_name and DagRun.duration already are. Also annotate the Anthropic stream fixture so mypy can index its events. Generated-by: Claude Opus 5
Lee-W
added a commit
that referenced
this pull request
Oct 20, 2026
* [main] CI: Upgrade important CI environment * Fix "prek run update-providers-build-files --all-files" * Fix CI breakages from the dependency upgrade - snowflake: snowflake-sqlalchemy (up to 1.11.1) cannot be imported on SQLAlchemy 2.1, which made ORMSelectCompileState private. Cap sqlalchemy<2.1 in the provider; the workspace lock resolves back to SQLAlchemy 2.0.54. Removing the cap is tracked in #75118. - airflow-core: type the dag_display_name and duration hybrid expressions against the class (type[...] -> ColumnElement) and fix _get_dialect's return type, so mypy holds on SQLAlchemy 2.0 and 2.1. - common.ai: declare the OpenAI Decisions and System One vendors added in pydantic-ai 2.53/2.55; reject sqlglot >= 30.22's exp.ListStage (Snowflake LIST/LS @stage) on the allow_writes path; adapt tests to pydantic-ai's streamed Anthropic requests and new request counting, and to sqlglot's MySQL "--+" tokenization. Generated-by: Claude Opus 5 * Type Backfill.duration expression against the class #75078 dropped the type: ignores in this expression, which only held while mypy did not check the body; typing cls as type[Backfill] keeps it clean on SQLAlchemy 2.0 and 2.1, as dag_display_name and DagRun.duration already are. Also annotate the Anthropic stream fixture so mypy can index its events. Generated-by: Claude Opus 5 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Wei Lee <[email protected]> Co-authored-by: Jarek Potiuk <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mypy --warn-unused-ignores— exposed to contributors asSHOW_UNUSED_MYPY_WARNINGS=true prek run mypy-airflow-core --all-files(see
contributing-docs/08_static_code_checks.rst) — reports stale# type: ignorecomments in
airflow-core: 60 comments that suppress nothing at all, and 3 thatlist an unused error code next to a live one. Stale suppressions make it hard to
tell which ignores are still load-bearing, so this PR drops the dead comments and
narrows the remaining brackets to the codes they actually need.
Changes (28 files, all in
airflow-core):# type: ignoresuppressions (src + tests);src/airflow/timetables/simple.py:47:[misc,no-redef]→[no-redef]tests/unit/plugins/test_plugins_manager.py:278/279:[list-item, typeddict-item]→[typeddict-item]src/airflow/api_fastapi/core_api/routes/public/extra_links.py: with the trailingcomment gone,
ruff formatkeeps the generator expression on one line.[return]ignore insrc/airflow/utils/memray_utils.py: it is only reportedunused when the optional
memrayextra is not installed; with memray present, as inCI,
Tracker.__exit__may suppress exceptions, so mypy needs it. A comment nowexplains this.
Verification (run locally):
prek run mypy-airflow-core --all-files→ passedmypy --warn-unused-ignoreswith thememrayextra installed (matches CI) → passed(no unused ignores remain)
breeze run --python 3.11 … mypy(same invocation as the CI static-check job) → passedgenerate-openapi-specran successfully once Docker was available)
No runtime behaviour changes; no tests were run beyond the checks above.
Was generative AI tooling used to co-author this PR?
Generated-by: OpenCode (DeepSeek V4.1 Flash Free) following the guidelines