ForwardRef not unwrapped for inner quoted types in arguments
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Reproduce the all_quoted and min_quoted examples, then trace pdoc's argument-annotation parsing and formatting path; done means inner quoted references no longer display as ForwardRef while the return annotations remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100