Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
the-13th-letter committed Sep 8, 2024
1 parent 756118f commit e01447a
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions src/_griffe/docstrings/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,6 @@ def _get_name_annotation_description(
lines: list[str],
*,
named: bool = True,
**options: Any,
) -> tuple[str | None, Any, str]:
if named:
match = _RE_NAME_ANNOTATION_DESCRIPTION.match(lines[0])
Expand Down Expand Up @@ -505,7 +504,6 @@ def _maybe_destructure_annotation(
index: int,
*,
multiple: bool = True,
**options: Any,
) -> Any:
if isinstance(annotation, ExprName):
return annotation
Expand All @@ -525,13 +523,19 @@ def _read_returns_section(
returns = []

block, new_offset = _read_block_items_maybe(
docstring, offset=offset, multiple=returns_multiple_items, **options
docstring,
offset=offset,
multiple=returns_multiple_items,
**options,
)

for index, (line_number, return_lines) in enumerate(block):
try:
name, annotation, description = _get_name_annotation_description(
docstring, line_number, return_lines, named=returns_named_value
docstring,
line_number,
return_lines,
named=returns_named_value,
)
except ValueError:
continue
Expand All @@ -550,7 +554,9 @@ def _read_returns_section(
raise ValueError
orig_annotation = annotation
annotation = _maybe_destructure_annotation(
annotation, index, multiple=returns_multiple_items
annotation,
index,
multiple=returns_multiple_items,
)
if annotation == orig_annotation:
annotation = _maybe_destructure_annotation(
Expand Down Expand Up @@ -579,13 +585,19 @@ def _read_yields_section(
yields = []

block, new_offset = _read_block_items_maybe(
docstring, offset=offset, multiple=returns_multiple_items, **options
docstring,
offset=offset,
multiple=returns_multiple_items,
**options,
)

for index, (line_number, yield_lines) in enumerate(block):
try:
name, annotation, description = _get_name_annotation_description(
docstring, line_number, yield_lines, named=returns_named_value
docstring,
line_number,
yield_lines,
named=returns_named_value,
)
except ValueError:
continue
Expand Down Expand Up @@ -623,13 +635,19 @@ def _read_receives_section(
receives = []

block, new_offset = _read_block_items_maybe(
docstring, offset=offset, multiple=receives_multiple_items, **options
docstring,
offset=offset,
multiple=receives_multiple_items,
**options,
)

for index, (line_number, receive_lines) in enumerate(block):
try:
name, annotation, description = _get_name_annotation_description(
docstring, line_number, receive_lines, named=receives_named_value
docstring,
line_number,
receive_lines,
named=receives_named_value,
)
except ValueError:
continue
Expand Down

0 comments on commit e01447a

Please sign in to comment.