From 4f62c9a45466900ed88d35b68fbda4b630d9e4b2 Mon Sep 17 00:00:00 2001 From: S-Mann Date: Thu, 15 Jul 2021 22:12:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AC=20params=20with=20no=20defaultvalu?= =?UTF-8?q?e=20=20don't=20lead=20trailing=20spaces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyment/docstring.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyment/docstring.py b/pyment/docstring.py index 338f130..9c10792 100644 --- a/pyment/docstring.py +++ b/pyment/docstring.py @@ -1959,7 +1959,8 @@ def _set_raw_params(self, sep): if p[2] is not None and len(p[2]) > 0: raw += ' ' + p[2] raw += '\n' - raw += self.docs['out']['spaces'] + spaces + with_space(p[1]).strip() + description = spaces + with_space(p[1]).strip() if p[1] else '' + raw += self.docs['out']['spaces'] + description if len(p) > 2: if 'default' not in p[1].lower() and len(p) > 3 and p[3] is not None: raw += ' (Default value = ' + str(p[3]) + ')' @@ -1977,7 +1978,8 @@ def _set_raw_params(self, sep): if len(p) > 3 and p[3] is not None: raw += ', optional' raw += ')' - raw += ': ' + with_space(p[1]).strip() + description = ': ' + with_space(p[1]).strip() if p[1] else '' + raw += description if len(p) > 2: if 'default' not in p[1].lower() and len(p) > 3 and p[3] is not None: raw += ' (Default value = ' + str(p[3]) + ')' @@ -1990,7 +1992,8 @@ def _set_raw_params(self, sep): ) if len(self.docs['out']['params']): for p in self.docs['out']['params']: - raw += self.docs['out']['spaces'] + self.dst.get_key('param', 'out') + ' ' + p[0] + sep + with_space(p[1]).strip() + description = sep + with_space(p[1]).strip() if p[1] else '' + raw += self.docs['out']['spaces'] + self.dst.get_key('param', 'out') + ' ' + p[0] + description if len(p) > 2: if 'default' not in p[1].lower() and len(p) > 3 and p[3] is not None: raw += ' (Default value = ' + str(p[3]) + ')'