summaryrefslogtreecommitdiff
path: root/pylint/extensions
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-07-08 22:57:00 +0200
committerGitHub <noreply@github.com>2022-07-08 22:57:00 +0200
commit254b260255e21f5bf7e3d10b82322a420df3cb85 (patch)
treead0732ecec102173c1d155fbb19856d86d15faaf /pylint/extensions
parent40949c530cd2c5494885f3e8a3359a9d285b1b83 (diff)
downloadpylint-git-254b260255e21f5bf7e3d10b82322a420df3cb85.tar.gz
Allow lists of default values in parameter documentation for ``Numpy`` (#7149)
Diffstat (limited to 'pylint/extensions')
-rw-r--r--pylint/extensions/_check_docs_utils.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/pylint/extensions/_check_docs_utils.py b/pylint/extensions/_check_docs_utils.py
index 3f4937f17..747fcb4ea 100644
--- a/pylint/extensions/_check_docs_utils.py
+++ b/pylint/extensions/_check_docs_utils.py
@@ -728,11 +728,22 @@ class NumpyDocstring(GoogleDocstring):
re.X | re.S | re.M,
)
+ re_default_value = r"""((['"]\w+\s*['"])|(True)|(False)|(None))"""
+
re_param_line = re.compile(
rf"""
- \s* (\*{{0,2}}\w+)(\s?(:|\n)) # identifier with potential asterisks
- \s* (?:({GoogleDocstring.re_multiple_type})(?:,\s+optional)?\n)? # optional type declaration
- \s* (.*) # optional description
+ \s* (\*{{0,2}}\w+)(\s?(:|\n)) # identifier with potential asterisks
+ \s*
+ (
+ (
+ ({GoogleDocstring.re_multiple_type}) # default type declaration
+ (,\s+optional)? # optional 'optional' indication
+ )?
+ (
+ {{({re_default_value},?\s*)+}} # set of default values
+ )?
+ \n)?
+ \s* (.*) # optional description
""",
re.X | re.S,
)