@@ -250,50 +250,39 @@ def _str_to_type_from_member_module(cls,
250250 """
251251 :raise: BunqException when could not find the class for the string.
252252 """
253- # Handle the case where string doesn't contain a dot
254253 if cls ._DELIMITER_MODULE not in string :
255- # Try direct lookup in current module
256254 if hasattr (module_ , string ):
257255 return getattr (module_ , string )
258256
259- # Check module type and try appropriate suffix
260257 if "object_" in module_ .__name__ :
261- # For object_ modules, try with Object suffix
262258 obj_name = string + "Object"
263259 if hasattr (module_ , obj_name ):
264260 return getattr (module_ , obj_name )
265261 elif "endpoint" in module_ .__name__ :
266- # For endpoint modules, try with ApiObject suffix
267262 api_name = string + "ApiObject"
268263 if hasattr (module_ , api_name ):
269264 return getattr (module_ , api_name )
270265 else :
271- # For other modules, try ApiObject suffix as default
272266 api_name = string + "ApiObject"
273267 if hasattr (module_ , api_name ):
274268 return getattr (module_ , api_name )
275269
276- # If not found, fallback to legacy behavior with appropriate error
277270 error_message = cls ._ERROR_COULD_NOT_FIND_CLASS .format (string )
278271 raise BunqException (error_message )
279272
280- # Original behavior for strings with dots
281273 module_name_short , class_name = string .split (cls ._DELIMITER_MODULE )
282274 members = inspect .getmembers (module_ , inspect .ismodule )
283275
284276 for name , module_member in members :
285277 if module_name_short == name :
286- # Try original class name first
287278 if hasattr (module_member , class_name ):
288279 return getattr (module_member , class_name )
289280
290- # If "object_" module, try with Object suffix
291281 if "object_" in module_member .__name__ :
292282 obj_name = class_name + "Object"
293283 if hasattr (module_member , obj_name ):
294284 return getattr (module_member , obj_name )
295285
296- # If "endpoint" module, try with ApiObject suffix
297286 if "endpoint" in module_member .__name__ :
298287 api_name = class_name + "ApiObject"
299288 if hasattr (module_member , api_name ):
@@ -323,8 +312,6 @@ def _deserialize_list(cls,
323312
324313 return list_deserialized
325314
326-
327-
328315 @classmethod
329316 def _fill_default_values (cls ,
330317 cls_context : Type [T ],
0 commit comments