@@ -67,6 +67,7 @@ def __init__(self, provider: Optional[Any] = None, service: Optional[str] = None
6767 def accept_state_visitor (self , visitor : StateVisitor ):
6868 # needed for services like cognito-idp
6969 service_name : str = self .service .replace ("-" , "_" )
70+ LOG .debug ("Visit stores for %s" , service_name )
7071
7172 # try to load AccountRegionBundle from predictable location
7273 attribute_name = f"{ service_name } _stores"
@@ -79,7 +80,6 @@ def accept_state_visitor(self, visitor: StateVisitor):
7980 attribute = _load_attribute_from_module (module_name , attribute_name )
8081
8182 if attribute is not None :
82- LOG .debug ("Visiting attribute %s in module %s" , attribute_name , module_name )
8383 visitor .visit (attribute )
8484
8585 # try to load BackendDict from predictable location
@@ -95,7 +95,6 @@ def accept_state_visitor(self, visitor: StateVisitor):
9595 attribute = _load_attribute_from_module (module_name , attribute_name )
9696
9797 if attribute is not None :
98- LOG .debug ("Visiting attribute %s in module %s" , attribute_name , module_name )
9998 visitor .visit (attribute )
10099
101100
@@ -106,9 +105,8 @@ def _load_attribute_from_module(module_name: str, attribute_name: str) -> Any |
106105 """
107106 try :
108107 module = importlib .import_module (module_name )
109- return getattr (module , attribute_name )
110- except (ModuleNotFoundError , AttributeError ) as e :
111- LOG .debug (
112- 'Unable to get attribute "%s" for module "%s": "%s"' , attribute_name , module_name , e
113- )
108+ attr = getattr (module , attribute_name )
109+ LOG .debug ("Found attribute %s in module %s" , attribute_name , module_name )
110+ return attr
111+ except (ModuleNotFoundError , AttributeError ):
114112 return None
0 commit comments