From e75ce8b7fc02c984f2d0ddaef3768d9f6431bb80 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Mon, 6 Jun 2022 13:29:37 +0300 Subject: T4446: use format strings instead of old-fasionhed format method --- src/op_mode/show_neigh.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/op_mode') diff --git a/src/op_mode/show_neigh.py b/src/op_mode/show_neigh.py index 4d96ee869..d874bd544 100755 --- a/src/op_mode/show_neigh.py +++ b/src/op_mode/show_neigh.py @@ -35,16 +35,16 @@ def get_raw_data(family, device=None, state=None): from vyos.util import cmd if device: - device = "dev {0}".format(device) + device = f"dev {device}" else: device = "" if state: - state = "nud {0}".format(state) + state = f"nud {state}" else: state = "" - neigh_cmd = "ip --family {0} --json neighbor list {1} {2}".format(family, device, state) + neigh_cmd = f"ip --family {family} --json neighbor list {device} {state}" data = loads(cmd(neigh_cmd)) @@ -93,7 +93,7 @@ if __name__ == '__main__': if args.state: if args.state not in ["reachable", "failed", "stale", "permanent"]: - raise ValueError("Incorrect state {0}! Must be one of: reachable, stale, failed, permanent".format(args.state)) + raise ValueError(f"""Incorrect state "{args.state}"! Must be one of: reachable, stale, failed, permanent""") try: print(get_formatted_output(args.family, device=args.interface, state=args.state)) -- cgit v1.2.3