rules.py 文件源码

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

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

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

        try:
            logger.debug("Saving rules")
            with open(self._db, 'w') as f:
                f.write(ordered_dump(OrderedDict(
                    ((k, self._rules[k]) for k in self._rules_with_index)), Dumper=yaml.SafeDumper, default_flow_style=False, explicit_start=True))
        except:
            logger.exception("Failed to save rules")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号