fix attribute error for python <3.10

This commit is contained in:
2025-10-06 16:57:38 +02:00
parent c68aa29141
commit 20122eb32e

View File

@@ -47,7 +47,10 @@ class ArgParsable:
optional = False
value = getattr(cls, key, None)
cls.__doc__ += f" {key} ({typ.__name__})"
try:
cls.__doc__ += f" {key} ({typ.__name__})"
except AttributeError:
cls.__doc__ += f" {key}"
if isinstance(value, Field):
if value.default is not MISSING:
cls.__doc__ += f" = {value.default}"