def log_digest_blake2s(self):
return self.data.log_digest_blake2s
- async def open_log(self):
+ async def open_log(self, mode="r"):
"""
Opens the log file, and returns an open file handle
"""
if not self.has_log():
raise FileNotFoundError
- return await asyncio.to_thread(self._open_log)
+ return await asyncio.to_thread(self._open_log, mode)
- def _open_log(self):
+ def _open_log(self, mode):
path = self.log_path
# Open gzip-compressed files
if path.endswith(".gz"):
- return gzip.open(path)
+ return gzip.open(path, mode)
# Open uncompressed files
else:
- return open(open)
+ return open(open, mode)
async def _import_log(self, upload):
# Create some destination path