Iterate file objects directly instead of calling readlines()#66291
Merged
potiuk merged 1 commit intoapache:mainfrom May 3, 2026
Merged
Iterate file objects directly instead of calling readlines()#66291potiuk merged 1 commit intoapache:mainfrom
potiuk merged 1 commit intoapache:mainfrom
Conversation
Contributor
SameerMesiah97
left a comment
There was a problem hiding this comment.
Approved pending green CI. There should be some performance improvement for the dockerfile loop but this is mostly the manual application of a Ruff rule like you said.
bugraoz93
approved these changes
May 3, 2026
Contributor
bugraoz93
left a comment
There was a problem hiding this comment.
Looks good thanks for the PR!
Let's wait to merge full tests as some breeze and internal tests runs with full tests only :)
jscheffl
approved these changes
May 3, 2026
potiuk
approved these changes
May 3, 2026
Contributor
Backport successfully created: v3-2-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
github-actions Bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
May 3, 2026
…s() (apache#66291) (cherry picked from commit 2cde0be) Co-authored-by: Colten <70793703+ColtenOuO@users.noreply.github.com>
aws-airflow-bot
pushed a commit
to aws-mwaa/upstream-to-airflow
that referenced
this pull request
May 3, 2026
…s() (apache#66291) (cherry picked from commit 2cde0be) Co-authored-by: Colten <70793703+ColtenOuO@users.noreply.github.com>
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.
Summary
Replaces all five remaining
FURB129violations:for line in f.readlines()→for line in f. File objects are iterable and yield lines lazily, whilereadlines()reads the entire file into a list before iteration starts.Why
Reference: ruff FURB129 — readlines-in-for.
dev/airflow_perf/sql_queries.py:148filters lines withif is_query(line)— non-matching lines never need to be in memory.dev/breeze/src/airflow_breeze/global_constants.py:673returns on the first match — the rest of the Dockerfile is no longer read.The remaining three sites store all lines in a list anyway, so memory usage is equivalent — those changes are just for idiom consistency
Verification
ruff check --select FURB129 .→All checks passed!