2020import importlib
2121import logging
2222import sys
23- import typing as ty
23+ from typing import TYPE_CHECKING , Any , Protocol , TypeVar , runtime_checkable
2424
2525from osc_lib .cli import client_config
2626from osc_lib import clientmanager
2727from osc_lib import shell
2828import stevedore
2929
30- if ty . TYPE_CHECKING :
30+ if TYPE_CHECKING :
3131 from keystoneauth1 import access as ksa_access
3232 from openstack .compute .v2 import _proxy as compute_proxy
3333 from openstack .image .v2 import _proxy as image_proxy
3737
3838LOG = logging .getLogger (__name__ )
3939
40- PLUGIN_MODULES : list [ty . Any ] = []
40+ PLUGIN_MODULES : list [Any ] = []
4141
4242USER_AGENT = 'python-openstackclient'
4343
@@ -50,7 +50,7 @@ class ClientManager(clientmanager.ClientManager):
5050 in osc-lib so we need to maintain a transition period.
5151 """
5252
53- if ty . TYPE_CHECKING :
53+ if TYPE_CHECKING :
5454 # we know this will be set by us and will not be nullable
5555 auth_ref : ksa_access .AccessInfo
5656
@@ -62,11 +62,11 @@ class ClientManager(clientmanager.ClientManager):
6262 # services...
6363 # TODO(stephenfin): We also need to migrate object storage...
6464 compute : compute_proxy .Proxy
65- identity : ty . Any
65+ identity : Any
6666 image : image_proxy .Proxy
6767 network : network_proxy .Proxy
6868 object_store : object_store_v1 .APIv1
69- volume : ty . Any
69+ volume : Any
7070
7171 def __init__ (
7272 self ,
@@ -179,17 +179,17 @@ def is_volume_endpoint_enabled(self, volume_client=None):
179179
180180# Plugin Support
181181
182- ArgumentParserT = ty . TypeVar ('ArgumentParserT' , bound = argparse .ArgumentParser )
182+ ArgumentParserT = TypeVar ('ArgumentParserT' , bound = argparse .ArgumentParser )
183183
184184
185- @ty . runtime_checkable # Optional: allows usage with isinstance()
186- class PluginModule (ty . Protocol ):
185+ @runtime_checkable # Optional: allows usage with isinstance()
186+ class PluginModule (Protocol ):
187187 DEFAULT_API_VERSION : str
188188 API_VERSION_OPTION : str
189189 API_NAME : str
190190 API_VERSIONS : tuple [str ]
191191
192- make_client : Callable [..., ty . Any ]
192+ make_client : Callable [..., Any ]
193193 build_option_parser : Callable [[ArgumentParserT ], ArgumentParserT ]
194194 check_api_version : Callable [[str ], bool ]
195195
0 commit comments