Skip to content

Commit

Permalink
refactor: add type annotations for __exit__ and __aexit__
Browse files Browse the repository at this point in the history
  • Loading branch information
y1450 committed Jan 13, 2023
1 parent eae8050 commit 0f63775
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/bentoml/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from .exceptions import RemoteException
from .exceptions import BentoMLException
from ._internal.service.inference_api import InferenceAPI
from .exceptions import BentoMLException, RemoteException

if t.TYPE_CHECKING:
from types import TracebackType


class Client(ABC):
Expand Down Expand Up @@ -85,13 +89,23 @@ def wait_until_server_is_ready(host: str, port: int, timeout: int) -> None:
def __enter__(self):
return self

def __exit__(self, type, value, traceback):
def __exit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> bool | None:
pass

async def __aenter__(self):
return self

async def __aexit__(self, type, value, traceback):
async def __aexit__(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
traceback: TracebackType | None,
) -> bool | None:
pass

@staticmethod
Expand Down

0 comments on commit 0f63775

Please sign in to comment.