Skip to content

[peewee] Annotate ColumnBase.__invert__ - #16650

Merged
srittau merged 3 commits into
python:mainfrom
jakkdl:peewee-invert
Nov 25, 2026
Merged

srittau merged 3 commits into
python:mainfrom
jakkdl:peewee-invert

Conversation

@jakkdl

@jakkdl jakkdl commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

ColumnBase.__invert__ is unannotated, so ~ on a field or expression is untyped.

Annotate it as returning ColumnBase (the precise Negated conflicts with BitwiseMixin.__invert__ in BitField), and drop DQ.__invert__'s unneeded type: ignore[override].

Upstream: https://github.com/coleifer/peewee/blob/4.5.3/peewee.py#L1269-L1270

Edit: following review, __invert__ now returns Negated. That costs a # type: ignore[misc] on BitField, whose BitwiseMixin.__invert__ returns BitwiseNegated, and DQ.__invert__ keeps its # type: ignore[override].

🤖 Generated with Claude Code (Claude Opus 5.5)

@github-actions

This comment has been minimized.

@srittau

srittau commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Annotate it as returning ColumnBase (the precise Negated conflicts with BitwiseMixin.invert in BitField),

I have no experience with "peewee", but in general we prefer exact annotations if the cost if adding # type: ignore where necessary.

jakkdl and others added 2 commits November 25, 2026 12:32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	stubs/peewee/peewee.pyi
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 39039cb into python:main Nov 25, 2026
74 checks passed
@jakkdl

jakkdl commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

cool, thanks for the quick merge!

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