__init__.py 文件源码

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

项目:srctools 作者: TeamSpen210 项目源码 文件源码
def __exit__(self, exc_type, exc_value, tback):
        # Pass to tempfile, which also closes().
        temp_path = self.temp.name
        self.temp.__exit__(exc_type, exc_value, tback)
        self.temp = None
        if exc_type is not None:
            # An exception occurred, clean up.
            try:
                _os.remove(temp_path)
            except FileNotFoundError:
                pass
        else:
            # No exception, commit changes
            _os.replace(temp_path, self.filename)

        return False  # Don't cancel the exception.


# Import these, so people can reference 'srctools.Vec' instead of
# 'srctools.vec.Vec'.
# Should be done after other code, so everything's initialised.
# Not all classes are imported, just most-used ones.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号