-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[refurb
] Manual timezone monkeypatching (FURB162
)
#16113
Merged
Merged
+606
−0
Conversation
This file contains 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
|
MichaReiser
approved these changes
Feb 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you
crates/ruff_linter/src/rules/refurb/rules/fromisoformat_replace_z.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/refurb/rules/fromisoformat_replace_z.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/refurb/rules/fromisoformat_replace_z.rs
Outdated
Show resolved
Hide resolved
MichaReiser
reviewed
Feb 17, 2025
MichaReiser
reviewed
Feb 18, 2025
MichaReiser
approved these changes
Feb 18, 2025
dcreager
added a commit
that referenced
this pull request
Feb 18, 2025
* main: (60 commits) [`refurb`] Manual timezone monkeypatching (`FURB162`) (#16113) [`pyupgrade`] Do not upgrade functional TypedDicts with private field names to the class-based syntax (`UP013`) (#16219) Improve docs for PYI019 (#16229) Refactor `CallOutcome` to `Result` (#16161) Fix minor punctuation errors (#16228) Include document specific debug info (#16215) Update server to return the debug info as string (#16214) [`airflow`] Group `ImportPathMoved` and `ProviderName` to avoid misusing (`AIR303`) (#16157) Fix unstable formatting of trailing end-of-line comments of parenthesized attribute values (#16187) Ignore source code actions for a notebook cell (#16154) Add FAQ entry for `source.*` code actions in Notebook (#16212) red-knot: move symbol lookups in `symbol.rs` (#16152) better error messages while loading configuration `extend`s (#15658) Format `index.css` (#16207) Improve API exposed on `ExprStringLiteral` nodes (#16192) Update Rust crate tempfile to v3.17.0 (#16202) Update cloudflare/wrangler-action action to v3.14.0 (#16203) Update NPM Development dependencies (#16199) Update Rust crate smallvec to v1.14.0 (#16201) Update Rust crate codspeed-criterion-compat to v2.8.0 (#16200) ...
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
Part of #1348.
FURB162
reportsdatetime.fromisoformat()
calls where the lone argument is of one of the following forms:date.replace("Z", <zero_offset>)
date[:-1] + <zero_offset>
date.strip("Z") + <zero_offset>
/date.rstrip("Z") + <zero_offset>
...and where
<zero_offset>
is a string literal whose content is one of00:00
,0000
or00
prefixed with+
or-
.Before Python 3.11, this was necessary, as
.fromisoformat()
wasn't able to handle strings withZ
as the affix. Now it can.The logic was taken from that of the upstream rule.
Test Plan
cargo nextest run
andcargo insta test
.