From c82f7bbfbe3e71ea3a5dcf1075cdd1eb87febbae Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Sat, 30 Sep 2023 13:29:49 +0200
Subject: [PATCH] Ignore the default docstring text for __init__.

If no docstring is specified for a constructor, Python usually pre-fills
a standard text - "Initialize self. See help(type(self))".

We don't need this default text in our plugins documentation.
---
 platypush/utils/reflection/_parser.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/platypush/utils/reflection/_parser.py b/platypush/utils/reflection/_parser.py
index fa89def7a..888a2b603 100644
--- a/platypush/utils/reflection/_parser.py
+++ b/platypush/utils/reflection/_parser.py
@@ -99,6 +99,7 @@ class DocstringParser:
     _param_doc_re = re.compile(r"^:param\s+(?P<name>[\w_]+):\s+(?P<doc>.*)$")
     _type_doc_re = re.compile(r"^:type\s+[\w_]+:.*$")
     _return_doc_re = re.compile(r"^:return:\s+(?P<doc>.*)$")
+    _default_docstring = re.compile(r"^Initialize self. See help")
 
     def __init__(
         self,
@@ -164,6 +165,10 @@ class DocstringParser:
             ctx.state = ParseState.TYPE
             return
 
+        # Ignore the default constructor docstring
+        if cls._default_docstring.match(line):
+            return
+
         # Update the return type docstring if required
         m = cls._return_doc_re.match(line)
         if m or (ctx.state == ParseState.RETURN and cls._is_continuation_line(line)):