PyDoc: add 'rtype' field for multiple return values

Ref: !131482
This commit is contained in:
nutti
2024-12-06 17:29:48 +09:00
committed by Campbell Barton
parent 503e2c46a5
commit aa81aed109

View File

@@ -1675,7 +1675,8 @@ def pyrna2sphinx(basepath):
if len(func.return_values) == 1:
write_param(" ", fw, func.return_values[0], is_return=True)
elif func.return_values: # Multiple return values.
fw(" :return ({:s}):\n".format(", ".join(prop.identifier for prop in func.return_values)))
fw(" :return:\n")
type_descrs = []
for prop in func.return_values:
# TODO: pyrna_enum2sphinx for multiple return values,
# actually don't think we even use this but still!
@@ -1690,6 +1691,7 @@ def pyrna2sphinx(basepath):
collection_id=_BPY_PROP_COLLECTION_ID,
enum_descr_override=enum_descr_override,
)
type_descrs.append(type_descr)
descr = prop.description
if not descr:
descr = prop.name
@@ -1698,6 +1700,7 @@ def pyrna2sphinx(basepath):
prop.identifier,
", ".join((val for val in (descr, type_descr) if val))
))
fw(" :rtype: ({:s})\n".format(", ".join(type_descrs)))
write_example_ref(" ", fw, struct_module_name + "." + struct_id + "." + func.identifier)