Skip to content

[docutils] Add return types for a few docutils table methods #14493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adamtheturtle
Copy link
Contributor

No description provided.

This comment has been minimized.

@adamtheturtle
Copy link
Contributor Author

cc @donBarbos @srittau - the mypy_primer diff is relevant as I am working to bump types-docutils in Sphinx.

@donBarbos
Copy link
Contributor

How about using Sequence or Iterable instead of list as suggested by mypy_primer?

Copy link
Contributor

github-actions bot commented Aug 3, 2025

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/directives/patches.py:82:16: error: Call to untyped function "run" in typed context  [no-untyped-call]
+ sphinx/directives/patches.py:64:5: error: Return type "list[Node]" of "run" incompatible with return type "Sequence[table | system_message]" in supertype "CSVTable"  [override]
+ sphinx/directives/patches.py:82:16: error: Incompatible return value type (got "Sequence[table | system_message]", expected "list[Node]")  [return-value]

Copy link
Contributor

@donBarbos donBarbos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok if this narrowing of return types is also true for methods of child classes.
Then just need to correct these types in sphinx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants