Skip to content

Commit 42e1948

Browse files
committed
Black
1 parent fbdf7e8 commit 42e1948

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/mkdocstrings_handlers/python/rendering.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool:
382382

383383

384384
def _construct_docstring_according_to_strategy(
385-
name: str, obj: Object | Alias, strategy: DocstringInheritStrategy, merge_delimiter: str = "\n"
385+
name: str, obj: Object | Alias, strategy: DocstringInheritStrategy, merge_delimiter: str = "\n",
386386
) -> Docstring | None:
387387
"""Construct a docstring object according to the strategy.
388388
@@ -408,7 +408,7 @@ def _construct_docstring_according_to_strategy(
408408

409409
if strategy == DocstringInheritStrategy.merge:
410410
docstrings = []
411-
for parent in list(reversed(obj.mro())) + [obj]:
411+
for parent in [*list(reversed(obj.mro())), obj]:
412412
# Here we traverse the parents in the reverse order to build the docstring from the most general to the most specific annotations
413413
# Addtionally, we include the object itself because we don't want to miss the docstring of the object itself if present
414414
if parent.members and name in parent.members and parent.members[name].docstring:
@@ -438,7 +438,7 @@ def do_optionally_inherit_docstrings(
438438
strategy = DocstringInheritStrategy(docstring_inherit_strategy)
439439
except ValueError as e:
440440
raise ValueError(
441-
f"Unknown docstring inherit strategy: '{docstring_inherit_strategy}', allowed options are: {', '.join(strategy.value for strategy in DocstringInheritStrategy)}"
441+
f"Unknown docstring inherit strategy: '{docstring_inherit_strategy}', allowed options are: {', '.join(strategy.value for strategy in DocstringInheritStrategy)}",
442442
) from e
443443

444444
if strategy == DocstringInheritStrategy.default:
@@ -451,7 +451,7 @@ def do_optionally_inherit_docstrings(
451451
for obj, new_obj in zip(objects.values(), new_objects.values()):
452452
for member_name, new_member in new_obj.members.items():
453453
docstring = _construct_docstring_according_to_strategy(
454-
member_name, obj, strategy=strategy, merge_delimiter=docstring_merge_delimiter
454+
member_name, obj, strategy=strategy, merge_delimiter=docstring_merge_delimiter,
455455
)
456456

457457
if not docstring:

tests/test_rendering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def __init__(self, name: str, lineno: int | None = None, *, is_alias: bool = Fal
188188
],
189189
)
190190
def test_do_optionally_inherit_docstrings(
191-
strategy: rendering.DocstringInheritStrategy, docstrings_list: list[str], expected_docstrings_list: list[str]
191+
strategy: rendering.DocstringInheritStrategy, docstrings_list: list[str], expected_docstrings_list: list[str],
192192
) -> None:
193193
"""Test the inheritance strategies of docstrings for members.
194194

0 commit comments

Comments
 (0)