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

Use TypeGuard in sphinx.util.inspect #12283

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

picnixz
Copy link
Member

@picnixz picnixz commented Apr 15, 2024

This adds better type annotations (namely type guards) for the inspect module. This helps in removing some # type: ignore in other modules. In addition, I forced (in this PR and not the previous one) some literal values for the rendering modes.

The main issue with restify and stringify_annotation is that those functions are really big and they were probably incremented along the years. However, with all those type: ignore, some assumptions were not explicitly stated and this is quite bothersome when you want to debug.

@picnixz picnixz changed the title Improve type annotations for sphinx.util.inspect Improve type annotations for sphinx.util.inspect [part 2d] Apr 15, 2024
@AA-Turner AA-Turner changed the title Improve type annotations for sphinx.util.inspect [part 2d] Use TypeGuard for the sphinx.util.inspect functions Apr 23, 2024
@AA-Turner AA-Turner changed the title Use TypeGuard for the sphinx.util.inspect functions Use TypeGuard in sphinx.util.inspect Apr 23, 2024
@AA-Turner AA-Turner merged commit acc92ff into sphinx-doc:master Apr 23, 2024
21 of 23 checks passed
@picnixz picnixz deleted the cleanup/util-2d-type-guards branch April 23, 2024 10:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants