Skip to content

Commit 5dee873

Browse files
committed
fix linting
1 parent 56c0ee3 commit 5dee873

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

Lib/argparse.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,17 @@ def _get_action_details_for_pass(self, section, current_indent_for_section_items
210210
invocation_string = self._format_action_invocation(action_object)
211211
# Length without color codes is needed for alignment.
212212
invocation_length = len(self._decolor(invocation_string))
213-
213+
214214
collected_details.append({
215215
'action': action_object,
216216
'inv_len': invocation_length,
217217
'indent': current_indent_for_section_items,
218218
})
219219
elif hasattr(func_to_call, '__self__') and isinstance(func_to_call.__self__, self._Section):
220220
sub_section_object = func_to_call.__self__
221-
221+
222222
indent_for_subsection_items = current_indent_for_section_items + self._indent_increment
223-
223+
224224
collected_details.extend(
225225
self._get_action_details_for_pass(sub_section_object, indent_for_subsection_items)
226226
)
@@ -282,34 +282,34 @@ def format_help(self):
282282
formatted_heading_output_part = ""
283283
if self.heading is not SUPPRESS and self.heading is not None:
284284
current_section_heading_indent = ' ' * self.formatter._current_indent
285-
285+
286286
try:
287287
# This line checks if global `_` is defined.
288288
# If `_` is not defined in any accessible scope, it raises NameError.
289-
_
289+
_
290290
except NameError:
291291
# If global `_` was not found, this line defines `_` in the global scope
292292
# as a no-op lambda function.
293293
_ = lambda text_to_translate: text_to_translate
294-
294+
295295
# Now, call `_` directly. It is guaranteed to be defined at this point
296296
# (either as the original gettext `_` or the no-op lambda).
297297
# `xgettext` will correctly identify `_('%(heading)s:')` as translatable.
298298
heading_title_text = _('%(heading)s:') % {'heading': self.heading}
299-
299+
300300
theme_colors = self.formatter._theme
301301
formatted_heading_output_part = (
302302
f'{current_section_heading_indent}{theme_colors.heading}'
303303
f'{heading_title_text}{theme_colors.reset}\n'
304304
)
305-
305+
306306
section_output_parts = [
307307
'\n',
308308
formatted_heading_output_part,
309309
rendered_items_help,
310310
'\n'
311311
]
312-
312+
313313
return self.formatter._join_parts(section_output_parts)
314314

315315
def _add_item(self, func, args):
@@ -404,7 +404,7 @@ def _calculate_global_help_start_column(self, all_action_details):
404404
for detail in all_action_details:
405405
# The column where this action's invocation string ends.
406406
action_invocation_end_column = detail['indent'] + detail['inv_len']
407-
407+
408408
# An action is "reasonable" if its help text can start on the same line,
409409
# aligned at or before _adaptive_help_start_column, while maintaining minimum padding.
410410
is_reasonable_to_align_with_others = \
@@ -416,13 +416,13 @@ def _calculate_global_help_start_column(self, all_action_details):
416416
max_endpoint_of_reasonable_actions,
417417
action_invocation_end_column
418418
)
419-
419+
420420
if max_endpoint_of_reasonable_actions > 0:
421421
# At least one action fits the "reasonable" criteria.
422422
# The desired alignment column is after the longest of these "reasonable" actions, plus padding.
423423
desired_global_alignment_column = \
424424
max_endpoint_of_reasonable_actions + min_padding_between_action_and_help
425-
425+
426426
# However, this alignment should not exceed the user's preferred _adaptive_help_start_column.
427427
return min(desired_global_alignment_column, self._adaptive_help_start_column)
428428
else:
@@ -446,7 +446,7 @@ def format_help(self):
446446
# This value (self._globally_calculated_help_start_col) will be used by _format_action.
447447
self._globally_calculated_help_start_col = \
448448
self._calculate_global_help_start_column(all_action_details)
449-
449+
450450
# Second Pass: Actually format the help.
451451
# This will recursively call _Section.format_help for all sections,
452452
# which in turn call item formatters like _format_action, _format_text.
@@ -460,7 +460,7 @@ def format_help(self):
460460
# Ensure the help message ends with a single newline and strip any other leading/trailing newlines.
461461
processed_help_output = processed_help_output.strip('\n') + '\n'
462462
return processed_help_output
463-
463+
464464
return "" # Return an empty string if no help content was generated.
465465

466466
def _join_parts(self, part_strings):
@@ -691,7 +691,7 @@ def _format_action(self, action):
691691
current_action_item_indent_str = ' ' * self._current_indent
692692
globally_determined_help_start_col = self._globally_calculated_help_start_col
693693
min_padding_after_action_invocation = 2
694-
output_parts = []
694+
output_parts = []
695695

696696
# Determine the maximum length the action_invocation_string (decolored) can be
697697
# for its help text to start on the same line, aligned at globally_determined_help_start_col,
@@ -700,8 +700,8 @@ def _format_action(self, action):
700700
globally_determined_help_start_col - self._current_indent - min_padding_after_action_invocation
701701

702702
action_invocation_line_part = ""
703-
help_should_start_on_new_line = True
704-
703+
help_should_start_on_new_line = True
704+
705705
# The actual column where the first line of help text (and subsequent wrapped lines) will start.
706706
actual_help_text_alignment_column = globally_determined_help_start_col
707707

@@ -713,10 +713,10 @@ def _format_action(self, action):
713713
# Calculate the number of padding spaces needed to align the help text correctly.
714714
num_padding_spaces = globally_determined_help_start_col - \
715715
(self._current_indent + action_invocation_len_no_color)
716-
716+
717717
action_invocation_line_part = (
718718
f"{current_action_item_indent_str}{action_invocation_string}"
719-
f"{' ' * num_padding_spaces}"
719+
f"{' ' * num_padding_spaces}"
720720
)
721721
help_should_start_on_new_line = False
722722
else:
@@ -728,11 +728,11 @@ def _format_action(self, action):
728728

729729
if has_help_text:
730730
expanded_help_text = self._expand_help(action)
731-
731+
732732
# Calculate the available width for wrapping the help text.
733733
# The help text block starts at actual_help_text_alignment_column and extends to self._width.
734734
help_text_wrapping_width = max(self._width - actual_help_text_alignment_column, 11)
735-
735+
736736
split_help_lines = self._split_lines(expanded_help_text, help_text_wrapping_width)
737737

738738
if split_help_lines: # Proceed only if splitting the help text yields any lines.
@@ -747,11 +747,11 @@ def _format_action(self, action):
747747
# Append the first_help_line_content to the last part in output_parts.
748748
# (action_invocation_line_part does not end with \n in this case).
749749
output_parts[-1] += f"{first_help_line_content}\n"
750-
750+
751751
# Add any subsequent wrapped help lines, each indented to actual_help_text_alignment_column.
752752
for line_content in remaining_help_lines_content:
753753
output_parts.append(f"{' ' * actual_help_text_alignment_column}{line_content}\n")
754-
754+
755755
elif not output_parts[-1].endswith('\n'):
756756
# Case: has_help_text was true (action.help existed), but it was empty after strip()
757757
# or _split_lines returned empty. If action_invocation_line_part didn't end with \n

0 commit comments

Comments
 (0)