typeshed
typeshed copied to clipboard
Add stubgen stubs for docutils.core
I appreciate that https://github.com/python/typeshed/pull/11559/files attempts to add more thorough type hints, but that seems to have stagnated.
I think that:
- This provides some type safety for using docutils.core.
- https://github.com/python/typeshed/pull/11559/files can easily be rebased to show just the added type hints
- We can possibly bring in https://github.com/python/typeshed/pull/11559/files changes piecemeal after this
Diff from mypy_primer, showing the effect of this PR on open source code:
sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/builders/html/__init__.py: note: In member "render_partial" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:407:36: error: Argument 1 to "set_source" of "Publisher" has incompatible type "document"; expected "str | None" [arg-type]
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
I'm not against doing it in two steps, one with automated generation, then one with manual changes. Incorrect default values have to be fixed first though for stubtest to pass. You can use stubdefaulter -t stubs/docutils/ to help you with that.