[reportlab] Use TypedDict with Unpack for BaseDocTemplate kwargs - #16095
Conversation
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
|
@Daverball Do you remember why this is supposed to be a TypedDict, instead of inlining the arguments? |
|
I'm not fully sure I remember, but I think it was mostly because it is But it also will be slightly nicer for overriding If there were fewer keyword arguments, then I would probably prefer inlining them as well. But in this case I think a |
Your other arguments make sense, but if I remember correctly, stubtest doesn't complain when concrete arguments are used in the stubs in place of |
You are a senior Typeshed contributor working on the ReportLab stubs.
Objective
Resolve the remaining
TODO: Use TypedDict with Unpack for **kwin:by replacing the untyped
**kwparameter inBaseDocTemplate.__init__with a preciseTypedDictusing PEP 692Unpack.This is a stub-only typing improvement. Do not modify runtime behavior or public APIs.
Phase 1 — Investigation
Inspect:
BaseDocTemplatePageTemplate,Flowable, or shared aliasesBefore making changes:
BaseDocTemplate.__init__.**kw.Do not infer unsupported keyword arguments.
Phase 2 -Introduce TypedDict
Import:
TypedDictfromtypingUnpackfromtyping_extensionsCreate: