pdoc
pdoc copied to clipboard
ForwardRef not unwrapped for inner quoted types in arguments
Expected behavior
ForwardRef
wrappers to be removed from argument type annotations, as per 8702f62.
Actual behavior
For arguments, the wrapper is removed only if the entire type is quoted. When a quoted reference forms part of a larger type (e.g. Optional["MyClass"]
), the wrapper persists in the formatted annotation.
Return types are however correctly parsed in either style.
Example
from typing import Optional
def all_quoted(arg: "Optional[MyClass]") -> "Optional[MyClass]":
pass
def min_quoted(arg: Optional["MyClass"]) -> Optional["MyClass"]:
pass
This produces the following, with ForwardRef
wrapping the argument to min_quoted
but not its return type:
Functions
all_quoted(arg: Optional[MyClass]) ‑> Optional[MyClass]
min_quoted(arg: Optional[ForwardRef('MyClass')]) ‑> Optional[MyClass]
Additional info
- pdoc version: 0.9.2