Skip to content

fix(types): Remove sentry.api.paginator from mypy ignore list#114510

Merged
kcons merged 3 commits intomasterfrom
kcons/typeround2
May 4, 2026
Merged

fix(types): Remove sentry.api.paginator from mypy ignore list#114510
kcons merged 3 commits intomasterfrom
kcons/typeround2

Conversation

@kcons
Copy link
Copy Markdown
Member

@kcons kcons commented Apr 30, 2026

Not yet stronglist-level, but at least not ignored.

Fixes ENG-6445.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 30, 2026


def count_hits(queryset, max_hits):
def count_hits(queryset: Any, max_hits: int) -> int:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is hard to make precise because it depends on our queryset subclass which isn't returned by common methods according to stubs. It'll be cleaned up in another pass.

return int(math.floor(value) if self._is_asc(for_prev) else math.ceil(value))

def value_from_cursor(self, cursor):
def value_from_cursor(self, cursor: Cursor) -> datetime: # type: ignore[override]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is some weirdness that is correct at runtime but an odd fit for our abstractions.


# offset = "page" number * max number of items per page
fetch_offset = cursor.offset * cursor.value
assert isinstance(cursor.value, (int, float))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the riskiest bit, but it basically has to be numeric, so should be fine.

@kcons kcons force-pushed the kcons/typeround2 branch from 9cb2105 to f00616f Compare May 1, 2026 00:31
@kcons kcons marked this pull request as ready for review May 1, 2026 00:40
@kcons kcons requested review from a team as code owners May 1, 2026 00:40
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0490d71. Configure here.

Comment thread src/sentry/api/paginator.py
@kcons kcons merged commit 24553f7 into master May 4, 2026
82 checks passed
@kcons kcons deleted the kcons/typeround2 branch May 4, 2026 16:29
cleptric pushed a commit that referenced this pull request May 5, 2026
Not yet stronglist-level, but at least not ignored.

Fixes ENG-6445.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants