@@ -250,10 +250,12 @@ def _str_to_type_from_member_module(cls,
250250 """
251251 :raise: BunqException when could not find the class for the string.
252252 """
253+ # First try: direct attribute lookup by name
253254 if cls ._DELIMITER_MODULE not in string :
254255 if hasattr (module_ , string ):
255256 return getattr (module_ , string )
256257
258+ # Second try: check for naming conventions based on module type
257259 if "object_" in module_ .__name__ :
258260 obj_name = string + "Object"
259261 if hasattr (module_ , obj_name ):
@@ -270,14 +272,18 @@ def _str_to_type_from_member_module(cls,
270272 error_message = cls ._ERROR_COULD_NOT_FIND_CLASS .format (string )
271273 raise BunqException (error_message )
272274
275+ # Handle module.class notation using delimiter
273276 module_name_short , class_name = string .split (cls ._DELIMITER_MODULE )
274277 members = inspect .getmembers (module_ , inspect .ismodule )
275278
279+ # Search through submodules for the class
276280 for name , module_member in members :
277281 if module_name_short == name :
282+ # Try direct class lookup first
278283 if hasattr (module_member , class_name ):
279284 return getattr (module_member , class_name )
280285
286+ # Try to find object via naming conventions
281287 if "object_" in module_member .__name__ :
282288 obj_name = class_name + "Object"
283289 if hasattr (module_member , obj_name ):
0 commit comments