interfaces.py 文件源码

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

项目:fluffy 作者: m4ce 项目源码 文件源码
def save(self):
        """Persist the interfaces to disk"""

        try:
            logger.debug("Backing up interfaces")
            if os.path.exists(self._db):
                shutil.copyfile(self._db, "{}.bak".format(self._db))
        except Exception as e:
            logger.exception("Failed to backup interfaces")
            return

        try:
            logger.debug("Saving interfaces")
            with open(self._db, 'w') as f:
                f.write(yaml.safe_dump(dict(((k, v) for (k, v) in self._interfaces.iteritems(
                ) if k not in self.reserved_interfaces)), default_flow_style=False, explicit_start=True))
        except Exception as e:
            logger.exception("Failed to save interfaces")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号