@@ -382,7 +382,7 @@ def _keep_object(name: str, filters: Sequence[tuple[Pattern, bool]]) -> bool:
382382
383383
384384def _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 :
0 commit comments