Upgrade ty to 0.0.63 and fix new MRO-based method-override diagnostics - #93
Merged
Conversation
ty 0.0.62 added MRO-based checking for inherited method conflicts, which surfaced 51 invalid-method-override diagnostics in plain-postgres and 6 in plain-email. For plain-postgres, fix the actual signature mismatches in the shared base classes (RegisterLookupMixin.get_lookup/get_transform, BaseExpression. get_transform, Lookup.resolve_expression) rather than suppressing per subclass: rename parameters to match, and correct get_transform's return type to Callable[..., Transform] | None to reflect that it can genuinely return a KeyTransformFactory instance alongside Transform subclasses. This also lets an existing invalid-return-type ignore in expressions.py be removed since the types now agree. For plain-email, add ty: ignore[invalid-method-override] on the three SafeMIME* classes, consistent with the existing ignore already used on set_payload in the same file, since MIMEMixin intentionally diverges from stdlib email.message.Message's as_bytes/as_string signature.
davegaeddert
marked this pull request as ready for review
July 28, 2026 13:07
|
Next steps:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tyfrom 0.0.61 to 0.0.63 (see 0.0.62 and 0.0.63 changelogs).invalid-method-overridediagnostics inplain-postgresand 6 inplain-email.RegisterLookupMixin.get_lookup/get_transform(query_utils.py) andBaseExpression.get_lookup/get_transform(expressions.py) had mismatched parameter names (lookup_namevslookup/name) — renamed to match.RegisterLookupMixin.get_transform's declared return type includedCallable[..., Any]even though its own body could never return a bare callable — narrowed totype[Transform] | None, then further corrected (along withBaseExpression.get_transform,EncryptedFieldMixin.get_transform, andJSONField.get_transform) toCallable[..., Transform] | None, sinceJSONField.get_transformgenuinely returns aKeyTransformFactoryinstance alongsideTransformsubclasses. This also let a pre-existing# ty: ignore[invalid-return-type]inexpressions.pybe removed, since the types now agree.Lookup.resolve_expressionwas declared to return the concreteLookuptype instead ofSelf, which conflicted withBaseExpression.resolve_expression -> Self. Its body already returns a copy ofself, soSelfis the accurate annotation.Exact,GreaterThan,DataContains, etc.) — no new ignores were needed for plain-postgres.ForeignObjectRel.get_lookup's parameter for naming consistency with the rest of the package (flagged in review; this one isn't part of the affected MRO chain, so it wasn't required by ty, but keeps the convention consistent).# ty: ignore[invalid-method-override]on the threeSafeMIME*classes, consistent with the existing ignore already used onset_payloadin the same file —MIMEMixinintentionally diverges from stdlibemail.message.Message'sas_bytes/as_stringsignature (linesepparam instead ofpolicy) to avoid manglingFromlines, which can't be reconciled without changing behavior.Test plan
./scripts/type-check .(repo-widety check) passes with zero diagnostics./scripts/test plain-postgres— 754 passed, 1 skipped./scripts/test plain-email— 13 passeduv run ruff check/ruff format --checkon all changed files/simplify(reuse, simplification, efficiency, altitude review) — no issues found/code-review— one style-consistency nit (thereverse_related.pyparam name), applied🤖 Generated with Claude Code
https://claude.ai/code/session_01VXaR5tbB8DjR3dLDzsDALA
Generated by Claude Code