Skip to content

[pyupgrade] Add fix safety section to UP010#18838

Merged
dylwil3 merged 1 commit intoastral-sh:mainfrom
MeGaGiGaGon:patch-1
Jun 23, 2025
Merged

[pyupgrade] Add fix safety section to UP010#18838
dylwil3 merged 1 commit intoastral-sh:mainfrom
MeGaGiGaGon:patch-1

Conversation

@MeGaGiGaGon
Copy link
Copy Markdown
Contributor

@MeGaGiGaGon MeGaGiGaGon commented Jun 20, 2025

Summary

Part of #15584

This adds a Fix safety section to unnecessary-future-import (UP010)

The unsafety is determined here:

let applicability = if checker.comment_ranges().intersects(range) {
Applicability::Unsafe
} else {
Applicability::Safe
};

Unsafe code example:
playground

from __future__ import (print_function,# ...
__annotations__)  # ...

Edit: It looks like there was already a PR for this, #17490, but I missed it since they said UP029 instead of UP010 :/

Test Plan

N/A, no tests/functionality affected

@MeGaGiGaGon MeGaGiGaGon mentioned this pull request Jun 20, 2025
71 tasks
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser requested a review from dylwil3 June 21, 2025 15:39
Copy link
Copy Markdown
Collaborator

@dylwil3 dylwil3 left a comment

Choose a reason for hiding this comment

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

Perfect, thank you!

@dylwil3 dylwil3 merged commit 8be205d into astral-sh:main Jun 23, 2025
35 checks passed
@MeGaGiGaGon MeGaGiGaGon deleted the patch-1 branch June 23, 2025 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants