[pywin32] replace Incomplete win32print types#15794
Conversation
This commit contains the following changes: - Add the missing `DEVMODEType` and `DEVMODEWType` types, these are both aliases to the `PyDEVMODEW` class. - Merge the `PyDEVMODE` and `PyDEVMODEW` classes, these are the same class in reality. - Fix the type of `TimeType.format` to include the default value for the `format` parameter.
This commit audits all the types in the win32print module, replacing all `Incomplete` types with an appropriate `TypedDict`, and using overloads to reference the correct version of the type. The types for the win32print module should now be complete and accurate as far as I can tell.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Not a full review, just something I noticed: I assume that these typed dicts don't exist at runtime? In that case, the names need to be prefixed with class PRINTER_INFO_1(TypedDict):use @type_check_only
def _PrinterInfo1(TypedDict): |
Hi @srittau, thanks for taking a look! Indeed, all these typed dicts don't exist at runtime. When I add this, I get flake8 failures such as: Any idea the best approach here? I believe whoever set up these stubs intended the entire |
Hello, first time contributor so feel free to let me know if I'm doing anything wrong!
This PR fixes all the
Incompletetypes in thewin32printmodule of thepywin32package. The majority of the diff comes from definingTypedDictclasses for all the Windows API types (e.g.PRINTER_INFO_2), and then adding several overloads to select the correct types for each function.I also included a commit to add missing types to
pywintypesthat I noticed whilst working on the printing types, see the commit message for more details.I haven't raised or linked this to an issue yet, let me know if I should do so.
Thanks in advance!