Skip to content
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

improve type annotations in 'docutils.parsers.rst.states' #11545

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

danieleades
Copy link
Contributor

No description provided.

@danieleades danieleades marked this pull request as draft March 8, 2024 16:27

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@danieleades
Copy link
Contributor Author

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

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/domains/std/__init__.py:388: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/directives/__init__.py: note: In member "run" of class "DefaultRole":
+ sphinx/directives/__init__.py:331:26: error: List item 0 has incompatible type "system_message"; expected "SystemMessage"  [list-item]

I have no idea what this means

  • sphinx/ext/autodoc/directive.py:118: error: Unused "type: ignore" comment [unused-ignore]
  • sphinx/ext/inheritance_diagram.py: note: In member "run" of class "InheritanceDiagram":
  • sphinx/ext/inheritance_diagram.py:382:21: error: Item "None" of "Optional[document]" has no attribute "reporter" [union-attr]
  • sphinx/ext/inheritance_diagram.py: note: At top level:

bokeh (https://github.com/bokeh/bokeh)

  • src/bokeh/sphinxext/bokeh_palette_group.py:53: note: ... from here:
  • src/bokeh/sphinxext/bokeh_palette_group.py:53: note: ... from here:

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

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

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/domains/__init__.py:23: note: In module imported here:
+ sphinx/util/docutils.py: note: In member "get_source_info" of class "SphinxDirective":
+ sphinx/util/docutils.py:436:16: error: Incompatible return value type (got "Union[tuple[str, int], tuple[None, None]]", expected "tuple[str, int]")  [return-value]
+ sphinx/directives/__init__.py: note: In member "run" of class "DefaultRole":
+ sphinx/directives/__init__.py:331:26: error: List item 0 has incompatible type "system_message"; expected "SystemMessage"  [list-item]
- sphinx/domains/std/__init__.py: note: At top level:
- sphinx/domains/std/__init__.py:388: error: Unused "type: ignore" comment  [unused-ignore]
- sphinx/ext/autodoc/directive.py:118: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/ext/autosummary/__init__.py: note: In function "get_table":
+ sphinx/ext/autosummary/__init__.py:411:57: error: Incompatible types in string interpolation (expression has type "Optional[int]", placeholder has type "Union[int, float, SupportsInt]")  [str-format]
- sphinx/directives/other.py: note: At top level:
- sphinx/directives/other.py:416: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/directives/code.py: note: In member "run" of class "CodeBlock":
+ sphinx/directives/code.py:140:74: error: Argument "location" to "dedent_lines" has incompatible type "Union[tuple[str, int], tuple[None, None]]"; expected "Optional[tuple[str, int]]"  [arg-type]
+ sphinx/directives/code.py: note: In member "run" of class "LiteralInclude":
+ sphinx/directives/code.py:436:48: error: Argument "location" to "read" of "LiteralIncludeReader" has incompatible type "Union[tuple[str, int], tuple[None, None]]"; expected "Optional[tuple[str, int]]"  [arg-type]
- sphinx/ext/inheritance_diagram.py: note: In member "run" of class "InheritanceDiagram":
- sphinx/ext/inheritance_diagram.py:382:21: error: Item "None" of "Optional[document]" has no attribute "reporter"  [union-attr]
- sphinx/ext/inheritance_diagram.py: note: At top level:
- sphinx/ext/inheritance_diagram.py:390: error: Unused "type: ignore" comment  [unused-ignore]

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_palette_group.py:53: note: ... from here:
- src/bokeh/sphinxext/bokeh_palette_group.py:53: note: In module imported here:

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.

None yet

1 participant