Modernize autodoc_utils.
Review Request #14479 — Created June 27, 2025 and submitted
This change modernizes out autodoc_utils Sphinx extension in preparation
for adding new features to better deal with TypedDicts.
Ran unit tests.
| Summary | ID |
|---|---|
| 5094ab32c155384c3486f4da79d6833f94403c94 |
| Description | From | Last Updated |
|---|---|---|
|
The trick to avoiding the warnings that you're having to ignore here is to do: try: ... except ImportError: if … |
|
|
|
Probably should capitalize "Returns". Also, "Returns-like", since it's more than "Returns". |
|
|
|
What's this for? We should document every # type: ignore so it's clear. |
|
|
|
What's this for? |
|
|
|
No need for these parens now. |
|
|
|
Why this? Let's document these. Here and below. |
|
|
|
I don't think the r is needed. |
|
|
|
Why this? |
|
|
|
undefined name 'Sequence' Column: 29 Error code: F821 |
|
|
|
undefined name 'Sequence' Column: 28 Error code: F821 |
|
|
|
undefined name 'Sequence' Column: 34 Error code: F821 |
|
|
|
Space after "type:". I guess either works? But that's how it's documented and commonly used. |
|
- Commits:
-
Summary ID d68419172949552ab941a402e03421a0dec75c96 b4971b4916c64e29493527531c24596c2e606bfc
Checks run (2 succeeded)
-
-
The trick to avoiding the warnings that you're having to ignore here is to do:
try: ... except ImportError: if TYPE_CHECKING: assert False else: ...This ensures that the type checker only ever considers the first import and not whatever we have to patch in after. It also avoids the issue of ignoring the true imports and only considering the fallbacks (which shouldn't be the primary reference point for the type).
The way that's structured is very specific. It'll ensure that the type checker does not consider any code paths involving the fallbacks, either within this
try/exceptor later where they're used. Just doingassert not TYPE_CHECKINGorif not TYPE_CHECKING:won't give the same result. -
-
-
-
-
-
-
- Commits:
-
Summary ID b4971b4916c64e29493527531c24596c2e606bfc a0c5155e91e0fc1a39d5223e8018e1cbde8b83f1
- Commits:
-
Summary ID a0c5155e91e0fc1a39d5223e8018e1cbde8b83f1 5094ab32c155384c3486f4da79d6833f94403c94