Enhance typing for KeyValueForm.
Review Request #14437 — Created May 13, 2025 and submitted
This change makes it so KeyValueForm is typed as a generic, allowing us
to specify the type of theinstance
member which is operated on. The
default implementations of get and set assume a dict-like interface, so
I've additionally added some runtime-checkable protocols for those.
- Ran unit tests.
- Verified that type checkers were happy when creating KeyValueForm
subclasses.
Summary | ID |
---|---|
5198a036e8c4a39c7dc0e9ff6d5917f15106f6a1 |
Description | From | Last Updated | ||
---|---|---|---|---|
I think this can live in TYPE_CHECKING. |
|
|||
This needs a Version Added and a Version Changed in __init__. |
|
|||
Do we want parens in the returns? We've been doing without in this form. |
|
|||
While here, we can move request into the function definition after *args. |
|
|||
These should be swapped. |
|
|||
Missing , optional. |
|
|||
There are no open issues |
- Commits:
-
Summary ID abebbed7cfb4ff23940c84b8b850a81d39c194cb 97a611feae2ea8969aadad0f0c2ac23b45907d16
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.
- Change Summary:
-
- Make the
request
parameter for SiteSettingsForm not-required again (there are subclasses and other places that don't always pass it). - Put
Generic
as the last parent class instead of the first (I'll have another change doing this for everywhere else, with reasons).
- Make the
- Commits:
-
Summary ID 97a611feae2ea8969aadad0f0c2ac23b45907d16 0f1b47e7c005ef5967703aa1dc2d470f69e1e035
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.