Skip to content

Conversation

@amotl
Copy link
Member

@amotl amotl commented Feb 10, 2026

Problem

This unrelated patch just failed CI because the ruff linter complained.

Thoughts

I don't know why the CI run on that update by Dependabot succeeded. I think the CI run on that update by Dependabot didn't run yesterday, because it was submitted at a time when GitHub had outages across the board.

raise ProgrammingError("Cursor closed")

__next__ = next
__next__ = next # noqa: A003
Copy link
Member Author

Choose a reason for hiding this comment

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

Without that marker, ruff 0.15.0 would complain like this:

A003 Python builtin is shadowed by method `next` from line 181
   --> src/crate/client/cursor.py:196:16
    |
194 |             raise ProgrammingError("Cursor closed")
195 |
196 |     __next__ = next
    |                ^^^^
197 |
198 |     @property
    |

Found 1 error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would you suggest a different mitigation than just suppressing the warning?

@amotl amotl requested review from mfussenegger and surister and removed request for surister February 10, 2026 20:21
@amotl amotl marked this pull request as ready for review February 10, 2026 20:22
@amotl amotl changed the title Linting: Satisfy most recent ruff 0.15.0 Linter: Update to ruff 0.15.0 Feb 10, 2026
raise ProgrammingError("Cursor closed")

__next__ = next
__next__ = next # noqa: A003
Copy link
Member Author

Choose a reason for hiding this comment

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

Is it the right choice to use builtins.next?

Suggested change
__next__ = next # noqa: A003
__next__ = builtins.next

Copy link
Member

Choose a reason for hiding this comment

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

Judging from 1d7573e the intention here is to implement the iterator protocol

So why not:

diff --git a/src/crate/client/cursor.py b/src/crate/client/cursor.py
index 587f149..b7aac08 100644
--- a/src/crate/client/cursor.py
+++ b/src/crate/client/cursor.py
@@ -191,11 +191,12 @@ def next(self):
         if not self._closed:
             return next(self.rows)
         else:
             raise ProgrammingError("Cursor closed")
 
-    __next__ = next
+    def __next__(self):
+        return self.next()
 
     @property
     def description(self):
         """
         This read-only attribute is a sequence of 7-item sequences.

Copy link
Member

@mfussenegger mfussenegger left a comment

Choose a reason for hiding this comment

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

See comment regarding the next - otherwise lgtm

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.

2 participants