-
-
Notifications
You must be signed in to change notification settings - Fork 146
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
Optional[Type] is shown as Union[Type, NoneType] #324
Comments
Also, the return type |
I'm afraid that's what the values are resolved as by typing internals: >>> import typing
>>> def foo() -> typing.Optional[int]: pass
>>> typing.get_type_hints(foo)
{'return': typing.Union[int, NoneType]} If you can think of a good matching/replacement scheme, this would be the place to override it: Lines 1243 to 1258 in aef1917
|
Thanks for the pointers. Handling the general case looks difficult. It seems that |
In the doc I maintain, https://google.github.io/mediapy/, the functions have many
typing
attributes.These generally look great in the
pdoc3
output, except thatOptional[Type]
is replaced by the more confusingUnion[Type, NoneType]
.Perhaps it would be possible to recognize this pattern and somehow change it back?
The text was updated successfully, but these errors were encountered: