def _str_to_type_from_member_module(cls, module_, string):
"""
:type module_: module
:type string: str
:rtype: type
:raise: BunqException when could not find the class for the string.
"""
module_name_short, class_name = string.split(cls._DELIMITER_MODULE)
members = inspect.getmembers(module_, inspect.ismodule)
for name, module_member in members:
if module_name_short == name:
return getattr(module_member, class_name)
error_message = cls._ERROR_COULD_NOT_FIND_CLASS.format(string)
raise exception.BunqException(error_message)
评论列表
文章目录