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 39fe307 commit cc76526
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/bentoml/client.py
Expand Up @@ -20,6 +20,9 @@
from .exceptions import BentoMLException
from ._internal.service.inference_api import InferenceAPI

if t.TYPE_CHECKING:
from types import TracebackType


class Client(ABC):
server_url: str
Expand Down Expand Up @@ -88,13 +91,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 cc76526

Please sign in to comment.