Skip to content

MAINT: Bump ruff to v0.16 - #234

Open
prady0t wants to merge 6 commits into
data-apis:mainfrom
prady0t:ruff-0.16
Open

MAINT: Bump ruff to v0.16#234
prady0t wants to merge 6 commits into
data-apis:mainfrom
prady0t:ruff-0.16

Conversation

@prady0t

@prady0t prady0t commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #228

prady0t added 3 commits July 30, 2026 01:22
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>
Comment thread array_api_strict/_array_object.py
@ev-br

ev-br commented Jul 30, 2026

Copy link
Copy Markdown
Member

Thanks. Does this include both --unsafe-fixes and --fixes? If so, it could be helpful to split into two PRs: just --fixes first and unsafe ones next.

@prady0t

prady0t commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Has three types of fixes:

  • fix
  • unsafe-fixes
  • rest of the failures (mentioned in issue comments) that I fixed with AI

@prady0t prady0t mentioned this pull request Jul 30, 2026
@prady0t

prady0t commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

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.

prady0t and others added 2 commits July 31, 2026 14:42
Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Comment thread array_api_strict/tests/test_searching_functions.py Outdated
Comment thread array_api_strict/_array_object.py Outdated
Comment thread array_api_strict/_array_object.py Outdated
Comment thread array_api_strict/_searching_functions.py Outdated

@prady0t prady0t left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

@ev-br ev-br Jul 31, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're touching this anyway, then how about

with assert_raises(TypeError):
   getattr(x, _op)(y)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we replace all such occurrences with a similar change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you touch them anyway, then yes, I think it'd be nice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),
]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what these are TBH, could you explain?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's B023.
Python uses late binding for closures, hence it's worth setting initial value for the variables.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ignore this if you feel it's confusing.

Signed-off-by: Pradyot Ranjan <99216956+pradyotRanjan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unpin ruff, fix warnings from 0.16

2 participants