Type Meta.fields and local_fields as ColumnField - #109
Merged
Conversation
PASS: 1 review scope passed, 1 agent approved
✅ codex approved · 1 dismissed Next steps:
|
2 tasks
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.
Follow-up to #103.
Meta.fields,concrete_fields, andlocal_concrete_fieldswere typedImmutableList[Field]even though the onlyFieldsubclasses that aren'tColumnFieldare the abstractRelatedFieldandManyToManyField, and M2M fields are routed tolocal_many_to_manyinadd_field. So every element really is aColumnField, and #103 had to add anassert isinstance(f, ColumnField)insideclean_fieldsto read column attributes off it, next to a pre-existing one inModel.__init__.local_fields,fields,concrete_fields, andlocal_concrete_fieldsasColumnField.add_field(raiseTypeErrorfor anything that is neither) instead of re-checking in every loop.fieldsis now just an immutable copy oflocal_fields; the "generic relation" filter it carried from Django was dead code since no such field class exists here.isinstance(…, ColumnField)asserts inbase.pyand the equivalent skip in the convergence column comparison.QuerySet._updateandUpdateQuery.add_update_fieldstoSequenceso alist[tuple[ColumnField, Any]]passes without an invariance error.Type ignores 148 → 146, asserts 176 → 173.
Test plan
./scripts/type-validate26/26./scripts/test plain-postgres