Skip to content

Commit 821a453

Browse files
otherJL0tony
authored andcommitted
Simplify nested iteration in session attached_window method
1 parent c5bdb01 commit 821a453

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

libtmux/session.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,9 @@ def attached_window(self) -> Window:
318318
"""
319319
active_windows = []
320320
for window in self._windows:
321-
if "window_active" in window:
322-
# for now window_active is a unicode
323-
if window.get("window_active") == "1":
324-
active_windows.append(Window(session=self, **window))
325-
else:
326-
continue
321+
# for now window_active is a unicode
322+
if "window_active" in window and window.get("window_active") == "1":
323+
active_windows.append(Window(session=self, **window))
327324

328325
if len(active_windows) == int(1):
329326
return active_windows[0]

0 commit comments

Comments
 (0)