-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Refactor] Fix ruff rule B018: useless-expression #50010
Conversation
19c83d3
to
88955f1
Compare
Signed-off-by: win5923 <[email protected]>
Signed-off-by: win5923 <[email protected]>
@@ -4,7 +4,7 @@ | |||
@serve.deployment | |||
class A: | |||
def __init__(self): | |||
1 / 0 | |||
raise ZeroDivisionError |
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.
could you also change this and the other places to _ = 1 / 0
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.
The train part looks good to me except https://github.com/ray-project/ray/pull/50010/files#r1927372142
Signed-off-by: win5923 <[email protected]>
Useless expressions have no effect on the program, and are often included by mistake. Assign a useless expression to a variable, or remove it entirely. However, if a seemingly useless expression (like an attribute access) is needed to trigger a side effect, consider assigning it to an anonymous variable, to indicate that the return value is intentionally ignored. --------- Signed-off-by: win5923 <[email protected]>
Why are these changes needed?
Useless expressions have no effect on the program, and are often included by mistake. Assign a useless expression to a variable, or remove it entirely.
However, if a seemingly useless expression (like an attribute access) is needed to trigger a side effect, consider assigning it to an anonymous variable, to indicate that the return value is intentionally ignored.
Ref: https://docs.astral.sh/ruff/rules/useless-expression/
Related issue number
#47991
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.