2021-06-22 06:10:52 +00:00
|
|
|
import functools
|
2023-03-23 05:33:11 +00:00
|
|
|
from typing import List, Optional
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-09-04 21:44:35 +00:00
|
|
|
import sphinx.util.logging
|
2019-07-18 03:58:00 +00:00
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
from ..base import PythonMapperBase
|
|
|
|
|
|
|
|
|
2019-09-04 21:44:35 +00:00
|
|
|
LOGGER = sphinx.util.logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2021-06-26 02:30:54 +00:00
|
|
|
def _format_args(args_info, include_annotations=True, ignore_self=None):
|
2021-04-03 02:24:18 +00:00
|
|
|
result = []
|
|
|
|
|
2021-06-26 02:30:54 +00:00
|
|
|
for i, (prefix, name, annotation, default) in enumerate(args_info):
|
2022-05-31 07:45:54 +00:00
|
|
|
if i == 0 and ignore_self is not None and name == ignore_self:
|
2021-06-26 02:30:54 +00:00
|
|
|
continue
|
2023-01-17 04:15:27 +00:00
|
|
|
formatted = (
|
|
|
|
(prefix or "")
|
|
|
|
+ (name or "")
|
|
|
|
+ (f": {annotation}" if annotation and include_annotations else "")
|
|
|
|
+ ((" = {}" if annotation else "={}").format(default) if default else "")
|
2021-04-03 02:24:18 +00:00
|
|
|
)
|
|
|
|
result.append(formatted)
|
|
|
|
|
|
|
|
return ", ".join(result)
|
|
|
|
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
class PythonPythonMapper(PythonMapperBase):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""A base class for all types of representations of Python objects.
|
|
|
|
|
|
|
|
:var name: The name given to this object.
|
|
|
|
:vartype name: str
|
|
|
|
:var id: A unique identifier for this object.
|
|
|
|
:vartype id: str
|
|
|
|
:var children: The members of this object.
|
|
|
|
:vartype children: list(PythonPythonMapper)
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
language = "python"
|
|
|
|
is_callable = False
|
2020-05-16 22:28:43 +00:00
|
|
|
member_order = 0
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2023-03-23 05:33:11 +00:00
|
|
|
def __init__(self, obj, class_content="class", **kwargs) -> None:
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
self.name = obj["name"]
|
|
|
|
self.id = obj.get("full_name", self.name)
|
|
|
|
|
|
|
|
# Optional
|
2023-03-23 05:33:11 +00:00
|
|
|
self.children: List[PythonPythonMapper] = []
|
2021-08-01 01:06:12 +00:00
|
|
|
self._docstring = obj["doc"]
|
|
|
|
self._docstring_resolved = False
|
2019-06-23 19:36:58 +00:00
|
|
|
self.imported = "original_path" in obj
|
2020-01-26 01:30:59 +00:00
|
|
|
self.inherited = obj.get("inherited", False)
|
|
|
|
"""Whether this was inherited from an ancestor of the parent class.
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
# For later
|
|
|
|
self._class_content = class_content
|
|
|
|
|
2023-03-23 05:33:11 +00:00
|
|
|
self._display_cache: Optional[bool] = None
|
2019-09-04 21:44:35 +00:00
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
@property
|
|
|
|
def docstring(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""The docstring for this object.
|
|
|
|
|
|
|
|
If a docstring did not exist on the object,
|
|
|
|
this will be the empty string.
|
|
|
|
|
|
|
|
For classes this will also depend on the
|
|
|
|
:confval:`autoapi_python_class_content` option.
|
|
|
|
|
|
|
|
:type: str
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return self._docstring
|
|
|
|
|
|
|
|
@docstring.setter
|
|
|
|
def docstring(self, value):
|
|
|
|
self._docstring = value
|
2021-08-01 01:06:12 +00:00
|
|
|
self._docstring_resolved = True
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def is_undoc_member(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""Whether this object has a docstring (False) or not (True).
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return not bool(self.docstring)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def is_private_member(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""Whether this object is private (True) or not (False).
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return self.short_name.startswith("_") and not self.short_name.endswith("__")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def is_special_member(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""Whether this object is a special member (True) or not (False).
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return self.short_name.startswith("__") and self.short_name.endswith("__")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def display(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""Whether this object should be displayed in documentation.
|
|
|
|
|
|
|
|
This attribute depends on the configuration options given in
|
2020-11-14 06:47:10 +00:00
|
|
|
:confval:`autoapi_options` and the result of :event:`autoapi-skip-member`.
|
2019-04-07 00:56:05 +00:00
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-09-04 21:44:35 +00:00
|
|
|
if self._display_cache is None:
|
|
|
|
self._display_cache = not self._ask_ignore(self._should_skip())
|
|
|
|
|
|
|
|
return self._display_cache
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def summary(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""The summary line of the docstring.
|
|
|
|
|
|
|
|
The summary line is the first non-empty line, as-per :pep:`257`.
|
|
|
|
This will be the empty string if the object does not have a docstring.
|
|
|
|
|
|
|
|
:type: str
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
for line in self.docstring.splitlines():
|
|
|
|
line = line.strip()
|
|
|
|
if line:
|
|
|
|
return line
|
|
|
|
|
|
|
|
return ""
|
|
|
|
|
2019-09-04 21:44:35 +00:00
|
|
|
def _should_skip(self): # type: () -> bool
|
|
|
|
skip_undoc_member = self.is_undoc_member and "undoc-members" not in self.options
|
|
|
|
skip_private_member = (
|
|
|
|
self.is_private_member and "private-members" not in self.options
|
|
|
|
)
|
|
|
|
skip_special_member = (
|
|
|
|
self.is_special_member and "special-members" not in self.options
|
|
|
|
)
|
2020-05-17 00:36:52 +00:00
|
|
|
skip_imported_member = self.imported and "imported-members" not in self.options
|
2019-09-04 21:44:35 +00:00
|
|
|
|
2020-05-17 00:36:52 +00:00
|
|
|
return (
|
|
|
|
skip_undoc_member
|
|
|
|
or skip_private_member
|
|
|
|
or skip_special_member
|
|
|
|
or skip_imported_member
|
|
|
|
)
|
2019-09-04 21:44:35 +00:00
|
|
|
|
|
|
|
def _ask_ignore(self, skip): # type: (bool) -> bool
|
2019-10-05 22:11:23 +00:00
|
|
|
ask_result = self.app.emit_firstresult(
|
|
|
|
"autoapi-skip-member", self.type, self.id, self, skip, self.options
|
|
|
|
)
|
2019-09-04 21:44:35 +00:00
|
|
|
|
|
|
|
return ask_result if ask_result is not None else skip
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
def _children_of_type(self, type_):
|
|
|
|
return list(child for child in self.children if child.type == type_)
|
|
|
|
|
|
|
|
|
|
|
|
class PythonFunction(PythonPythonMapper):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of a function."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "function"
|
|
|
|
is_callable = True
|
2022-09-27 22:57:44 +00:00
|
|
|
member_order = 30
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-04-22 04:45:08 +00:00
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-04-22 04:45:08 +00:00
|
|
|
|
2021-04-03 02:24:18 +00:00
|
|
|
autodoc_typehints = getattr(self.app.config, "autodoc_typehints", "signature")
|
2021-04-03 18:12:42 +00:00
|
|
|
show_annotations = autodoc_typehints != "none" and not (
|
|
|
|
autodoc_typehints == "description" and not obj["overloads"]
|
|
|
|
)
|
2021-04-03 02:24:18 +00:00
|
|
|
self.args = _format_args(obj["args"], show_annotations)
|
2021-06-22 06:10:52 +00:00
|
|
|
"""The arguments to this object, formatted as a string.
|
|
|
|
|
|
|
|
:type: str
|
|
|
|
"""
|
2021-04-03 02:24:18 +00:00
|
|
|
|
|
|
|
self.return_annotation = obj["return_annotation"] if show_annotations else None
|
2019-04-22 04:45:08 +00:00
|
|
|
"""The type annotation for the return type of this function.
|
|
|
|
|
|
|
|
This will be ``None`` if an annotation
|
|
|
|
or annotation comment was not given.
|
|
|
|
|
|
|
|
:type: str or None
|
|
|
|
"""
|
2019-07-18 03:58:00 +00:00
|
|
|
self.properties = obj["properties"]
|
|
|
|
"""The properties that describe what type of function this is.
|
|
|
|
|
|
|
|
Can be only be: async
|
|
|
|
|
|
|
|
:type: list(str)
|
|
|
|
"""
|
2021-04-03 18:12:42 +00:00
|
|
|
self.overloads = [
|
|
|
|
(_format_args(args), return_annotation)
|
|
|
|
for args, return_annotation in obj["overloads"]
|
|
|
|
]
|
2023-03-30 00:30:21 +00:00
|
|
|
"""The overloaded signatures of this function.
|
|
|
|
|
|
|
|
Each tuple is a tuple of ``(args, return_annotation)``
|
2020-08-06 07:38:29 +00:00
|
|
|
|
|
|
|
:type: list(tuple(str, str))
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-04-22 04:45:08 +00:00
|
|
|
|
|
|
|
class PythonMethod(PythonFunction):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of a method."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "method"
|
|
|
|
is_callable = True
|
2020-05-16 22:28:43 +00:00
|
|
|
member_order = 50
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-07-18 03:58:00 +00:00
|
|
|
self.properties = obj["properties"]
|
|
|
|
"""The properties that describe what type of method this is.
|
|
|
|
|
|
|
|
Can be any of: abstractmethod, async, classmethod, property, staticmethod
|
|
|
|
|
|
|
|
:type: list(str)
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-09-04 21:44:35 +00:00
|
|
|
def _should_skip(self): # type: () -> bool
|
2023-01-17 04:15:27 +00:00
|
|
|
skip = super()._should_skip() or self.name in (
|
2019-09-04 21:44:35 +00:00
|
|
|
"__new__",
|
|
|
|
"__init__",
|
|
|
|
)
|
|
|
|
return self._ask_ignore(skip)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
|
2022-09-27 22:57:44 +00:00
|
|
|
class PythonProperty(PythonPythonMapper):
|
|
|
|
"""The representation of a property on a class."""
|
|
|
|
|
|
|
|
type = "property"
|
|
|
|
member_order = 60
|
|
|
|
|
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2022-09-27 22:57:44 +00:00
|
|
|
|
|
|
|
self.annotation = obj["return_annotation"]
|
|
|
|
"""The type annotation of this property.
|
|
|
|
|
|
|
|
:type: str or None
|
|
|
|
"""
|
|
|
|
self.properties = obj["properties"]
|
|
|
|
"""The properties that describe what type of property this is.
|
|
|
|
|
|
|
|
Can be any of: abstractmethod, classmethod
|
|
|
|
|
|
|
|
:type: list(str)
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
class PythonData(PythonPythonMapper):
|
|
|
|
"""Global, module level data."""
|
|
|
|
|
|
|
|
type = "data"
|
2022-09-27 22:57:44 +00:00
|
|
|
member_order = 40
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
self.value = obj.get("value")
|
2019-04-07 00:56:05 +00:00
|
|
|
"""The value of this attribute.
|
|
|
|
|
|
|
|
This will be ``None`` if the value is not constant.
|
|
|
|
|
|
|
|
:type: str or None
|
|
|
|
"""
|
2021-04-03 02:24:18 +00:00
|
|
|
self.annotation = obj.get("annotation")
|
2019-04-22 04:45:08 +00:00
|
|
|
"""The type annotation of this attribute.
|
|
|
|
|
|
|
|
This will be ``None`` if an annotation
|
|
|
|
or annotation comment was not given.
|
|
|
|
|
|
|
|
:type: str or None
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PythonAttribute(PythonData):
|
|
|
|
"""An object/class level attribute."""
|
|
|
|
|
|
|
|
type = "attribute"
|
2022-09-27 22:57:44 +00:00
|
|
|
member_order = 60
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TopLevelPythonPythonMapper(PythonPythonMapper):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""A common base class for modules and packages."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
_RENDER_LOG_LEVEL = "VERBOSE"
|
|
|
|
|
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
self.top_level_object = "." not in self.name
|
2019-04-07 00:56:05 +00:00
|
|
|
"""Whether this object is at the very top level (True) or not (False).
|
|
|
|
|
|
|
|
This will be False for subpackages and submodules.
|
|
|
|
|
|
|
|
:type: bool
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
self.subpackages = []
|
|
|
|
self.submodules = []
|
|
|
|
self.all = obj["all"]
|
2019-04-07 00:56:05 +00:00
|
|
|
"""The contents of ``__all__`` if assigned to.
|
|
|
|
|
|
|
|
Only constants are included.
|
|
|
|
This will be ``None`` if no ``__all__`` was set.
|
|
|
|
|
|
|
|
:type: list(str) or None
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def functions(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""All of the member functions.
|
|
|
|
|
|
|
|
:type: list(PythonFunction)
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return self._children_of_type("function")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def classes(self):
|
2019-04-07 00:56:05 +00:00
|
|
|
"""All of the member classes.
|
|
|
|
|
|
|
|
:type: list(PythonClass)
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
return self._children_of_type("class")
|
|
|
|
|
|
|
|
|
|
|
|
class PythonModule(TopLevelPythonPythonMapper):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of a module."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "module"
|
|
|
|
|
|
|
|
|
|
|
|
class PythonPackage(TopLevelPythonPythonMapper):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of a package."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "package"
|
|
|
|
|
|
|
|
|
|
|
|
class PythonClass(PythonPythonMapper):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of a class."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "class"
|
2022-09-27 22:57:44 +00:00
|
|
|
member_order = 20
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
def __init__(self, obj, **kwargs):
|
2023-01-17 04:15:27 +00:00
|
|
|
super().__init__(obj, **kwargs)
|
2019-03-06 06:27:57 +00:00
|
|
|
|
|
|
|
self.bases = obj["bases"]
|
2019-04-07 00:56:05 +00:00
|
|
|
"""The fully qualified names of all base classes.
|
|
|
|
|
|
|
|
:type: list(str)
|
|
|
|
"""
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2019-10-05 22:11:23 +00:00
|
|
|
@property
|
2019-03-06 06:27:57 +00:00
|
|
|
def args(self):
|
2021-04-03 02:24:18 +00:00
|
|
|
"""The arguments to this object, formatted as a string.
|
|
|
|
|
|
|
|
:type: str
|
|
|
|
"""
|
2021-06-22 06:10:52 +00:00
|
|
|
args = ""
|
|
|
|
|
|
|
|
if self.constructor:
|
2021-06-26 02:30:54 +00:00
|
|
|
autodoc_typehints = getattr(
|
|
|
|
self.app.config, "autodoc_typehints", "signature"
|
|
|
|
)
|
2021-06-22 06:10:52 +00:00
|
|
|
show_annotations = autodoc_typehints != "none" and not (
|
|
|
|
autodoc_typehints == "description" and not self.constructor.overloads
|
|
|
|
)
|
|
|
|
args_data = self.constructor.obj["args"]
|
2021-06-26 02:30:54 +00:00
|
|
|
args = _format_args(args_data, show_annotations, ignore_self="self")
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2021-06-22 06:10:52 +00:00
|
|
|
return args
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2021-06-22 06:10:52 +00:00
|
|
|
@property
|
|
|
|
def overloads(self):
|
|
|
|
overloads = []
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2021-06-22 06:10:52 +00:00
|
|
|
if self.constructor:
|
|
|
|
overload_data = self.constructor.obj["overloads"]
|
2021-06-26 02:30:54 +00:00
|
|
|
autodoc_typehints = getattr(
|
|
|
|
self.app.config, "autodoc_typehints", "signature"
|
|
|
|
)
|
|
|
|
show_annotations = autodoc_typehints not in ("none", "description")
|
2021-06-22 06:10:52 +00:00
|
|
|
overloads = [
|
2021-06-26 02:30:54 +00:00
|
|
|
(
|
|
|
|
_format_args(args, show_annotations, ignore_self="self"),
|
|
|
|
return_annotation,
|
|
|
|
)
|
2021-06-22 06:10:52 +00:00
|
|
|
for args, return_annotation in overload_data
|
|
|
|
]
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2021-06-22 06:10:52 +00:00
|
|
|
return overloads
|
2019-10-05 22:11:23 +00:00
|
|
|
|
|
|
|
@property
|
2019-03-06 06:27:57 +00:00
|
|
|
def docstring(self):
|
2021-08-01 01:06:12 +00:00
|
|
|
docstring = super().docstring
|
2019-03-06 06:27:57 +00:00
|
|
|
|
2021-08-01 01:06:12 +00:00
|
|
|
if not self._docstring_resolved and self._class_content in ("both", "init"):
|
2019-03-06 06:27:57 +00:00
|
|
|
constructor_docstring = self.constructor_docstring
|
2019-09-04 21:44:35 +00:00
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
if constructor_docstring:
|
|
|
|
if self._class_content == "both":
|
2023-01-17 04:15:27 +00:00
|
|
|
docstring = f"{docstring}\n{constructor_docstring}"
|
2019-03-06 06:27:57 +00:00
|
|
|
else:
|
|
|
|
docstring = constructor_docstring
|
|
|
|
|
|
|
|
return docstring
|
|
|
|
|
2019-10-05 22:11:23 +00:00
|
|
|
@docstring.setter
|
|
|
|
def docstring(self, value):
|
2021-08-01 01:06:12 +00:00
|
|
|
super(PythonClass, self.__class__).docstring.fset(self, value)
|
2019-10-05 22:11:23 +00:00
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
@property
|
|
|
|
def methods(self):
|
|
|
|
return self._children_of_type("method")
|
|
|
|
|
2022-09-27 22:57:44 +00:00
|
|
|
@property
|
|
|
|
def properties(self):
|
|
|
|
return self._children_of_type("property")
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
@property
|
|
|
|
def attributes(self):
|
|
|
|
return self._children_of_type("attribute")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def classes(self):
|
|
|
|
return self._children_of_type("class")
|
|
|
|
|
|
|
|
@property
|
2021-06-22 06:10:52 +00:00
|
|
|
@functools.lru_cache()
|
2019-03-06 06:27:57 +00:00
|
|
|
def constructor(self):
|
|
|
|
for child in self.children:
|
|
|
|
if child.short_name == "__init__":
|
|
|
|
return child
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def constructor_docstring(self):
|
|
|
|
docstring = ""
|
|
|
|
|
|
|
|
constructor = self.constructor
|
|
|
|
if constructor and constructor.docstring:
|
|
|
|
docstring = constructor.docstring
|
|
|
|
else:
|
|
|
|
for child in self.children:
|
|
|
|
if child.short_name == "__new__":
|
|
|
|
docstring = child.docstring
|
|
|
|
break
|
|
|
|
|
|
|
|
return docstring
|
|
|
|
|
|
|
|
|
|
|
|
class PythonException(PythonClass):
|
2020-11-14 06:47:10 +00:00
|
|
|
"""The representation of an exception class."""
|
|
|
|
|
2019-03-06 06:27:57 +00:00
|
|
|
type = "exception"
|
2022-09-27 22:57:44 +00:00
|
|
|
member_order = 10
|