Improved docstring parser logic.

This commit is contained in:
Fabio Manganiello 2023-09-30 12:35:31 +02:00
parent e6f05dfe07
commit 15d06fa5c2
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 2 additions and 5 deletions

View file

@ -130,7 +130,7 @@ class RunnablePlugin(Plugin):
): ):
""" """
:param poll_interval: How often the :meth:`.loop` function should be :param poll_interval: How often the :meth:`.loop` function should be
execute (default: 15 seconds). *NOTE*: For back-compatibility executed (default: 15 seconds). *NOTE*: For back-compatibility
reasons, the `poll_seconds` argument is also supported, but it's reasons, the `poll_seconds` argument is also supported, but it's
deprecated. deprecated.
:param stop_timeout: How long we should wait for any running :param stop_timeout: How long we should wait for any running

View file

@ -133,7 +133,7 @@ class DocstringParser:
return None return None
lines = text.split("\n") lines = text.split("\n")
return (lines[0] + tw.dedent("\n".join(lines[1:]) or "")).strip() return (lines[0] + " " + tw.dedent("\n".join(lines[1:]) or "")).strip()
ctx = ParseContext(obj) ctx = ParseContext(obj)
yield ctx yield ctx
@ -179,9 +179,6 @@ class DocstringParser:
ctx.state = ParseState.PARAM ctx.state = ParseState.PARAM
idx = len(ctx.parsed_params) idx = len(ctx.parsed_params)
ctx.cur_param = m.group("name") ctx.cur_param = m.group("name")
if ctx.cur_param not in ctx.param_names:
return
ctx.parsed_params[ctx.cur_param] = Parameter( ctx.parsed_params[ctx.cur_param] = Parameter(
name=ctx.cur_param, name=ctx.cur_param,
required=( required=(