core.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:BAG_framework 作者: ucb-art 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号