-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refurb] Parse more exotic decimal strings in `verbose-decimal-constr…
…uctor (FURB157)` (#14098) FURB157 suggests replacing expressions like `Decimal("123")` with `Decimal(123)`. This PR extends the rule to cover cases where the input string to `Decimal` can be easily transformed into an integer literal. For example: ```python Decimal("1__000") # fix: `Decimal(1000)` ``` Note: we do not implement the full decimal parsing logic from CPython on the grounds that certain acceptable string inputs to the `Decimal` constructor may be presumed purposeful on the part of the developer. For example, as in the linked issue, `Decimal("١٢٣")` is valid and equal to `Decimal(123)`, but we do not suggest a replacement in this case. Closes #13807
- Loading branch information
Showing
3 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
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
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
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