Skip to content

Iterate file objects directly instead of calling readlines()#66291

Merged
potiuk merged 1 commit intoapache:mainfrom
ColtenOuO:fix-furb129-readlines-in-for
May 3, 2026
Merged

Iterate file objects directly instead of calling readlines()#66291
potiuk merged 1 commit intoapache:mainfrom
ColtenOuO:fix-furb129-readlines-in-for

Conversation

@ColtenOuO
Copy link
Copy Markdown
Contributor

Summary

Replaces all five remaining FURB129 violations: for line in f.readlines()for line in f. File objects are iterable and yield lines lazily, while readlines() reads the entire file into a list before iteration starts.

Why

Reference: ruff FURB129 — readlines-in-for.

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!

Copy link
Copy Markdown
Contributor

@SameerMesiah97 SameerMesiah97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bugraoz93 added the full tests needed We need to run full set of tests for this PR to merge label May 3, 2026
@bugraoz93 bugraoz93 closed this May 3, 2026
@bugraoz93 bugraoz93 reopened this May 3, 2026
Copy link
Copy Markdown
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks for the PR!
Let's wait to merge full tests as some breeze and internal tests runs with full tests only :)

@potiuk potiuk merged commit 2cde0be into apache:main May 3, 2026
279 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

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>
choo121600 pushed a commit that referenced this pull request May 4, 2026
…s() (#66291) (#66320)

(cherry picked from commit 2cde0be)

Co-authored-by: Colten <70793703+ColtenOuO@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools area:providers backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch full tests needed We need to run full set of tests for this PR to merge provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants