@@ -96,15 +96,18 @@ def tmux(self, *args, **kwargs):
9696
9797 return tmux (* args , ** kwargs )
9898
99- def __list_sessions (self ):
100- """Return list of ``$ tmux(1) list-sessions`` stdout.
99+ def _list_sessions (self ):
100+ """Return a list of session information ``tmux(1)`` for the sessions.
101+
102+ Via ``$ tmux(1) list-sessions`` stdout.
101103
102104 The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux`
103105 which wraps :py:meth:`Subprocess.Popen`.
104106
105- :rtype: list
107+ :rtype: :py:obj:` list` of :py:obj:`dict`
106108
107109 """
110+
108111 sformats = formats .SESSION_FORMATS
109112 tmux_formats = ['#{%s}' % f for f in sformats ]
110113
@@ -123,20 +126,11 @@ def __list_sessions(self):
123126 session_info = proc .stdout [0 ]
124127
125128 if proc .stderr :
126- raise Exception (sessions .stderr )
127-
128- return proc .stdout
129-
130- def _list_sessions (self ):
131- '''
132- Return a list of session information ``tmux(1)`` for the sessions
133-
134- :rtype: :py:obj:`list` of :py:obj:`dict`
135- '''
129+ raise Exception (proc .stderr )
136130
137131 sformats = formats .SESSION_FORMATS
138132 tmux_formats = ['#{%s}' % format for format in sformats ]
139- sessions = self . __list_sessions ()
133+ sessions = proc . stdout
140134
141135 # combine format keys with values returned from ``tmux list-windows``
142136 sessions = [dict (zip (
@@ -176,8 +170,10 @@ def sessions(self):
176170 #: Alias of :attr:`sessions`.
177171 children = sessions
178172
179- def __list_windows (self ):
180- """Return list of ``$ tmux(1) list-windows`` stdout.
173+ def _list_windows (self ):
174+ """Return list of dicts filtered from :meth:`__list_windows`.
175+
176+ List of ``$ tmux(1) list-windows`` stdout.
181177
182178 The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux`
183179 which wraps :py:meth:`Subprocess.Popen`.
@@ -189,24 +185,19 @@ def __list_windows(self):
189185 wformats = ['session_name' , 'session_id' ] + formats .WINDOW_FORMATS
190186 tmux_formats = ['#{%s}' % format for format in wformats ]
191187
192- windows = self .tmux (
188+ proc = self .tmux (
193189 'list-windows' , # ``tmux list-windows``
194190 '-a' ,
195191 '-F%s' % '\t ' .join (tmux_formats ), # output
196192 )
197193
198- if windows .stderr :
199- raise Exception (windows .stderr )
200-
201- return windows .stdout
194+ if proc .stderr :
195+ raise Exception (proc .stderr )
202196
203- def _list_windows (self ):
204- """Return list of dicts filtered from :meth:`__list_windows`."""
197+ windows = proc .stdout
205198
206199 wformats = ['session_name' , 'session_id' ] + formats .WINDOW_FORMATS
207200
208- windows = self .__list_windows ()
209-
210201 # combine format keys with values returned from ``tmux list-windows``
211202 windows = [dict (zip (
212203 wformats , window .split ('\t ' ))) for window in windows ]
@@ -238,39 +229,36 @@ def _update_windows(self):
238229 self ._list_windows ()
239230 return self
240231
241- def __list_panes (self ):
242- """Return list of ``$ tmux(1) list-panes`` stdout.
232+ def _list_panes (self ):
233+ """Return list of dicts filtered from :meth:`__list_panes`.
234+
235+ list of ``$ tmux(1) list-panes`` stdout.
243236
244237 The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux`
245238 which wraps :py:meth:`Subprocess.Popen`.
246239
247-
248240 :rtype: list
249241
250242 """
243+
251244 pformats = ['session_name' , 'session_id' ,
252245 'window_index' , 'window_id' , 'window_name' ] + formats .PANE_FORMATS
253246 tmux_formats = ['#{%s}\t ' % f for f in pformats ]
254247
255- panes = self .tmux (
248+ proc = self .tmux (
256249 'list-panes' ,
257250 '-a' ,
258251 '-F%s' % '' .join (tmux_formats ), # output
259252 )
260253
261- if panes .stderr :
262- raise Exception (panes .stderr )
263-
264- return panes .stdout
254+ if proc .stderr :
255+ raise Exception (proc .stderr )
265256
266- def _list_panes (self ):
267- """Return list of dicts filtered from :meth:`__list_panes`."""
257+ panes = proc .stdout
268258
269259 pformats = ['session_name' , 'session_id' ,
270260 'window_index' , 'window_id' , 'window_name' ] + formats .PANE_FORMATS
271261
272- panes = self .__list_panes ()
273-
274262 # combine format keys with values returned from ``tmux list-panes``
275263 panes = [dict (zip (
276264 pformats , window .split ('\t ' ))) for window in panes ]
0 commit comments