Код: Выделить всё
custom_type.pyКод: Выделить всё
from typing import TypedDict
class CustomDict(TypedDict):
"""A custom type definition"""
items: list[_AnotherCustomDict]
"""The items."""
< /code>
И мой источник документации выглядит следующим образом: < /p>
custom_type.rstКод: Выделить всё
.. autoclass:: CustomDict
:members:
:member-order: bysource
:show-inheritance:
Я попытался изменить источник документации на: < /p>
Код: Выделить всё
custom_type.rstКод: Выделить всё
.. autoclass:: CustomDict
:members: items
:member-order: bysource
:show-inheritance:
Код: Выделить всё
custom_type.pyКод: Выделить всё
#: A custom type definition
CustomDict = TypedDict('CustomDict', {
'items': list[_AnotherCustomDict], #: The items.
})
К сожалению, я не могу изменить элементы на имя на Что -то еще, потому что это определено как таковое в стороннем API, которое я потребляю. Я действительно хотел бы не переименовать элементы до чего-то еще только ради документации. Atements атрибут?
my config: python 3.13, sphinx 8.1.3
Подробнее здесь: https://stackoverflow.com/questions/793 ... -typeddict