Skip to content

Commit 68e3862

Browse files
committed
Correctly handle escaped underscores.
1 parent 6852a39 commit 68e3862

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

flake8_params/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def get_docstring_args(docstring: str) -> Iterator[str]:
181181
for line in docstring.split('\n'):
182182
line = line.strip()
183183
if line.startswith(":param"):
184-
yield line[6:].split(':', 1)[0].strip().replace(r"\*", '*')
184+
yield line[6:].split(':', 1)[0].strip().replace(r"\*", '*').replace(r"\_", '_')
185185

186186

187187
class Visitor(flake8_helper.Visitor):

tests/example_code.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,3 +408,13 @@ def duplicated_params(tree: list) -> None:
408408
:param tree:
409409
:param tree:
410410
"""
411+
412+
413+
def has_underscores(foo, bar, baz_):
414+
r"""
415+
Does something.
416+
417+
:param foo:
418+
:param bar:
419+
:param baz\_:
420+
"""

0 commit comments

Comments
 (0)