Skip to content

Commit 24fafe1

Browse files
committed
refactor: ran pyupgrade --py38-plus
1 parent 3e6ff83 commit 24fafe1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

aw_watcher_window/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ def get_current_window(strategy: str = None) -> Optional[dict]:
5656
elif sys.platform in ["win32", "cygwin"]:
5757
return get_current_window_windows()
5858
else:
59-
raise Exception("Unknown platform: {}".format(sys.platform))
59+
raise Exception(f"Unknown platform: {sys.platform}")

aw_watcher_window/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def main():
4444
"aw-watcher-window", host=args.host, port=args.port, testing=args.testing
4545
)
4646

47-
bucket_id = "{}_{}".format(client.client_name, client.client_hostname)
47+
bucket_id = f"{client.client_name}_{client.client_hostname}"
4848
event_type = "currentwindow"
4949

5050
client.create_bucket(bucket_id, event_type, queued=True)

aw_watcher_window/xlib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_window_name(window: Window) -> str:
5151
try:
5252
d = window.get_full_property(NET_WM_NAME, UTF8_STRING)
5353
except Xlib.error.XError as e:
54-
logger.warning("Unable to get window property NET_WM_NAME, got a {} exception from Xlib".format(type(e).__name__))
54+
logger.warning(f"Unable to get window property NET_WM_NAME, got a {type(e).__name__} exception from Xlib")
5555
# I strongly suspect window.get_wm_name() will also fail and we should return "unknown" right away.
5656
# But I don't know, so I pass the thing on, for now.
5757
d = None
@@ -69,7 +69,7 @@ def get_window_name(window: Window) -> str:
6969
try:
7070
return d.value.decode('utf8')
7171
except UnicodeError:
72-
logger.warning("Failed to decode one or more characters which will be skipped, bytes are: {}".format(d.value))
72+
logger.warning(f"Failed to decode one or more characters which will be skipped, bytes are: {d.value}")
7373
if isinstance(d.value, bytes):
7474
return d.value.decode('utf8', 'ignore')
7575
else:
@@ -92,7 +92,7 @@ def get_window_class(window: Window) -> str:
9292
try:
9393
window = window.query_tree().parent
9494
except Xlib.error.XError as e:
95-
logger.warning("Unable to get window query_tree().parent, got a {} exception from Xlib".format(type(e).__name__))
95+
logger.warning(f"Unable to get window query_tree().parent, got a {type(e).__name__} exception from Xlib")
9696
return "unknown"
9797
if window:
9898
return get_window_class(window)

0 commit comments

Comments
 (0)