def _import_class_from_str(class_str):
# type: (str) -> Type
"""Given a Python class string, convert it to the Python class.
Parameters
----------
class_str : str
a Python class string/
Returns
-------
py_class : class
a Python class.
"""
sections = class_str.split('.')
module_str = '.'.join(sections[:-1])
class_str = sections[-1]
modul = importlib.import_module(module_str)
return getattr(modul, class_str)
评论列表
文章目录