refactor: use explicit conversion in f-strings

This commit is contained in:
Mark Paronyan committed 2026-10-01 19:57:41 +03:00
1 parent 0f66fd6c2b
commit c5b5091f5e
32 files changed
+65 -65

No files matched your search

+4 -4
View File
@@ -139,7 +139,7 @@ def load_topology(path):
with open(path, encoding="utf-8") as f:
topo = json.load(f)
except (OSError, UnicodeDecodeError, ValueError) as e:
raise ControllerError(f"Could not load topology {path}: {str(e)}")
raise ControllerError(f"Could not load topology {path}: {e!s}")
if topo.get("revision", 0) > GNS3_FILE_FORMAT_REVISION:
raise ControllerError(
@@ -154,7 +154,7 @@ def load_topology(path):
try:
shutil.copy(path, path + ".backup{}".format(topo.get("revision", 0)))
except OSError as e:
raise ControllerError(f"Can't write backup of the topology {path}: {str(e)}")
raise ControllerError(f"Can't write backup of the topology {path}: {e!s}")
changed = True
# update the version because we converted the topology
topo["version"] = __version__
@@ -210,7 +210,7 @@ def load_topology(path):
with open(path, "w+", encoding="utf-8") as f:
json.dump(topo, f, indent=4, sort_keys=True)
except OSError as e:
raise ControllerError(f"Can't write the topology {path}: {str(e)}")
raise ControllerError(f"Can't write the topology {path}: {e!s}")
return topo
@@ -326,7 +326,7 @@ def _convert_2_0_0_beta_2(topo, topo_path):
for path in glob.glob(os.path.join(glob.escape(dynamips_dir), "configs", f"i{dynamips_id}_*")):
shutil.move(path, os.path.join(node_dir, "configs", os.path.basename(path)))
except OSError as e:
raise ControllerError(f"Can't convert project {topo_path}: {str(e)}")
raise ControllerError(f"Can't convert project {topo_path}: {e!s}")
return topo