|
48 | 48 | Callable, |
49 | 49 | Iterable, |
50 | 50 | Mapping, |
| 51 | + Sequence, |
51 | 52 | ) |
52 | 53 | from types import ( |
53 | 54 | FrameType, |
@@ -320,10 +321,10 @@ def __init__( |
320 | 321 | include_py: bool = False, |
321 | 322 | include_ipy: bool = False, |
322 | 323 | allow_cli_args: bool = True, |
323 | | - transcript_files: list[str] | None = None, |
| 324 | + transcript_files: Sequence[str] | None = None, |
324 | 325 | allow_redirection: bool = True, |
325 | | - multiline_commands: list[str] | None = None, |
326 | | - terminators: list[str] | None = None, |
| 326 | + multiline_commands: Iterable[str] | None = None, |
| 327 | + terminators: Iterable[str] | None = None, |
327 | 328 | shortcuts: dict[str, str] | None = None, |
328 | 329 | command_sets: Iterable[CommandSet] | None = None, |
329 | 330 | auto_load_commands: bool = False, |
@@ -568,7 +569,7 @@ def __init__( |
568 | 569 | elif callargs: |
569 | 570 | self._startup_commands.extend(callargs) |
570 | 571 | elif transcript_files: |
571 | | - self._transcript_files = transcript_files |
| 572 | + self._transcript_files = list(transcript_files) |
572 | 573 |
|
573 | 574 | # Set the pager(s) for use when displaying output using a pager |
574 | 575 | if sys.platform.startswith('win'): |
@@ -2870,7 +2871,7 @@ def _run_cmdfinalization_hooks(self, stop: bool, statement: Statement | None) -> |
2870 | 2871 |
|
2871 | 2872 | def runcmds_plus_hooks( |
2872 | 2873 | self, |
2873 | | - cmds: list[HistoryItem] | list[str], |
| 2874 | + cmds: Iterable[HistoryItem] | Iterable[str], |
2874 | 2875 | *, |
2875 | 2876 | add_to_history: bool = True, |
2876 | 2877 | stop_on_keyboard_interrupt: bool = False, |
@@ -4218,7 +4219,7 @@ def do_help(self, args: argparse.Namespace) -> None: |
4218 | 4219 | self.perror(err_msg, style=None) |
4219 | 4220 | self.last_result = False |
4220 | 4221 |
|
4221 | | - def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol: int) -> None: # noqa: ARG002 |
| 4222 | + def print_topics(self, header: str, cmds: Sequence[str] | None, cmdlen: int, maxcol: int) -> None: # noqa: ARG002 |
4222 | 4223 | """Print groups of commands and topics in columns and an optional header. |
4223 | 4224 |
|
4224 | 4225 | Override of cmd's print_topics() to use Rich. |
@@ -4307,7 +4308,7 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose |
4307 | 4308 | self.poutput(category_grid) |
4308 | 4309 | self.poutput() |
4309 | 4310 |
|
4310 | | - def render_columns(self, str_list: list[str] | None, display_width: int = 80) -> str: |
| 4311 | + def render_columns(self, str_list: Sequence[str] | None, display_width: int = 80) -> str: |
4311 | 4312 | """Render a list of single-line strings as a compact set of columns. |
4312 | 4313 |
|
4313 | 4314 | This method correctly handles strings containing ANSI style sequences and |
@@ -4366,7 +4367,7 @@ def render_columns(self, str_list: list[str] | None, display_width: int = 80) -> |
4366 | 4367 |
|
4367 | 4368 | return "\n".join(rows) |
4368 | 4369 |
|
4369 | | - def columnize(self, str_list: list[str] | None, display_width: int = 80) -> None: |
| 4370 | + def columnize(self, str_list: Sequence[str] | None, display_width: int = 80) -> None: |
4370 | 4371 | """Display a list of single-line strings as a compact set of columns. |
4371 | 4372 |
|
4372 | 4373 | Override of cmd's columnize() that uses the render_columns() method. |
|
0 commit comments