From 6ab9a4191479e5e8d558580643a782ee839b019f Mon Sep 17 00:00:00 2001 From: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Date: Fri, 5 Aug 2022 04:48:28 -0700 Subject: [PATCH] revert: types changes Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- bentoml/_internal/io_descriptors/base.py | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/bentoml/_internal/io_descriptors/base.py b/bentoml/_internal/io_descriptors/base.py index 9ed84e95a7..cb9e4bde05 100644 --- a/bentoml/_internal/io_descriptors/base.py +++ b/bentoml/_internal/io_descriptors/base.py @@ -5,12 +5,13 @@ from abc import abstractmethod from typing import TYPE_CHECKING +from starlette.requests import Request +from starlette.responses import Response + if TYPE_CHECKING: from types import UnionType from typing_extensions import Self - from starlette.requests import Request - from starlette.responses import Response from bentoml.grpc.v1.service_pb2 import Request as GRPCRequest from bentoml.grpc.v1.service_pb2 import Response as GRPCResponse @@ -19,13 +20,6 @@ from ..context import InferenceApiContext as Context from ..server.grpc.types import BentoServicerContext - InputType = ( - UnionType - | t.Type[t.Any] - | LazyType[t.Any] - | dict[str, t.Type[t.Any] | UnionType | LazyType[t.Any]] - ) - IOPyObj = t.TypeVar("IOPyObj") @@ -81,19 +75,26 @@ def accepted_proto_fields(self) -> list[str]: return self._proto_fields @abstractmethod - def input_type(self) -> InputType: + def input_type( + self, + ) -> t.Union[ + "UnionType", + t.Type[t.Any], + "LazyType[t.Any]", + t.Dict[str, t.Union[t.Type[t.Any], "UnionType", "LazyType[t.Any]"]], + ]: ... @abstractmethod - def openapi_schema_type(self) -> dict[str, str]: + def openapi_schema_type(self) -> t.Dict[str, str]: ... @abstractmethod - def openapi_request_schema(self) -> dict[str, t.Any]: + def openapi_request_schema(self) -> t.Dict[str, t.Any]: ... @abstractmethod - def openapi_responses_schema(self) -> dict[str, t.Any]: + def openapi_responses_schema(self) -> t.Dict[str, t.Any]: ... @abstractmethod