Add type annotations to djblets.siteconfig.
Review Request #12702 — Created Oct. 28, 2022 and submitted
djblets.siteconfig
, andSiteConfiguration
in particular, is central
to much of the Djblets and Review Board codebases. This change
inrtoduces type annotations to most of the module, helping to make sure
call sites are passing in all the right information.Settings management in
SiteConfiguration
is all typed now, helping
callers ensure they're handling results correctly.Mappings between siteconfig and Django settings are typed with
structuredTypeDict
s, so we can avoid any issues with invalid keys or
values in those sometimes-complex mappings.This was fairly smooth, though it did uncover a couple code paths where
assumptions were incorrectly made. Unbound varibable issues were fixed
in the management commands
All unit tests pass for all supported versions of Python.
Mypy and pyright were largely happy. There's some work in related modules
that still need to be done.
Summary | ID |
---|---|
217011be690b2e2d947d3f2e616f0df16856c7f9 |
Description | From | Last Updated |
---|---|---|
'djblets.siteconfig.models.SiteConfigurationSettings' imported but unused Column: 1 Error code: F401 |
reviewbot | |
'typing.Any' imported but unused Column: 1 Error code: F401 |
reviewbot | |
Typo (I think?) "Djangos" -> "Django" |
maubin | |
Would it be worth it to include the type here like value: SiteConfigurationSettingsValue = siteconfig.get(key)? |
maubin | |
Typo: "are" -> "that are" |
maubin | |
Forgot to add str type. |
maubin | |
Could add unused here. |
maubin | |
Should add doc comments for these. |
maubin | |
Forgot to add str type. |
maubin | |
*args should come after clear_caches. Also will need to add *args to the doc string. |
maubin |
- Change Summary:
-
Removed unused imports.
- Commits:
-
Summary ID 92b47ddc5fbf9bfea949f2d45779a2afe5c77877 00ecd5102fc0093a1eca394e04a9da4d47502650 - Diff:
-
Revision 2 (+592 -194)
Checks run (2 succeeded)
- Change Summary:
-
- Fixed up a number of docstring issues, including typos and missing docs.
- Added missing types.
- Commits:
-
Summary ID 00ecd5102fc0093a1eca394e04a9da4d47502650 217011be690b2e2d947d3f2e616f0df16856c7f9 - Diff:
-
Revision 3 (+612 -196)