Skip to content

Commit f7abd42

Browse files
Andersson007claude
andcommitted
Change pragma no cover
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e823585 commit f7abd42

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

  • src/ansible_navigator/ui_framework

src/ansible_navigator/ui_framework/ui.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def _get_input_line(self) -> str:
437437
self._curs_set(0)
438438
return user_input
439439

440-
def _display( # pragma: no cover
440+
def _display(
441441
self,
442442
lines: CursesLines,
443443
line_numbers: tuple[int, ...],
@@ -474,7 +474,15 @@ def _display( # pragma: no cover
474474
index_width = len(str(count))
475475

476476
keypad = {str(x) for x in range(10)}
477-
other_valid_keys = ["+", "-", "_", "KEY_F(5)", "^[", "\x1b", "CURSOR_ENTER"]
477+
other_valid_keys = [
478+
"+",
479+
"-",
480+
"_",
481+
"KEY_F(5)",
482+
"^[",
483+
"\x1b",
484+
"CURSOR_ENTER",
485+
] # pragma: no cover
478486

479487
while True:
480488
self._screen.erase()
@@ -490,7 +498,7 @@ def _display( # pragma: no cover
490498
line_index_str = str(line_index).rjust(index_width)
491499
prefix = f"{line_index_str}\u2502"
492500
# Apply highlight decoration when this is the selected row
493-
if (
501+
if ( # pragma: no cover
494502
indent_heading
495503
and self._highlight_line_offset is not None
496504
and idx == self._highlight_line_offset
@@ -507,7 +515,7 @@ def _display( # pragma: no cover
507515
)
508516
line_to_draw = CursesLine(highlighted_parts)
509517
else:
510-
line_to_draw = line
518+
line_to_draw = line # pragma: no cover
511519
self._add_line(
512520
window=self._screen,
513521
lineno=idx + len(heading),
@@ -533,7 +541,7 @@ def _display( # pragma: no cover
533541
if await_input:
534542
char = self._screen.getch()
535543
key = "KEY_F(5)" if char == -1 else curses.keyname(char).decode()
536-
if char in [10, 13]: # Enter key codes: 10=LF, 13=CR
544+
if char in [10, 13]: # pragma: no cover # Enter key codes: 10=LF, 13=CR
537545
key = "CURSOR_ENTER"
538546
else:
539547
key = "KEY_F(5)"
@@ -549,11 +557,11 @@ def _display( # pragma: no cover
549557
elif key in keypad or key in other_valid_keys:
550558
return_value = key
551559
elif key == "KEY_DOWN":
552-
if not indent_heading:
560+
if not indent_heading: # pragma: no cover
553561
self.scroll(max(min(self.scroll() + 1, count), viewport_height))
554562
return_value = key
555563
elif key == "KEY_UP":
556-
if not indent_heading:
564+
if not indent_heading: # pragma: no cover
557565
self.scroll(max(self.scroll() - 1, viewport_height))
558566
return_value = key
559567
elif key in ["^F", "KEY_NPAGE"]:
@@ -754,7 +762,7 @@ def _show_form(self, obj: Form) -> Form:
754762
res = obj.present(screen=self._screen, ui_config=self._ui_config)
755763
return res
756764

757-
def _show_obj_from_list( # pragma: no cover
765+
def _show_obj_from_list(
758766
self,
759767
objs: ContentTypeSequence,
760768
index: int,
@@ -805,7 +813,7 @@ def _show_obj_from_list( # pragma: no cover
805813
if entry in ["KEY_DOWN", "KEY_UP", "KEY_NPAGE", "KEY_PPAGE", "^F", "^B"]:
806814
continue
807815

808-
if entry == "CURSOR_ENTER":
816+
if entry == "CURSOR_ENTER": # pragma: no cover
809817
continue
810818

811819
if entry == "KEY_RESIZE":
@@ -910,7 +918,7 @@ def _get_heading_menu_items(
910918
menu_heading, menu_items = menu_builder.build(current, columns, indices)
911919
return menu_heading, menu_items
912920

913-
def _show_menu( # pragma: no cover
921+
def _show_menu(
914922
self,
915923
current: Sequence[Any],
916924
columns: list[str],
@@ -927,7 +935,7 @@ def _show_menu( # pragma: no cover
927935
Interaction with the user
928936
"""
929937
# Reset cursor only when entering a new menu, not on refresh cycles
930-
if id(current) != self._menu_current_id:
938+
if id(current) != self._menu_current_id: # pragma: no cover
931939
self._menu_cursor_pos = None
932940
self._menu_current_id = id(current)
933941
while True:
@@ -956,8 +964,8 @@ def _show_menu( # pragma: no cover
956964
)
957965

958966
# Determine which row to highlight (only when cursor is active)
959-
self._highlight_line_offset = None
960-
if self._menu_indices and self._menu_cursor_pos is not None:
967+
self._highlight_line_offset = None # pragma: no cover
968+
if self._menu_indices and self._menu_cursor_pos is not None: # pragma: no cover
961969
self._menu_cursor_pos = max(
962970
0,
963971
min(self._menu_cursor_pos, len(self._menu_indices) - 1),
@@ -980,7 +988,7 @@ def _show_menu( # pragma: no cover
980988

981989
# Handle arrow navigation for menus when enabled
982990
if entry in ["KEY_RESIZE", "KEY_DOWN", "KEY_UP", "KEY_NPAGE", "KEY_PPAGE", "^F", "^B"]:
983-
if entry in ["KEY_DOWN", "KEY_UP"] and self._menu_indices:
991+
if entry in ["KEY_DOWN", "KEY_UP"] and self._menu_indices: # pragma: no cover
984992
# Activate cursor at position 0 on first arrow-key press (no movement)
985993
if self._menu_cursor_pos is None:
986994
self._menu_cursor_pos = 0
@@ -1016,7 +1024,7 @@ def _show_menu( # pragma: no cover
10161024
# Enter key selects the highlighted item, but only when cursor is active.
10171025
# If cursor is inactive (None), ignore the Enter entirely so it does not
10181026
# fall through to _template_match_action and trigger a spurious warning dialog.
1019-
if entry in ["CURSOR_ENTER", "^J", "^M", "KEY_ENTER", "KEY_RETURN"]:
1027+
if entry in ["CURSOR_ENTER", "^J", "^M", "KEY_ENTER", "KEY_RETURN"]: # pragma: no cover
10201028
if self._menu_cursor_pos is not None and self._menu_indices:
10211029
entry = str(self._menu_indices[self._menu_cursor_pos])
10221030
else:

0 commit comments

Comments
 (0)