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

Documentation shows unexpected ForwardRef(None) inside Union. #395

Open
hhoppe opened this issue Apr 25, 2022 · 1 comment
Open

Documentation shows unexpected ForwardRef(None) inside Union. #395

hhoppe opened this issue Apr 25, 2022 · 1 comment

Comments

@hhoppe
Copy link
Contributor

hhoppe commented Apr 25, 2022

Input:

from typing import Union

def test1_func(arg: Union[None, str, int]) -> None:
  return

Resulting documentation:
def test1_func(arg: Union[ForwardRef(None), str, int]) ‑> None

Expected documentation:
def test1_func(arg: Union[None, str, int]) ‑> None

!pdoc --version
pdoc 0.10.0

@hhoppe
Copy link
Contributor Author

hhoppe commented Apr 26, 2022

Actually, it would be even better (clearer and more concise) if this produced the Python 3.10 syntax:

def test1_func(arg: str | int | None) ‑> None

It seems that pdoc does so some of the time -- maybe only for Optional[simple_type]?

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

No branches or pull requests

1 participant