Move to f-strings

Used:
$ flynt -a -tc . vppcfg

Execution time:                            0.216s
Files checked:                             24
Files modified:                            13
Character count reduction:                 632 (0.36%)

Per expression type:
Old style (`%`) expressions attempted:     209/211 (99.1%)
No `.format(...)` calls attempted.
No concatenations attempted.
F-string expressions created:              205

Ran an integration test before and after. No diffs.
This commit is contained in:
Pim van Pelt
2022-04-22 10:58:41 +00:00
parent 13cdba1e1d
commit e13694a566
13 changed files with 205 additions and 205 deletions

View File

@ -65,20 +65,20 @@ def validate_vxlan_tunnels(yaml):
return result, msgs
for ifname, iface in yaml['vxlan_tunnels'].items():
logger.debug("vxlan_tunnel %s: %s" % (ifname, iface))
logger.debug(f"vxlan_tunnel {ifname}: {iface}")
instance = int(ifname[12:])
if instance > 2147483647:
msgs.append("vxlan_tunnel %s has instance %d which is too large" % (ifname, instance))
msgs.append(f"vxlan_tunnel {ifname} has instance {int(instance)} which is too large")
result = False
vni = iface['vni']
if not vni_unique(yaml, vni):
msgs.append("vxlan_tunnel %s VNI %d is not unique" % (ifname, vni))
msgs.append(f"vxlan_tunnel {ifname} VNI {int(vni)} is not unique")
result = False
local = ipaddress.ip_address(iface['local'])
remote = ipaddress.ip_address(iface['remote'])
if local.version != remote.version:
msgs.append("vxlan_tunnel %s local and remote are not the same address family" % (ifname))
msgs.append(f"vxlan_tunnel {ifname} local and remote are not the same address family")
result = False
return result, msgs