-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typing: corrections for dbcore/types.py #4828
Conversation
813cdac
to
f98987c
Compare
Oh, given the second commit here: Shall we drop Python 3.7 very soon? It's EOL in a few days if I'm no mistaken. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is very tricky indeed! It was a really good idea to parameterize Type
on both a "main" type and a null type; this seems to help clarify types work in general (i.e., on "input," you're supposed to provide the main type; on "output," you need to expect that you might get the null type as well). Really nice work nailing this down!
I have few assorted thoughts scattered throughout.
f98987c
to
6314e9f
Compare
Thanks for the swift and thorough review! I've addressed the comments and rebased, let's see what CI says. |
6314e9f
to
a1c4a53
Compare
tricky... - the only way I found to express the concept of the "associated type" (in Rust lingo) model_type was by making Type generic over its value and null types. - in addition, the class hierarchy of Integer and Float types had to be modified, since previously some of them would have conflicting null types relative to their super class (this required a change to the edit plugin; hopefully no more breakage is caused by these changes) - don't import the query module, but only the relevant Query's to avoid confusing the module query and the class variable query
a1c4a53
to
e9f3565
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome; this looks great!!
Yet another follow-up to dbcore typing. I've had this in the pipeline for a while, but only now got around to finishing it up and figure out the last bits around handling the
model_type
Type
-valued field.Please have a close look at this PR; does the approach look sensible? I restructured the class hierarchy a bit to avoid some conflicting signature. This could potentially break plugins that depend on details of the db and type handling (as it turns out, the edit plugin does).