def open(self, path, mode='r', errors=None):
stream = self.opened.get(path)
if not stream:
if mode[0] == 'r':
raise FileNotFoundError(path)
stream = self.opened[path] = BytesIO()
stream.seek(0)
stream = BufferedRandom(stream) if mode[-1] == 'b' else TextIOWrapper(stream)
stream.close = stream.flush
return stream
评论列表
文章目录