Use f-strings for formatting

Fixes Ruff warnings. Ruff didn't detect these before. Should we pin Ruff
version? 🤔
This commit is contained in:
Yaroslav Chvanov
2023-07-17 00:28:44 +03:00
parent 0b5a95f09e
commit 2311a84339
2 changed files with 3 additions and 11 deletions

View File

@@ -50,11 +50,7 @@ if __name__ == "__main__":
fname = os.path.basename(path)
for m in matches:
if m in device_matches:
print(
"Duplicate DeviceMatch={} in {} and {}".format(
m, fname, device_matches[m]
)
)
print(f"Duplicate DeviceMatch={m} in {fname} and {device_matches[m]}")
duplicates = True
device_matches[m] = fname

View File

@@ -321,9 +321,7 @@ def show_profile(ratbagd: Ratbagd, args: argparse.Namespace) -> None:
def show_resolution(ratbagd: Ratbagd, args: argparse.Namespace) -> None:
resolution, p, d = find_resolution(ratbagd, args)
print(
"Resolution {} on Profile {} on {} ({})".format(
args.resolution, args.profile, d.id, d.name
)
f"Resolution {args.resolution} on Profile {args.profile} on {d.id} ({d.name})"
)
print_resolution(d, p, resolution, 0)
caps = {
@@ -337,9 +335,7 @@ def show_resolution(ratbagd: Ratbagd, args: argparse.Namespace) -> None:
def show_button(ratbagd: Ratbagd, args: argparse.Namespace) -> None:
button, profile, device = find_button(ratbagd, args)
print(
"Button {} on Profile {} on {} ({})".format(
args.button, args.profile, device.id, device.name
)
f"Button {args.button} on Profile {args.profile} on {device.id} ({device.name})"
)
print_button(device, profile, button, 0)