Skip to content

Commit bcdbbd6

Browse files
otherJL0tony
authored andcommitted
Simplify nested iteration in window attached_pane method
1 parent 821a453 commit bcdbbd6

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

libtmux/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def by(val) -> bool:
349349
target_children = list(filter(by, self.children))
350350
if first:
351351
return target_children[0]
352-
return return target_children
352+
return target_children
353353

354354
def get_by_id(self, id):
355355
"""

libtmux/window.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,9 @@ def attached_pane(self) -> t.Optional[Pane]:
502502
:class:`Pane`
503503
"""
504504
for pane in self._panes:
505-
if "pane_active" in pane:
506-
# for now pane_active is a unicode
507-
if pane.get("pane_active") == "1":
508-
return Pane(window=self, **pane)
505+
# for now pane_active is a unicode
506+
if "pane_active" in pane and pane.get("pane_active") == "1":
507+
return Pane(window=self, **pane)
509508

510509
def _list_panes(self) -> t.List[PaneDict]:
511510
panes = self.server._update_panes()._panes

0 commit comments

Comments
 (0)