@@ -849,7 +849,7 @@ def _autoload_commands(self) -> None:
849849 all_commandset_defs = CommandSet .__subclasses__ ()
850850 existing_commandset_types = [type (command_set ) for command_set in self ._installed_command_sets ]
851851
852- def load_commandset_by_type (commandset_types : list [type [CommandSet [Any ]]]) -> None :
852+ def load_commandset_by_type (commandset_types : Sequence [type [CommandSet [Any ]]]) -> None :
853853 for cmdset_type in commandset_types :
854854 # check if the type has sub-classes. We will only auto-load leaf class types.
855855 subclasses = cmdset_type .__subclasses__ ()
@@ -2547,11 +2547,11 @@ def _perform_completion(
25472547 completer .complete , tokens = raw_tokens [1 :] if spec .preserve_quotes else tokens [1 :], cmd_set = cmd_set
25482548 )
25492549 else :
2550- completer_func = self .completedefault # type: ignore[assignment]
2550+ completer_func = self .completedefault # type: ignore[assignment, ty:invalid-assignment ]
25512551
25522552 # Not a recognized macro or command
25532553 else :
2554- completer_func = self .completedefault # type: ignore[assignment]
2554+ completer_func = self .completedefault # type: ignore[assignment, ty:invalid-assignment ]
25552555
25562556 # Otherwise we are completing the command token or performing custom completion
25572557 else :
@@ -2968,7 +2968,7 @@ def onecmd_plus_hooks(
29682968 with self .sigint_protection :
29692969 if py_bridge_call :
29702970 # Start saving command's stdout at this point
2971- self .stdout .pause_storage = False # type: ignore[attr-defined]
2971+ self .stdout .pause_storage = False # type: ignore[attr-defined, ty:invalid-assignment ]
29722972
29732973 redir_saved_state = self ._redirect_output (statement )
29742974
@@ -3007,7 +3007,7 @@ def onecmd_plus_hooks(
30073007
30083008 if py_bridge_call :
30093009 # Stop saving command's stdout before command finalization hooks run
3010- self .stdout .pause_storage = True # type: ignore[attr-defined]
3010+ self .stdout .pause_storage = True # type: ignore[attr-defined, ty:invalid-assignment ]
30113011 except (SkipPostcommandHooks , EmptyStatement ):
30123012 # Don't do anything, but do allow command finalization hooks to run
30133013 pass
@@ -3512,7 +3512,7 @@ def _read_raw_input(
35123512 self .active_session = self .main_session
35133513
35143514 # We're not at a terminal, so we're likely reading from a file or a pipe.
3515- prompt_obj = prompt () if callable (prompt ) else prompt
3515+ prompt_obj = prompt if isinstance (prompt , ( ANSI , str )) else prompt ()
35163516 prompt_str = prompt_obj .value if isinstance (prompt_obj , ANSI ) else prompt_obj
35173517
35183518 # If this is an interactive pipe, then display the prompt first
@@ -3800,7 +3800,7 @@ def _build_alias_parser() -> Cmd2ArgumentParser:
38003800 "An alias is a command that enables replacement of a word by another string." ,
38013801 )
38023802 alias_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = alias_description )
3803- alias_parser .epilog = TextGroup (
3803+ alias_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
38043804 "See Also" ,
38053805 "macro" ,
38063806 )
@@ -3832,7 +3832,7 @@ def _build_alias_create_parser(cls) -> Cmd2ArgumentParser:
38323832 "for the actual command the alias resolves to."
38333833 ),
38343834 )
3835- alias_create_parser .epilog = TextGroup ("Notes" , alias_create_notes )
3835+ alias_create_parser .epilog = TextGroup ("Notes" , alias_create_notes ) # type: ignore[assignment, ty:invalid-assignment]
38363836
38373837 # Add arguments
38383838 alias_create_parser .add_argument ("name" , help = "name of this alias" )
@@ -4014,7 +4014,7 @@ def _build_macro_parser() -> Cmd2ArgumentParser:
40144014 "A macro is similar to an alias, but it can contain argument placeholders." ,
40154015 )
40164016 macro_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = macro_description )
4017- macro_parser .epilog = TextGroup (
4017+ macro_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
40184018 "See Also" ,
40194019 "alias" ,
40204020 )
@@ -4077,7 +4077,7 @@ def _build_macro_create_parser(cls) -> Cmd2ArgumentParser:
40774077 "This default behavior changes if custom completion for macro arguments has been implemented."
40784078 ),
40794079 )
4080- macro_create_parser .epilog = TextGroup ("Notes" , macro_create_notes )
4080+ macro_create_parser .epilog = TextGroup ("Notes" , macro_create_notes ) # type: ignore[assignment, ty:invalid-assignment]
40814081
40824082 # Add arguments
40834083 macro_create_parser .add_argument ("name" , help = "name of this macro" )
@@ -4572,7 +4572,7 @@ def do_shortcuts(self, _: argparse.Namespace) -> None:
45724572 @staticmethod
45734573 def _build__eof_parser () -> Cmd2ArgumentParser :
45744574 _eof_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = "Called when Ctrl-D is pressed." )
4575- _eof_parser .epilog = TextGroup (
4575+ _eof_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
45764576 "Note" ,
45774577 "This command is for internal use and is not intended to be called from the command line." ,
45784578 )
@@ -5032,7 +5032,7 @@ def py_quit() -> None:
50325032 # Check if we are running Python code
50335033 if py_code_to_run :
50345034 try : # noqa: SIM105
5035- interp .runcode (py_code_to_run ) # type: ignore[arg-type]
5035+ interp .runcode (py_code_to_run ) # type: ignore[arg-type, ty:invalid-argument-type ]
50365036 except BaseException : # noqa: BLE001, S110
50375037 # We don't care about any exception that happened in the Python code
50385038 pass
@@ -5418,11 +5418,11 @@ def _initialize_history(self, hist_file: str) -> None:
54185418 try :
54195419 import lzma as decompress_lib
54205420
5421- decompress_exceptions : tuple [type [Exception ]] = (decompress_lib .LZMAError ,)
5421+ decompress_exceptions : tuple [type [Exception ], ... ] = (decompress_lib .LZMAError ,)
54225422 except ModuleNotFoundError : # pragma: no cover
54235423 import bz2 as decompress_lib # type: ignore[no-redef]
54245424
5425- decompress_exceptions : tuple [type [Exception ]] = (OSError , ValueError ) # type: ignore[no-redef]
5425+ decompress_exceptions : tuple [type [Exception ], ... ] = (OSError , ValueError ) # type: ignore[no-redef]
54265426
54275427 try :
54285428 history_json = decompress_lib .decompress (compressed_bytes ).decode (encoding = "utf-8" )
@@ -5471,7 +5471,7 @@ def _persist_history(self) -> None:
54715471 def _build_edit_parser (cls ) -> Cmd2ArgumentParser :
54725472 edit_description = "Run a text editor and optionally open a file with it."
54735473 edit_parser = argparse_utils .DEFAULT_ARGUMENT_PARSER (description = edit_description )
5474- edit_parser .epilog = TextGroup (
5474+ edit_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
54755475 "Note" ,
54765476 Text .assemble (
54775477 "To set a new editor, run: " ,
@@ -5593,7 +5593,7 @@ def _build__relative_run_script_parser(cls) -> Cmd2ArgumentParser:
55935593 _relative_run_script_parser = cls ._build_base_run_script_parser ()
55945594
55955595 # Append to existing description
5596- _relative_run_script_parser .description = Group (
5596+ _relative_run_script_parser .description = Group ( # type: ignore[assignment, ty:invalid-assignment]
55975597 cast (Group , _relative_run_script_parser .description ),
55985598 "\n " ,
55995599 (
@@ -5602,7 +5602,7 @@ def _build__relative_run_script_parser(cls) -> Cmd2ArgumentParser:
56025602 ),
56035603 )
56045604
5605- _relative_run_script_parser .epilog = TextGroup (
5605+ _relative_run_script_parser .epilog = TextGroup ( # type: ignore[assignment, ty:invalid-assignment]
56065606 "Note" ,
56075607 "This command is intended to be used from within a text script." ,
56085608 )
0 commit comments