1616
1717"""Command-line interface to the OpenStack APIs"""
1818
19+ import argparse
1920import sys
21+ from typing import Any
2022import warnings
2123
2224from osc_lib .api import auth
3941class OpenStackShell (shell .OpenStackShell ):
4042 client_manager : clientmanager .ClientManager
4143
42- def __init__ (self ):
44+ def __init__ (self ) -> None :
4345 command_manager = commandmanager .CommandManager (
4446 'openstack.cli' , ignored_modules = IGNORED_MODULES
4547 )
@@ -60,15 +62,20 @@ def __init__(self):
6062 # about them
6163 warnings .filterwarnings ('ignore' , module = 'openstack' )
6264
63- def build_option_parser (self , description , version , argparse_kwargs = None ):
65+ def build_option_parser (
66+ self ,
67+ description : str | None ,
68+ version : str | None ,
69+ argparse_kwargs : dict [str , Any ] | None = None ,
70+ ) -> argparse .ArgumentParser :
6471 parser = super ().build_option_parser (
6572 description , version , argparse_kwargs
6673 )
6774 parser = clientmanager .build_plugin_option_parser (parser )
6875 parser = auth .build_auth_plugins_option_parser (parser )
6976 return parser
7077
71- def _final_defaults (self ):
78+ def _final_defaults (self ) -> None :
7279 super ()._final_defaults ()
7380
7481 # Set the default plugin to admin_token if endpoint and token are given
@@ -78,7 +85,7 @@ def _final_defaults(self):
7885 else :
7986 self ._auth_type = 'password'
8087
81- def _load_plugins (self ):
88+ def _load_plugins (self ) -> None :
8289 """Load plugins via stevedore."""
8390 # Loop through extensions to get API versions
8491 for mod in clientmanager .PLUGIN_MODULES :
@@ -165,7 +172,7 @@ def _load_plugins(self):
165172 },
166173 )
167174
168- def _load_commands (self ):
175+ def _load_commands (self ) -> None :
169176 """Load commands via cliff/stevedore
170177
171178 osc-lib has no opinion on what commands should be loaded
@@ -185,7 +192,7 @@ def _load_commands(self):
185192 # }
186193 self .command_manager .add_command_group ('openstack.extension' )
187194
188- def initialize_app (self , argv ) :
195+ def initialize_app (self , argv : list [ str ]) -> None :
189196 super ().initialize_app (argv )
190197
191198 # Re-create the client_manager with our subclass
@@ -196,7 +203,7 @@ def initialize_app(self, argv):
196203 )
197204
198205
199- def main (argv = None ):
206+ def main (argv : list [ str ] | None = None ) -> int :
200207 if argv is None :
201208 argv = sys .argv [1 :]
202209
0 commit comments