MAINT: Bump ruff to v0.16 - #234
Conversation
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
|
Thanks. Does this include both |
|
Has three types of fixes:
|
|
I've opened a PR for safe fixes; after it's merged, I'll open another PR for unsafe fixes. Once we have both merged and main merged with this branch, this PR will be left with the rest of the changes. |
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
prady0t
left a comment
There was a problem hiding this comment.
Some nested if and with statements can be reverted; otherwise, the changes are okay.
| and result_type(x.dtype, y.dtype) != x.dtype | ||
| ): | ||
| assert_raises(TypeError, lambda: getattr(x, _op)(y)) | ||
| assert_raises(TypeError, lambda x=x, _op=_op, y=y: getattr(x, _op)(y)) |
There was a problem hiding this comment.
If we're touching this anyway, then how about
with assert_raises(TypeError):
getattr(x, _op)(y)
There was a problem hiding this comment.
Should we replace all such occurrences with a similar change?
There was a problem hiding this comment.
If you touch them anyway, then yes, I think it'd be nice.
There was a problem hiding this comment.
In the latest commit, I've replaced only in those places where Ruff was complaining.
| for func1 in [ | ||
| lambda s, func=func, a=a: func(a, s), | ||
| lambda s, func=func, a=a: func(s, a), | ||
| ]: |
There was a problem hiding this comment.
Not sure what these are TBH, could you explain?
There was a problem hiding this comment.
That's B023.
Python uses late binding for closures, hence it's worth setting initial value for the variables.
There was a problem hiding this comment.
Let's ignore this if you feel it's confusing.
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Closes #228