@@ -250,10 +250,12 @@ def _str_to_type_from_member_module(cls,
250
250
"""
251
251
:raise: BunqException when could not find the class for the string.
252
252
"""
253
+ # First try: direct attribute lookup by name
253
254
if cls ._DELIMITER_MODULE not in string :
254
255
if hasattr (module_ , string ):
255
256
return getattr (module_ , string )
256
257
258
+ # Second try: check for naming conventions based on module type
257
259
if "object_" in module_ .__name__ :
258
260
obj_name = string + "Object"
259
261
if hasattr (module_ , obj_name ):
@@ -270,14 +272,18 @@ def _str_to_type_from_member_module(cls,
270
272
error_message = cls ._ERROR_COULD_NOT_FIND_CLASS .format (string )
271
273
raise BunqException (error_message )
272
274
275
+ # Handle module.class notation using delimiter
273
276
module_name_short , class_name = string .split (cls ._DELIMITER_MODULE )
274
277
members = inspect .getmembers (module_ , inspect .ismodule )
275
278
279
+ # Search through submodules for the class
276
280
for name , module_member in members :
277
281
if module_name_short == name :
282
+ # Try direct class lookup first
278
283
if hasattr (module_member , class_name ):
279
284
return getattr (module_member , class_name )
280
285
286
+ # Try to find object via naming conventions
281
287
if "object_" in module_member .__name__ :
282
288
obj_name = class_name + "Object"
283
289
if hasattr (module_member , obj_name ):
0 commit comments