Skip to content

Commit ad56aeb

Browse files
authored
Final formatting
1 parent 833e741 commit ad56aeb

File tree

1 file changed

+3
-7
lines changed
  • pydocstringformatter/_formatting

1 file changed

+3
-7
lines changed

pydocstringformatter/_formatting/base.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,13 @@ def treat_string(
234234
quotes_length: Literal[1, 3],
235235
) -> str:
236236
"""Split numpydoc sections, pass them for processing, then rejoin them."""
237-
# Split sections
238237
lines = tokeninfo.string[quotes_length:-quotes_length].split("\n")
239-
# handle the spaces before the closing quotes
238+
# Handle the spaces before the closing quotes
240239
last_line = lines[-1]
241240
if lines[-1].isspace():
242241
lines[-1] = ""
243242

244-
# Everything before the first section header is in a single
245-
# summary/deprecation warning/extended summary section. This
246-
# section is called "Summary".
243+
# Split sections
247244
section_hyphen_lines = [
248245
index
249246
for index, line in enumerate(lines)
@@ -252,7 +249,6 @@ def treat_string(
252249
section_starts = (
253250
[0] + [index - 1 for index in section_hyphen_lines] + [len(lines)]
254251
)
255-
256252
sections = OrderedDict(
257253
[
258254
(
@@ -264,6 +260,7 @@ def treat_string(
264260
)
265261
]
266262
)
263+
267264
if not section_hyphen_lines or section_hyphen_lines[0] > 1:
268265
# The "Summary" section here includes the numpydoc
269266
# summary, deprecation warning, and extended summary
@@ -272,7 +269,6 @@ def treat_string(
272269
_, summary_section = sections.popitem(last=False)
273270
sections["Summary"] = summary_section
274271
sections.move_to_end("Summary", last=False)
275-
del lines, section_hyphen_lines
276272

277273
# Process sections
278274
new_sections = self.treat_sections(sections)

0 commit comments

Comments
 (0)