Skip to content

Commit

Permalink
Special case args and kwargs in numpy/google arg list
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc committed Apr 2, 2020
1 parent 8a7ed3c commit 9aa4123
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions flake8_rst_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,28 @@ def run(self):
assert 0 < code < 100, code
code += 100 * rst_error.level
msg = "%s%03i %s" % (rst_prefix, code, msg)
if code == 213:
if "\nArgs:\n" in unindented and unindented.find(
"\nArgs:\n"
) < unindented.find(" *args:"):
# Ignore special case used in Google docstring style
continue
if "\nParameters\n----------\n" in unindented and unindented.find(
"\nParameters\n----------\n"
) < unindented.find("\n*args\n"):
# Ignore special case used in NumPy docstring style
continue
if code == 210:
if "\nArgs:\n" in unindented and unindented.find(
"\nArgs:\n"
) < unindented.find(" **kwargs:"):
# Ignore special case used in Google docstring style
continue
if "\nParameters\n----------\n" in unindented and unindented.find(
"\nParameters\n----------\n"
) < unindented.find("\n**kwargs\n"):
# Ignore special case used in NumPy docstring style
continue

# This will return the line number by combining the
# start of the docstring with the offet within it.
Expand Down

0 comments on commit 9aa4123

Please sign in to comment.