Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration of trailing commas in multi-line signatures #12975

Merged
merged 22 commits into from
Jan 21, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
TLouf committed Oct 19, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
commit b91693707c13155121c6b096032463489179d989
3 changes: 2 additions & 1 deletion sphinx/writers/html5.py
Original file line number Diff line number Diff line change
@@ -287,7 +287,8 @@ def depart_desc_optional(self, node: Element) -> None:
level = self.optional_param_level
if self.multi_line_parameter_list:
max_level = self.max_optional_param_level
is_last_group = self.param_group_index + 1 == len(self.list_is_required_param)
len_lirp = len(self.list_is_required_param)
is_last_group = self.param_group_index + 1 == len_lirp
# If it's the first time we go down one level, add the separator before the
# bracket, except if this is the last parameter and the parameter list
# should not feature a trailing comma.
3 changes: 2 additions & 1 deletion sphinx/writers/latex.py
Original file line number Diff line number Diff line change
@@ -1061,7 +1061,8 @@ def depart_desc_optional(self, node: Element) -> None:
level = self.optional_param_level
if self.multi_line_parameter_list:
max_level = self.max_optional_param_level
is_last_group = self.param_group_index + 1 == len(self.list_is_required_param)
len_lirp = len(self.list_is_required_param)
is_last_group = self.param_group_index + 1 == len_lirp
# If it's the first time we go down one level, add the separator before the
# bracket, except if this is the last parameter and the parameter list
# should not feature a trailing comma.
3 changes: 2 additions & 1 deletion sphinx/writers/text.py
Original file line number Diff line number Diff line change
@@ -743,7 +743,8 @@ def depart_desc_optional(self, node: Element) -> None:
level = self.optional_param_level
if self.multi_line_parameter_list:
max_level = self.max_optional_param_level
is_last_group = self.param_group_index + 1 == len(self.list_is_required_param)
len_lirp = len(self.list_is_required_param)
is_last_group = self.param_group_index + 1 == len_lirp
# If it's the first time we go down one level, add the separator before the
# bracket, except if this is the last parameter and the parameter list
# should not feature a trailing comma.