You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NamedTuples with optional / default values still show as "required"
Environment and Version
Python 3.11.3, running on Linux x86-64
mkdocs=1.4.3=pyhd8ed1ab_0
mkdocs-autorefs=0.4.1=pyhd8ed1ab_1
mkdocs-material=9.1.12=pyhd8ed1ab_0
Steps to Reproduce
Since Python 3.7 (I think?) one can define a NamedTuple with default values as so:
fromtypingimportNamedTupleclassExample(NamedTuple):
"""A simple example of the autorefs bug Parameters ---------- required : int A required value optional : float, optional An optional value, default is -3.6 """required: intoptional: float=-3.6
which behaves as follows:
>>>Example(2)
Example(required=2, optional=-3.6)
Rendering this code with mkdocstrings-python results in the following:
Workaround
Not that I've been able to figure out (besides just not using NamedTuple)
Severity
Annoying.
Desired Outcome
Fix
Urgency
None
The text was updated successfully, but these errors were encountered:
pawamoy
changed the title
Autorefs fails to recognize optional arguments in NamedTuple
Fails to recognize optional arguments in NamedTuple
May 24, 2023
Summary
NamedTuples
with optional / default values still show as "required"Environment and Version
Steps to Reproduce
Since Python 3.7 (I think?) one can define a
NamedTuple
with default values as so:which behaves as follows:
Rendering this code with
mkdocstrings-python
results in the following:Workaround
Not that I've been able to figure out (besides just not using
NamedTuple
)Severity
Annoying.
Desired Outcome
Fix
Urgency
None
The text was updated successfully, but these errors were encountered: