Skip to content

Commit

Permalink
docs(server): Fill in more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Nov 25, 2023
1 parent 5390a42 commit 29d5e28
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions src/libtmux/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ def _list_panes(self) -> t.List[PaneDict]:
:class:`util.tmux_cmd` which wraps :py:class:`subprocess.Popen`.
.. deprecated:: 0.16
Deprecated in favor of :attr:`.panes`.
"""
warnings.warn("Server._list_panes() is deprecated", stacklevel=2)
return [p.__dict__ for p in self.panes]
Expand All @@ -604,26 +606,46 @@ def _update_panes(self) -> "Server":
:class:`Server`
.. deprecated:: 0.16
Deprecated in favor of :attr:`.panes` and returning ``self``.
"""
warnings.warn("Server._update_panes() is deprecated", stacklevel=2)
self._list_panes()
return self

def get_by_id(self, id: str) -> t.Optional[Session]:
""".. deprecated:: 0.16."""
"""Return session by id. Deprecated in favor of :meth:`.sessions.get()`.
.. deprecated:: 0.16.
Deprecated by :meth:`.sessions.get()`.
"""
warnings.warn("Server.get_by_id() is deprecated", stacklevel=2)
return self.sessions.get(session_id=id, default=None)

def where(self, kwargs: t.Dict[str, t.Any]) -> t.List[Session]:
""".. deprecated:: 0.16."""
"""Filter through sessions, return list of :class:`Session`.
.. deprecated:: 0.16
Deprecated by :meth:`.session.filter()`.
"""
warnings.warn("Server.find_where() is deprecated", stacklevel=2)
try:
return self.sessions.filter(**kwargs)
except IndexError:
return []

def find_where(self, kwargs: t.Dict[str, t.Any]) -> t.Optional[Session]:
""".. deprecated:: 0.16."""
"""Filter through sessions, return first :class:`Session`.
.. deprecated:: 0.16.
Slated to be removed in favor of :meth:`.sessions.get()`.
"""
warnings.warn("Server.find_where() is deprecated", stacklevel=2)
return self.sessions.get(default=None, **kwargs)

Expand All @@ -636,6 +658,9 @@ def _list_windows(self) -> t.List[WindowDict]:
:class:`common.tmux_cmd` which wraps :py:class:`subprocess.Popen`.
.. deprecated:: 0.16
Slated to be removed in favor of :attr:`.windows`.
"""
warnings.warn("Server._list_windows() is deprecated", stacklevel=2)
return [w.__dict__ for w in self.windows]
Expand All @@ -644,6 +669,9 @@ def _update_windows(self) -> "Server":
"""Update internal window data and return ``self`` for chainability.
.. deprecated:: 0.16
Deprecated in favor of :attr:`.windows` and returning ``self``.
"""
warnings.warn("Server._update_windows() is deprecated", stacklevel=2)
self._list_windows()
Expand All @@ -654,12 +682,20 @@ def _sessions(self) -> t.List[SessionDict]:
"""Property / alias to return :meth:`~._list_sessions`.
.. deprecated:: 0.16
Slated to be removed in favor of :attr:`.sessions`.
"""
warnings.warn("Server._sessions is deprecated", stacklevel=2)
return self._list_sessions()

def _list_sessions(self) -> t.List["SessionDict"]:
""".. deprecated:: 0.16."""
"""Return list of session object dictionaries.
.. deprecated:: 0.16
Slated to be removed in favor of :attr:`.sessions`.
"""
warnings.warn("Server._list_sessions() is deprecated", stacklevel=2)
return [s.__dict__ for s in self.sessions]

Expand All @@ -668,6 +704,8 @@ def list_sessions(self) -> t.List[Session]:
.. deprecated:: 0.16
Slated to be removed in favor of :attr:`.sessions`.
Returns
-------
list of :class:`Session`
Expand All @@ -680,6 +718,9 @@ def children(self) -> QueryList["Session"]: # type:ignore
"""Was used by TmuxRelationalObject (but that's longer used in this class).
.. deprecated:: 0.16
Slated to be removed in favor of :meth:`.sessions`.
"""
warnings.warn("Server.children is deprecated", stacklevel=2)
return self.sessions

0 comments on commit 29d5e28

Please sign in to comment.