11"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
22
3+ from .unstructuredclienterror import UnstructuredClientError
34from typing import TYPE_CHECKING
45from importlib import import_module
56import builtins
7+ import sys
68
79if TYPE_CHECKING :
810 from .httpvalidationerror import (
1416 from .responsevalidationerror import ResponseValidationError
1517 from .sdkerror import SDKError
1618 from .servererror import ServerError , ServerErrorData
17- from .unstructuredclienterror import UnstructuredClientError
1819
1920__all__ = [
2021 "Detail" ,
3738 "SDKError" : ".sdkerror" ,
3839 "ServerError" : ".servererror" ,
3940 "ServerErrorData" : ".servererror" ,
40- "UnstructuredClientError" : ".unstructuredclienterror" ,
4141}
4242
4343
44+ def dynamic_import (modname , retries = 3 ):
45+ for attempt in range (retries ):
46+ try :
47+ return import_module (modname , __package__ )
48+ except KeyError :
49+ # Clear any half-initialized module and retry
50+ sys .modules .pop (modname , None )
51+ if attempt == retries - 1 :
52+ break
53+ raise KeyError (f"Failed to import module '{ modname } ' after { retries } attempts" )
54+
55+
4456def __getattr__ (attr_name : str ) -> object :
4557 module_name = _dynamic_imports .get (attr_name )
4658 if module_name is None :
@@ -49,7 +61,7 @@ def __getattr__(attr_name: str) -> object:
4961 )
5062
5163 try :
52- module = import_module (module_name , __package__ )
64+ module = dynamic_import (module_name )
5365 result = getattr (module , attr_name )
5466 return result
5567 except ImportError as e :
0 commit comments