mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 15:21:13 +02:00
Use pyupgrade with --py36-plus param.
This commit is contained in:
1 parent
a9eb035b7d
commit
f928738bd5
235 files changed
+1501
-1638
No files matched your search
@@ -85,13 +85,13 @@ class Snapshot:
|
||||
"""
|
||||
|
||||
if os.path.exists(self.path):
|
||||
raise ControllerError("The snapshot file '{}' already exists".format(self.name))
|
||||
raise ControllerError(f"The snapshot file '{self.name}' already exists")
|
||||
|
||||
snapshot_directory = os.path.join(self._project.path, "snapshots")
|
||||
try:
|
||||
os.makedirs(snapshot_directory, exist_ok=True)
|
||||
except OSError as e:
|
||||
raise ControllerError("Could not create the snapshot directory '{}': {}".format(snapshot_directory, e))
|
||||
raise ControllerError(f"Could not create the snapshot directory '{snapshot_directory}': {e}")
|
||||
|
||||
try:
|
||||
begin = time.time()
|
||||
@@ -102,9 +102,9 @@ class Snapshot:
|
||||
async with aiofiles.open(self.path, 'wb') as f:
|
||||
async for chunk in zstream:
|
||||
await f.write(chunk)
|
||||
log.info("Snapshot '{}' created in {:.4f} seconds".format(self.name, time.time() - begin))
|
||||
log.info(f"Snapshot '{self.name}' created in {time.time() - begin:.4f} seconds")
|
||||
except (ValueError, OSError, RuntimeError) as e:
|
||||
raise ControllerError("Could not create snapshot file '{}': {}".format(self.path, e))
|
||||
raise ControllerError(f"Could not create snapshot file '{self.path}': {e}")
|
||||
|
||||
async def restore(self):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user