Use pyupgrade with --py36-plus param.

This commit is contained in:
grossmj committed 2021-04-13 18:37:58 +09:30
1 parent a9eb035b7d
commit f928738bd5
235 files changed
+1501 -1638

No files matched your search

+14 -14
View File
@@ -63,7 +63,7 @@ class GNS3VM:
download_url = "https://github.com/GNS3/gns3-gui/releases/download/v{version}/GNS3.VM.VMware.Workstation.{version}.zip".format(version=__version__)
vmware_info = {
"engine_id": "vmware",
"description": 'VMware is the recommended choice for best performances.<br>The GNS3 VM can be <a href="{}">downloaded here</a>.'.format(download_url),
"description": f'VMware is the recommended choice for best performances.<br>The GNS3 VM can be <a href="{download_url}">downloaded here</a>.',
"support_when_exit": True,
"support_headless": True,
"support_ram": True
@@ -77,7 +77,7 @@ class GNS3VM:
hyperv_info = {
"engine_id": "hyper-v",
"name": "Hyper-V",
"description": 'Hyper-V support (Windows 10/Server 2016 and above). Nested virtualization must be supported and enabled (Intel processor only)<br>The GNS3 VM can be <a href="{}">downloaded here</a>'.format(download_url),
"description": f'Hyper-V support (Windows 10/Server 2016 and above). Nested virtualization must be supported and enabled (Intel processor only)<br>The GNS3 VM can be <a href="{download_url}">downloaded here</a>',
"support_when_exit": True,
"support_headless": False,
"support_ram": True
@@ -87,7 +87,7 @@ class GNS3VM:
virtualbox_info = {
"engine_id": "virtualbox",
"name": "VirtualBox",
"description": 'VirtualBox support. Nested virtualization for both Intel and AMD processors is supported since version 6.1<br>The GNS3 VM can be <a href="{}">downloaded here</a>'.format(download_url),
"description": f'VirtualBox support. Nested virtualization for both Intel and AMD processors is supported since version 6.1<br>The GNS3 VM can be <a href="{download_url}">downloaded here</a>',
"support_when_exit": True,
"support_headless": True,
"support_ram": True
@@ -246,7 +246,7 @@ class GNS3VM:
elif engine == "remote":
self._engines["remote"] = RemoteGNS3VM(self._controller)
return self._engines["remote"]
raise NotImplementedError("The engine {} for the GNS3 VM is not supported".format(engine))
raise NotImplementedError(f"The engine {engine} for the GNS3 VM is not supported")
def __json__(self):
return self._settings
@@ -281,14 +281,14 @@ class GNS3VM:
# User will receive the error later when they will try to use the node
try:
compute = await self._controller.add_compute(compute_id="vm",
name="GNS3 VM ({})".format(self.current_engine().vmname),
name=f"GNS3 VM ({self.current_engine().vmname})",
host=None,
force=True)
compute.set_last_error(str(e))
except ControllerError:
pass
log.error("Cannot start the GNS3 VM: {}".format(e))
log.error(f"Cannot start the GNS3 VM: {e}")
async def exit_vm(self):
@@ -319,7 +319,7 @@ class GNS3VM:
engine.headless = self._settings["headless"]
engine.port = self._settings["port"]
compute = await self._controller.add_compute(compute_id="vm",
name="GNS3 VM is starting ({})".format(engine.vmname),
name=f"GNS3 VM is starting ({engine.vmname})",
host=None,
force=True,
connect=False)
@@ -328,12 +328,12 @@ class GNS3VM:
await engine.start()
except Exception as e:
await self._controller.delete_compute("vm")
log.error("Cannot start the GNS3 VM: {}".format(str(e)))
await compute.update(name="GNS3 VM ({})".format(engine.vmname))
log.error(f"Cannot start the GNS3 VM: {str(e)}")
await compute.update(name=f"GNS3 VM ({engine.vmname})")
compute.set_last_error(str(e))
raise e
await compute.connect() # we can connect now that the VM has started
await compute.update(name="GNS3 VM ({})".format(engine.vmname),
await compute.update(name=f"GNS3 VM ({engine.vmname})",
protocol=self.protocol,
host=self.ip_address,
port=self.port,
@@ -357,7 +357,7 @@ class GNS3VM:
vm_interface_netmask = interface["netmask"]
break
if vm_interface_netmask:
vm_network = ipaddress.ip_interface("{}/{}".format(compute.host_ip, vm_interface_netmask)).network
vm_network = ipaddress.ip_interface(f"{compute.host_ip}/{vm_interface_netmask}").network
for compute_id in self._controller.computes:
if compute_id == "local":
compute = self._controller.get_compute(compute_id)
@@ -368,7 +368,7 @@ class GNS3VM:
netmask = interface["netmask"]
break
if netmask:
compute_network = ipaddress.ip_interface("{}/{}".format(compute.host_ip, netmask)).network
compute_network = ipaddress.ip_interface(f"{compute.host_ip}/{netmask}").network
if vm_network.compare_networks(compute_network) != 0:
msg = "The GNS3 VM (IP={}, NETWORK={}) is not on the same network as the {} server (IP={}, NETWORK={}), please make sure the local server binding is in the same network as the GNS3 VM".format(self.ip_address,
vm_network,
@@ -377,9 +377,9 @@ class GNS3VM:
compute_network)
self._controller.notification.controller_emit("log.warning", {"message": msg})
except ComputeError as e:
log.warning("Could not check the VM is in the same subnet as the local server: {}".format(e))
log.warning(f"Could not check the VM is in the same subnet as the local server: {e}")
except ControllerError as e:
log.warning("Could not check the VM is in the same subnet as the local server: {}".format(e))
log.warning(f"Could not check the VM is in the same subnet as the local server: {e}")
@locking
async def _suspend(self):