fypp.py 文件源码

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

项目:fypp 作者: aradi 项目源码 文件源码
def import_module(self, module):
        '''Import a module into the evaluator.

        Note: Import only trustworthy modules! Module imports are global,
        therefore, importing a malicious module which manipulates other global
        modules could affect code behaviour outside of the Evaluator as well.

        Args:
            module (str): Python module to import.

        Raises:
            FyppFatalError: If module could not be imported.

        '''
        rootmod = module.split('.', 1)[0]
        try:
            imported = __import__(module, self._scope)
            self.define(rootmod, imported)
        except Exception as exc:
            msg = "failed to import module '{0}'".format(module)
            raise FyppFatalError(msg, cause=exc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号