@@ -250,50 +250,39 @@ 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
- # Handle the case where string doesn't contain a dot
254
253
if cls ._DELIMITER_MODULE not in string :
255
- # Try direct lookup in current module
256
254
if hasattr (module_ , string ):
257
255
return getattr (module_ , string )
258
256
259
- # Check module type and try appropriate suffix
260
257
if "object_" in module_ .__name__ :
261
- # For object_ modules, try with Object suffix
262
258
obj_name = string + "Object"
263
259
if hasattr (module_ , obj_name ):
264
260
return getattr (module_ , obj_name )
265
261
elif "endpoint" in module_ .__name__ :
266
- # For endpoint modules, try with ApiObject suffix
267
262
api_name = string + "ApiObject"
268
263
if hasattr (module_ , api_name ):
269
264
return getattr (module_ , api_name )
270
265
else :
271
- # For other modules, try ApiObject suffix as default
272
266
api_name = string + "ApiObject"
273
267
if hasattr (module_ , api_name ):
274
268
return getattr (module_ , api_name )
275
269
276
- # If not found, fallback to legacy behavior with appropriate error
277
270
error_message = cls ._ERROR_COULD_NOT_FIND_CLASS .format (string )
278
271
raise BunqException (error_message )
279
272
280
- # Original behavior for strings with dots
281
273
module_name_short , class_name = string .split (cls ._DELIMITER_MODULE )
282
274
members = inspect .getmembers (module_ , inspect .ismodule )
283
275
284
276
for name , module_member in members :
285
277
if module_name_short == name :
286
- # Try original class name first
287
278
if hasattr (module_member , class_name ):
288
279
return getattr (module_member , class_name )
289
280
290
- # If "object_" module, try with Object suffix
291
281
if "object_" in module_member .__name__ :
292
282
obj_name = class_name + "Object"
293
283
if hasattr (module_member , obj_name ):
294
284
return getattr (module_member , obj_name )
295
285
296
- # If "endpoint" module, try with ApiObject suffix
297
286
if "endpoint" in module_member .__name__ :
298
287
api_name = class_name + "ApiObject"
299
288
if hasattr (module_member , api_name ):
@@ -323,8 +312,6 @@ def _deserialize_list(cls,
323
312
324
313
return list_deserialized
325
314
326
-
327
-
328
315
@classmethod
329
316
def _fill_default_values (cls ,
330
317
cls_context : Type [T ],
0 commit comments