Parse the arguments list from `obj_type.__init__.__doc__` too.

This commit is contained in:
Fabio Manganiello 2023-08-07 10:06:25 +02:00
parent 1474685cc0
commit 2a30f060b4
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 9 additions and 3 deletions

View File

@ -52,9 +52,15 @@ class Model:
self.package = obj_type.__module__[len(prefix) :]
self.name = name or self.package
self.last_modified = last_modified
self.doc, argsdoc = self._parse_docstring(
doc or obj_type.__doc__ or '', obj_type=obj_type
)
docstring = doc or ''
if obj_type.__doc__:
docstring += '\n\n' + obj_type.__doc__
if hasattr(obj_type, '__init__'):
docstring += '\n\n' + (obj_type.__init__.__doc__ or '')
self.doc, argsdoc = self._parse_docstring(docstring, obj_type=obj_type)
self.args = {}
self.has_kwargs = False