From ee0c88cb0d20940e50ca2c9fbfff189398944f99 Mon Sep 17 00:00:00 2001 From: Jeongseok Kang Date: Fri, 29 Mar 2024 13:11:36 +0900 Subject: [PATCH] doc: Client fetch API has deprecated synchronous context manager (#1801) --- changes/1801.doc.md | 1 + src/ai/backend/client/request.py | 16 +++------------- 2 files changed, 4 insertions(+), 13 deletions(-) create mode 100644 changes/1801.doc.md diff --git a/changes/1801.doc.md b/changes/1801.doc.md new file mode 100644 index 0000000000..51edbbf092 --- /dev/null +++ b/changes/1801.doc.md @@ -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. diff --git a/src/ai/backend/client/request.py b/src/ai/backend/client/request.py index d3172441bc..6ce893bd44 100644 --- a/src/ai/backend/client/request.py +++ b/src/ai/backend/client/request.py @@ -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 @@ -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__ = (