get_field_docstrings
函数源码
v_1: dict[str, str | None] = get_field_docstrings(model_cls: type[Any], include_dyn_assign: bool = False)
从类的源代码中,捕获每个赋值语句后接的 docstring。
参数
输入
| 参数 | 类型 | 必选 | |
|---|---|---|---|
model_cls | type[Any] | 待分析的类。 | |
include_dyn_assign | bool | 默认情形下,该方法只会探测以下形式语句后的 docstring: 如果该标记启用,则也会探测以下形式语句后的 docstring: |
输出
| 参数 | 类型 | |
|---|---|---|
v_1 | dict[str, str | None] | 各字段的 docstring。如果某个关键字对应的值是None,则表明对应的字段没有配置 docstring。 |