From 2a30f060b442b52e534cb3459d47766fb3210ed5 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 7 Aug 2023 10:06:25 +0200 Subject: [PATCH] Parse the arguments list from `obj_type.__init__.__doc__` too. --- platypush/plugins/inspect/_model.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platypush/plugins/inspect/_model.py b/platypush/plugins/inspect/_model.py index d0ea558255..6bfa50d5e5 100644 --- a/platypush/plugins/inspect/_model.py +++ b/platypush/plugins/inspect/_model.py @@ -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