utils.py 文件源码

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

项目:iotronic-lightning-rod 作者: openstack 项目源码 文件源码
def plug_and_play(self, new_module, new_class):
        LOG.info("LR modules loaded:\n\t" + new_module)

        # Updating entry_points
        with open(entry_points_name, 'a') as entry_points:
            entry_points.write(
                new_module +
                '= iotronic_lightningrod.modules.' + new_module + ':'
                + new_class
            )

            # Reload entry_points
            refresh_stevedore('s4t.modules')
            LOG.info("New entry_points loaded!")

        # Reading updated entry_points
        named_objects = {}
        for ep in pkg_resources.iter_entry_points(group='s4t.modules'):
            named_objects.update({ep.name: ep.load()})

        yield named_objects

        SESSION.disconnect()

        returnValue(str(named_objects))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号