Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake8_docstrings_complete/docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class Docstring(NamedTuple):
"raises": {"raises", "raise"},
}
_WHITESPACE_REGEX = r"\s*"
_SECTION_NAME_PATTERN = re.compile(rf"{_WHITESPACE_REGEX}(\w+):")
_SUB_SECTION_PATTERN = re.compile(rf"{_WHITESPACE_REGEX}(\w+)( \(.*\))?:")
_SECTION_NAME_PATTERN = re.compile(rf"{_WHITESPACE_REGEX}(\w+)(:|\n{_WHITESPACE_REGEX}-+$)")
_SUB_SECTION_PATTERN = re.compile(rf"{_WHITESPACE_REGEX}(\w+)( \(.*\))?\s?:")
_SECTION_END_PATTERN = re.compile(rf"{_WHITESPACE_REGEX}$")


Expand All @@ -82,7 +82,7 @@ def _get_sections(lines: Iterable[str]) -> Iterator[_Section]:
with contextlib.suppress(StopIteration):
while True:
# Find the start of the next section
section_start = next(line for line in lines if line.strip())
section_start = next(line for line in lines if line.strip()) + "\n" + next(lines)
section_name_match = _SECTION_NAME_PATTERN.match(section_start)
section_name = section_name_match.group(1) if section_name_match else None

Expand Down