@@ -29,28 +29,25 @@ def temp_session(
2929 ** kwargs : t .Any ,
3030) -> Generator [Session , t .Any , t .Any ]:
3131 """
32- Return a context manager with a temporary session.
32+ Provide a context manager for a temporary session, killed on exit .
3333
34- If no ``session_name`` is entered, :func:`get_test_session_name` will make
35- an unused session name.
36-
37- The session will destroy itself upon closing with :meth:`Session.session()`.
34+ If no ``session_name`` is specified, :func:`get_test_session_name` will
35+ generate an unused one. The session is destroyed upon exiting the context
36+ manager.
3837
3938 Parameters
4039 ----------
41- server : :class:`libtmux.Server`
42-
43- Other Parameters
44- ----------------
40+ server : Server
41+ The tmux server instance.
4542 args : list
46- Arguments passed into :meth:`Server.new_session`
43+ Additional positional arguments for :meth:`Server.new_session`.
4744 kwargs : dict
48- Keyword arguments passed into :meth:`Server.new_session`
45+ Keyword arguments for :meth:`Server.new_session`.
4946
5047 Yields
5148 ------
52- :class:`libtmux. Session`
53- Temporary session
49+ Session
50+ The newly created temporary session.
5451
5552 Examples
5653 --------
@@ -80,37 +77,32 @@ def temp_window(
8077 ** kwargs : t .Any ,
8178) -> Generator [Window , t .Any , t .Any ]:
8279 """
83- Return a context manager with a temporary window.
84-
85- The window will destroy itself upon closing with :meth:`window.
86- kill()`.
80+ Provide a context manager for a temporary window, killed on exit.
8781
88- If no ``window_name`` is entered, :func:`get_test_window_name` will make
89- an unused window name.
82+ If no ``window_name`` is specified, :func:`get_test_window_name` will
83+ generate an unused one. The window is destroyed upon exiting the context
84+ manager.
9085
9186 Parameters
9287 ----------
93- session : :class:`libtmux.Session`
94-
95- Other Parameters
96- ----------------
88+ session : Session
89+ The tmux session instance.
9790 args : list
98- Arguments passed into :meth:`Session.new_window`
91+ Additional positional arguments for :meth:`Session.new_window`.
9992 kwargs : dict
100- Keyword arguments passed into :meth:`Session.new_window`
93+ Keyword arguments for :meth:`Session.new_window`.
10194
10295 Yields
10396 ------
104- :class:`libtmux. Window`
105- temporary window
97+ Window
98+ The newly created temporary window.
10699
107100 Examples
108101 --------
109102 >>> with temp_window(session) as window:
110103 ... window
111104 Window(@2 2:... Session($1 libtmux_...))
112105
113-
114106 >>> with temp_window(session) as window:
115107 ... window.split()
116108 Pane(%4 Window(@3 2:libtmux_..., Session($1 libtmux_...)))
@@ -121,8 +113,6 @@ def temp_window(
121113 window_name = kwargs .pop ("window_name" )
122114
123115 window = session .new_window (window_name , * args , ** kwargs )
124-
125- # Get ``window_id`` before returning it, it may be killed within context.
126116 window_id = window .window_id
127117 assert window_id is not None
128118 assert isinstance (window_id , str )
0 commit comments