@@ -850,7 +850,7 @@ def _autoload_commands(self) -> None:
850850 all_commandset_defs = CommandSet .__subclasses__ ()
851851 existing_commandset_types = [type (command_set ) for command_set in self ._installed_command_sets ]
852852
853- def load_commandset_by_type (commandset_types : list [type [CommandSet [Any ]]]) -> None :
853+ def load_commandset_by_type (commandset_types : Sequence [type [CommandSet [Any ]]]) -> None :
854854 for cmdset_type in commandset_types :
855855 # check if the type has sub-classes. We will only auto-load leaf class types.
856856 subclasses = cmdset_type .__subclasses__ ()
@@ -2548,11 +2548,11 @@ def _perform_completion(
25482548 completer .complete , tokens = raw_tokens [1 :] if spec .preserve_quotes else tokens [1 :], cmd_set = cmd_set
25492549 )
25502550 else :
2551- completer_func = self .completedefault # type: ignore[assignment]
2551+ completer_func = self .completedefault # type: ignore[assignment, ty:invalid-assignment ]
25522552
25532553 # Not a recognized macro or command
25542554 else :
2555- completer_func = self .completedefault # type: ignore[assignment]
2555+ completer_func = self .completedefault # type: ignore[assignment, ty:invalid-assignment ]
25562556
25572557 # Otherwise we are completing the command token or performing custom completion
25582558 else :
@@ -2969,7 +2969,7 @@ def onecmd_plus_hooks(
29692969 with self .sigint_protection :
29702970 if py_bridge_call :
29712971 # Start saving command's stdout at this point
2972- self .stdout .pause_storage = False # type: ignore[attr-defined]
2972+ self .stdout .pause_storage = False # type: ignore[attr-defined, ty:invalid-assignment ]
29732973
29742974 redir_saved_state = self ._redirect_output (statement )
29752975
@@ -3008,7 +3008,7 @@ def onecmd_plus_hooks(
30083008
30093009 if py_bridge_call :
30103010 # Stop saving command's stdout before command finalization hooks run
3011- self .stdout .pause_storage = True # type: ignore[attr-defined]
3011+ self .stdout .pause_storage = True # type: ignore[attr-defined, ty:invalid-assignment ]
30123012 except (SkipPostcommandHooks , EmptyStatement ):
30133013 # Don't do anything, but do allow command finalization hooks to run
30143014 pass
@@ -3513,7 +3513,7 @@ def _read_raw_input(
35133513 self .active_session = self .main_session
35143514
35153515 # We're not at a terminal, so we're likely reading from a file or a pipe.
3516- prompt_obj = prompt () if callable (prompt ) else prompt
3516+ prompt_obj = prompt if isinstance (prompt , ( ANSI , str )) else prompt ()
35173517 prompt_str = prompt_obj .value if isinstance (prompt_obj , ANSI ) else prompt_obj
35183518
35193519 # If this is an interactive pipe, then display the prompt first
@@ -3803,7 +3803,7 @@ def _build_alias_parser() -> Cmd2ArgumentParser:
38033803 "An alias is a command that enables replacement of a word by another string." ,
38043804 )
38053805 alias_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_description )
3806- alias_parser .epilog = TextGroup (
3806+ alias_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
38073807 "See Also" ,
38083808 "macro" ,
38093809 )
@@ -3835,7 +3835,7 @@ def _build_alias_create_parser(cls) -> Cmd2ArgumentParser:
38353835 "for the actual command the alias resolves to."
38363836 ),
38373837 )
3838- alias_create_parser .epilog = TextGroup ("Notes" , alias_create_notes )
3838+ alias_create_parser .epilog = TextGroup ("Notes" , alias_create_notes ) # type: ignore[assignment, ty:invalid-assignment]
38393839
38403840 # Add arguments
38413841 alias_create_parser .add_argument ("name" , help = "name of this alias" )
@@ -4017,7 +4017,7 @@ def _build_macro_parser() -> Cmd2ArgumentParser:
40174017 "A macro is similar to an alias, but it can contain argument placeholders." ,
40184018 )
40194019 macro_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_description )
4020- macro_parser .epilog = TextGroup (
4020+ macro_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
40214021 "See Also" ,
40224022 "alias" ,
40234023 )
@@ -4080,7 +4080,7 @@ def _build_macro_create_parser(cls) -> Cmd2ArgumentParser:
40804080 "This default behavior changes if custom completion for macro arguments has been implemented."
40814081 ),
40824082 )
4083- macro_create_parser .epilog = TextGroup ("Notes" , macro_create_notes )
4083+ macro_create_parser .epilog = TextGroup ("Notes" , macro_create_notes ) # type: ignore[assignment, ty:invalid-assignment]
40844084
40854085 # Add arguments
40864086 macro_create_parser .add_argument ("name" , help = "name of this macro" )
@@ -4575,7 +4575,7 @@ def do_shortcuts(self, _: argparse.Namespace) -> None:
45754575 @staticmethod
45764576 def _build__eof_parser () -> Cmd2ArgumentParser :
45774577 _eof_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Called when Ctrl-D is pressed." )
4578- _eof_parser .epilog = TextGroup (
4578+ _eof_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
45794579 "Note" ,
45804580 "This command is for internal use and is not intended to be called from the command line." ,
45814581 )
@@ -5035,7 +5035,7 @@ def py_quit() -> None:
50355035 # Check if we are running Python code
50365036 if py_code_to_run :
50375037 try : # noqa: SIM105
5038- interp .runcode (py_code_to_run ) # type: ignore[arg-type]
5038+ interp .runcode (py_code_to_run ) # type: ignore[arg-type, ty:invalid-argument-type ]
50395039 except BaseException : # noqa: BLE001, S110
50405040 # We don't care about any exception that happened in the Python code
50415041 pass
@@ -5421,11 +5421,11 @@ def _initialize_history(self, hist_file: str) -> None:
54215421 try :
54225422 import lzma as decompress_lib
54235423
5424- decompress_exceptions : tuple [type [Exception ]] = (decompress_lib .LZMAError ,)
5424+ decompress_exceptions : tuple [type [Exception ], ... ] = (decompress_lib .LZMAError ,)
54255425 except ModuleNotFoundError : # pragma: no cover
54265426 import bz2 as decompress_lib # type: ignore[no-redef]
54275427
5428- decompress_exceptions : tuple [type [Exception ]] = (OSError , ValueError ) # type: ignore[no-redef]
5428+ decompress_exceptions : tuple [type [Exception ], ... ] = (OSError , ValueError ) # type: ignore[no-redef]
54295429
54305430 try :
54315431 history_json = decompress_lib .decompress (compressed_bytes ).decode (encoding = "utf-8" )
@@ -5474,7 +5474,7 @@ def _persist_history(self) -> None:
54745474 def _build_edit_parser (cls ) -> Cmd2ArgumentParser :
54755475 edit_description = "Run a text editor and optionally open a file with it."
54765476 edit_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = edit_description )
5477- edit_parser .epilog = TextGroup (
5477+ edit_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
54785478 "Note" ,
54795479 Text .assemble (
54805480 "To set a new editor, run: " ,
@@ -5596,7 +5596,7 @@ def _build__relative_run_script_parser(cls) -> Cmd2ArgumentParser:
55965596 _relative_run_script_parser = cls ._build_base_run_script_parser ()
55975597
55985598 # Append to existing description
5599- _relative_run_script_parser .description = Group (
5599+ _relative_run_script_parser .description = Group ( # type: ignore[assignment, ty:invalid-assignment]
56005600 cast (Group , _relative_run_script_parser .description ),
56015601 "\n " ,
56025602 (
@@ -5605,7 +5605,7 @@ def _build__relative_run_script_parser(cls) -> Cmd2ArgumentParser:
56055605 ),
56065606 )
56075607
5608- _relative_run_script_parser .epilog = TextGroup (
5608+ _relative_run_script_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
56095609 "Note" ,
56105610 "This command is intended to be used from within a text script." ,
56115611 )
0 commit comments