fix: remove unnecessary type conversions and promote pyrefly rule to error - #40882
Open
divyanshus2404 wants to merge 1 commit into
Open
fix: remove unnecessary type conversions and promote pyrefly rule to error#40882divyanshus2404 wants to merge 1 commit into
divyanshus2404 wants to merge 1 commit into
Conversation
divyanshus2404
requested review from
CourTeous33,
GareArc,
JohnJyong,
QuantumGhost,
WH-2099 and
laipz8200
as code owners
August 17, 2026 10:19
…error Remove 165 redundant type conversion calls (str(), int(), float(), bool(), bytes()) where the argument is already the target type. Promote the unnecessary-type-conversion pyrefly rule from info to error so CI catches future occurrences. Closes langgenius#39947
divyanshus2404
force-pushed
the
fix/remove-unnecessary-type-conversions
branch
from
August 17, 2026 10:20
e8ae06e to
34a60c6
Compare
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
str(),int(),float(),bool(),bytes()) where the argument is already the target typeunnecessary-type-conversionpyrefly rule from"info"to"error"inapi/pyproject.tomlso CI catches future occurrencesMotivation
Closes #39947. These conversions are no-ops that add noise and can mask actual type issues. Promoting the rule to error prevents regression.
Changes
76 files changed, 162 insertions, 162 deletions — all mechanical removal of redundant wrappers like:
str(already_a_str)→already_a_strint(already_an_int)→already_an_intfloat(already_a_float)→already_a_floatbool(already_a_bool)→already_a_boolbytes(already_bytes)→already_bytesTest plan
pyrefly checkreports 0unnecessary-type-conversionerrors