Skip to main content

DocProp

ClassDataClassSource

DocProp(name: str, descr: str, type: str)

The docstring and basic information of a class property.

A class property can be defined by @property or @functools.cached_property.

Fields

NameTypeRequired
Description
namestrThe name of the property.
descrstrThe description body of the property.
typestrThe type of the property. It is usually the typehint (annotation).

Methods

as_md_text

v_1: str = self.as_md_text(renderer: ProtocolComponent)

Render as Markdown text.

Requires

NameTypeRequired
Description
rendererProtocolComponentThe renderer providing component rendering.

Returns

NameType
Description
v_1strThe Markdown text rendered from the class property.

Properties

str_v2

str_v2: str = self.str_v2

Render as V2 string.

The v2 string is in the following format:

prop_name: type = self.prop_name

which is more compact than the default string.