Skip to content

Commit

Permalink
doc: Client fetch API has deprecated synchronous context manager (#1801)
Browse files Browse the repository at this point in the history
  • Loading branch information
rapsealk authored Mar 29, 2024
1 parent 50fe965 commit ee0c88c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 1 addition & 0 deletions changes/1801.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update docstrings in `ai.backend.client.request.Request:fetch()` and `ai.backend.client.request.FetchContextManager` as the support for synchronous context manager has been deprecated.
16 changes: 3 additions & 13 deletions src/ai/backend/client/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,8 @@ def fetch(self, **kwargs) -> FetchContextManager:
"""
Sends the request to the server and reads the response.
You may use this method either with plain synchronous Session or
AsyncSession. Both the followings patterns are valid:
.. code-block:: python3
from ai.backend.client.request import Request
from ai.backend.client.session import Session
with Session() as sess:
rqst = Request('GET', ...)
with rqst.fetch() as resp:
print(resp.text())
You may use this method with AsyncSession only,
following the pattern below:
.. code-block:: python3
Expand Down Expand Up @@ -538,7 +528,7 @@ class FetchContextManager:
"""
The context manager returned by :func:`Request.fetch`.
It provides both synchronous and asynchronous context manager interfaces.
It provides asynchronous context manager interfaces only.
"""

__slots__ = (
Expand Down

0 comments on commit ee0c88c

Please sign in to comment.