@@ -4224,7 +4224,7 @@ def do_shell(self, args: argparse.Namespace) -> None:
42244224 kwargs ['executable' ] = shell
42254225
42264226 # Create a list of arguments to shell
4227- tokens = [args .command ] + args .command_args
4227+ tokens = [args .command , * args .command_args ]
42284228
42294229 # Expand ~ where needed
42304230 utils .expand_user_in_tokens (tokens )
@@ -4530,7 +4530,7 @@ def do_run_pyscript(self, args: argparse.Namespace) -> Optional[bool]:
45304530
45314531 try :
45324532 # Overwrite sys.argv to allow the script to take command line arguments
4533- sys .argv = [args .script_path ] + args .script_arguments
4533+ sys .argv = [args .script_path , * args .script_arguments ]
45344534
45354535 # self.last_resort will be set by _run_python()
45364536 py_return = self ._run_python (pyscript = args .script_path )
@@ -5562,7 +5562,7 @@ def _validate_postparsing_callable(cls, func: Callable[[plugin.PostparsingData],
55625562 """Check parameter and return types for postparsing hooks"""
55635563 cls ._validate_callable_param_count (cast (Callable [..., Any ], func ), 1 )
55645564 signature = inspect .signature (func )
5565- _ , param = list ( signature .parameters .items ())[ 0 ]
5565+ _ , param = next ( iter ( signature .parameters .items ()))
55665566 if param .annotation != plugin .PostparsingData :
55675567 raise TypeError (f"{ func .__name__ } must have one parameter declared with type 'cmd2.plugin.PostparsingData'" )
55685568 if signature .return_annotation != plugin .PostparsingData :
@@ -5584,7 +5584,7 @@ def _validate_prepostcmd_hook(
55845584 # validate that the callable has the right number of parameters
55855585 cls ._validate_callable_param_count (cast (Callable [..., Any ], func ), 1 )
55865586 # validate the parameter has the right annotation
5587- paramname = list ( signature .parameters .keys ())[ 0 ]
5587+ paramname = next ( iter ( signature .parameters .keys ()))
55885588 param = signature .parameters [paramname ]
55895589 if param .annotation != data_type :
55905590 raise TypeError (f'argument 1 of { func .__name__ } has incompatible type { param .annotation } , expected { data_type } ' )
@@ -5613,7 +5613,7 @@ def _validate_cmdfinalization_callable(
56135613 """Check parameter and return types for command finalization hooks."""
56145614 cls ._validate_callable_param_count (func , 1 )
56155615 signature = inspect .signature (func )
5616- _ , param = list ( signature .parameters .items ())[ 0 ]
5616+ _ , param = next ( iter ( signature .parameters .items ()))
56175617 if param .annotation != plugin .CommandFinalizationData :
56185618 raise TypeError (f"{ func .__name__ } must have one parameter declared with type { plugin .CommandFinalizationData } " )
56195619 if signature .return_annotation != plugin .CommandFinalizationData :
0 commit comments