-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
improve type annotations in 'docutils.core' #11559
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
Conversation
080fa76
to
760a829
Compare
This comment has been minimized.
This comment has been minimized.
parser: Parser | None = None, | ||
writer: Writer | None = None, | ||
source: Input[_S] | None = None, | ||
source_class: type[Input[_S]] = io.FileInput, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some mypy errors about this. It's probably difficult to get this right without overloads.
760a829
to
bdc8857
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, a few remarks below.
writer_name: str = "pseudoxml", | ||
settings: Values | None = None, | ||
settings_spec: SettingsSpec | None = None, | ||
settings_overrides: Any | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could probably be typed. Docstring says:
settings_overrides
: A dictionary containing application-specific settings defaults that override the defaults of other components. [...]
Without looking at the source, this this probably a dict
, Mapping
, or one of the protocols from _typeshed
. It's okay to leave it as Incomplete
now, though.
Applies to all the functions below as well.
argv: list[str] | None = None, | ||
usage: str = default_usage, | ||
description: str = default_description, | ||
) -> Any: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a comment to this and the other return types below that this is either str
or bytes
.
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
Co-authored-by: Sebastian Rittau <[email protected]>
This comment has been minimized.
This comment has been minimized.
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:21: note: In module imported here:
+ sphinx/io.py:161:53: error: Missing type parameters for generic type "Publisher" [type-arg]
+ sphinx/builders/__init__.py: note: In member "read_doc" of class "Builder":
+ sphinx/builders/__init__.py:491:9: error: Item "None" of "Optional[Values]" has no attribute "record_dependencies" [union-attr]
+ sphinx/builders/__init__.py:508:37: error: Argument 2 to "write_doctree" of "Builder" has incompatible type "Optional[document]"; expected "document" [arg-type]
+ sphinx/builders/__init__.py: note: At top level:
- sphinx/builders/html/__init__.py:439: error: Unused "type: ignore" comment [unused-ignore]
cwltool (https://github.com/common-workflow-language/cwltool)
+ note: In module imported here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:32: note: ... from here:
|
This has a huge merge conflict; do we still need this PR? |
No description provided.