forked from platypush/platypush
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.
This commit is contained in:
parent
d030e2b8c7
commit
c82f7bbfbe
1 changed files with 5 additions and 0 deletions
|
@ -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)):
|
||||
|
|
Loading…
Reference in a new issue