diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7696d43cb04..dc047ab0ade 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ ci: exclude: '(.*\.(css|js|svg))|(.*/(snippets|grpc|proto)/.*)$' repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.2.0' + rev: 'v0.3.4' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] @@ -19,11 +19,11 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - repo: https://github.com/pdm-project/pdm - rev: 2.13.0 + rev: 2.13.2 hooks: - id: pdm-lock-check - repo: https://github.com/bufbuild/buf - rev: v1.29.0 + rev: v1.30.0 hooks: - id: buf-format args: [--config=src/bentoml/grpc/buf.yaml, src/bentoml/grpc] diff --git a/src/_bentoml_impl/client/http.py b/src/_bentoml_impl/client/http.py index be062692b7e..1df337c3119 100644 --- a/src/_bentoml_impl/client/http.py +++ b/src/_bentoml_impl/client/http.py @@ -368,14 +368,12 @@ def _call( kwargs: dict[str, t.Any], *, headers: t.Mapping[str, str] | None = None, - ) -> t.Any: - ... + ) -> t.Any: ... @abstractmethod def _get_stream( self, endpoint: ClientEndpoint, args: t.Any, kwargs: t.Any - ) -> t.Any: - ... + ) -> t.Any: ... class SyncHTTPClient(HTTPClient[httpx.Client]): diff --git a/src/_bentoml_impl/serde.py b/src/_bentoml_impl/serde.py index 47f61a386b6..4d6dd4dbfb8 100644 --- a/src/_bentoml_impl/serde.py +++ b/src/_bentoml_impl/serde.py @@ -54,20 +54,16 @@ class Serde(abc.ABC): media_type: str @abc.abstractmethod - def serialize_model(self, model: IODescriptor) -> Payload: - ... + def serialize_model(self, model: IODescriptor) -> Payload: ... @abc.abstractmethod - def deserialize_model(self, payload: Payload, cls: type[T]) -> T: - ... + def deserialize_model(self, payload: Payload, cls: type[T]) -> T: ... @abc.abstractmethod - def serialize(self, obj: t.Any, schema: dict[str, t.Any]) -> Payload: - ... + def serialize(self, obj: t.Any, schema: dict[str, t.Any]) -> Payload: ... @abc.abstractmethod - def deserialize(self, payload: Payload, schema: dict[str, t.Any]) -> t.Any: - ... + def deserialize(self, payload: Payload, schema: dict[str, t.Any]) -> t.Any: ... async def parse_request(self, request: Request, cls: type[T]) -> T: """Parse a input model from HTTP request""" diff --git a/src/_bentoml_impl/server/__init__.py b/src/_bentoml_impl/server/__init__.py index 9add1256beb..d81385cbb5b 100644 --- a/src/_bentoml_impl/server/__init__.py +++ b/src/_bentoml_impl/server/__init__.py @@ -1,9 +1,9 @@ """ - _bentoml_impl.server - ~~~~~~~~~~~~~~~~~~~~ +_bentoml_impl.server +~~~~~~~~~~~~~~~~~~~~ - A reference implementation of serving a BentoML service. - This will be eventually migrated to Rust. +A reference implementation of serving a BentoML service. +This will be eventually migrated to Rust. """ from .serving import serve_http diff --git a/src/_bentoml_sdk/decorators.py b/src/_bentoml_sdk/decorators.py index 02e1bdad62e..d6e36ec443e 100644 --- a/src/_bentoml_sdk/decorators.py +++ b/src/_bentoml_sdk/decorators.py @@ -34,8 +34,7 @@ def on_deployment(func: t.Callable[P, R] | staticmethod[P, R]) -> staticmethod[P @t.overload -def api(func: t.Callable[t.Concatenate[t.Any, P], R]) -> APIMethod[P, R]: - ... +def api(func: t.Callable[t.Concatenate[t.Any, P], R]) -> APIMethod[P, R]: ... @t.overload @@ -49,8 +48,7 @@ def api( batch_dim: int | tuple[int, int] = ..., max_batch_size: int = ..., max_latency_ms: int = ..., -) -> t.Callable[[t.Callable[t.Concatenate[t.Any, P], R]], APIMethod[P, R]]: - ... +) -> t.Callable[[t.Callable[t.Concatenate[t.Any, P], R]], APIMethod[P, R]]: ... def api( diff --git a/src/_bentoml_sdk/method.py b/src/_bentoml_sdk/method.py index e4fd634b55a..b4d8dac1356 100644 --- a/src/_bentoml_sdk/method.py +++ b/src/_bentoml_sdk/method.py @@ -100,12 +100,10 @@ def __attrs_post_init__(self) -> None: self.output_spec.media_type = DEFAULT_STREAM_MEDIA_TYPE @t.overload - def __get__(self: T, instance: None, owner: type) -> T: - ... + def __get__(self: T, instance: None, owner: type) -> T: ... @t.overload - def __get__(self, instance: object, owner: type) -> t.Callable[P, R]: - ... + def __get__(self, instance: object, owner: type) -> t.Callable[P, R]: ... def __get__(self: T, instance: t.Any, owner: type) -> t.Callable[P, R] | T: from pydantic.fields import FieldInfo diff --git a/src/_bentoml_sdk/service/config.py b/src/_bentoml_sdk/service/config.py index f5e03001735..c8326bf6c6b 100644 --- a/src/_bentoml_sdk/service/config.py +++ b/src/_bentoml_sdk/service/config.py @@ -21,7 +21,8 @@ class TrafficSchema(TypedDict, total=False): timeout: Posfloat - max_concurrency: Posint # concurrent request will be rejected if it exceeds this limit + # concurrent request will be rejected if it exceeds this limit + max_concurrency: Posint concurrency: Posint # capabilty of handling concurrent request external_queue: bool # bentocloud only, if set to true, bentocloud will use external queue to handle request diff --git a/src/_bentoml_sdk/service/dependency.py b/src/_bentoml_sdk/service/dependency.py index d8a3c74716e..bbcd4603385 100644 --- a/src/_bentoml_sdk/service/dependency.py +++ b/src/_bentoml_sdk/service/dependency.py @@ -54,12 +54,10 @@ def get( return _dependent_cache[key] @t.overload - def __get__(self, instance: None, owner: t.Any) -> Dependency[T]: - ... + def __get__(self, instance: None, owner: t.Any) -> Dependency[T]: ... @t.overload - def __get__(self, instance: t.Any, owner: t.Any) -> T: - ... + def __get__(self, instance: t.Any, owner: t.Any) -> T: ... def __get__(self, instance: t.Any, owner: t.Any) -> Dependency[T] | T: if instance is None: diff --git a/src/_bentoml_sdk/service/factory.py b/src/_bentoml_sdk/service/factory.py index dfa78fa3257..37e1effa53e 100644 --- a/src/_bentoml_sdk/service/factory.py +++ b/src/_bentoml_sdk/service/factory.py @@ -41,8 +41,7 @@ R = t.TypeVar("R") class _ServiceDecorator(t.Protocol): - def __call__(self, inner: type[T]) -> Service[T]: - ... + def __call__(self, inner: type[T]) -> Service[T]: ... def with_config( @@ -328,13 +327,11 @@ def serve_http( @t.overload -def service(inner: type[T], /) -> Service[T]: - ... +def service(inner: type[T], /) -> Service[T]: ... @t.overload -def service(inner: None = ..., /, **kwargs: Unpack[Config]) -> _ServiceDecorator: - ... +def service(inner: None = ..., /, **kwargs: Unpack[Config]) -> _ServiceDecorator: ... def service(inner: type[T] | None = None, /, **kwargs: Unpack[Config]) -> t.Any: diff --git a/src/bentoml/_internal/bento/build_config.py b/src/bentoml/_internal/bento/build_config.py index 3dbf5ae2ba1..f5487c3b1a6 100644 --- a/src/bentoml/_internal/bento/build_config.py +++ b/src/bentoml/_internal/bento/build_config.py @@ -818,8 +818,7 @@ def __init__( python: PythonOptions | dict[str, t.Any] | None = ..., conda: CondaOptions | dict[str, t.Any] | None = ..., models: list[ModelSpec | str | dict[str, t.Any]] | None = ..., - ) -> None: - ... + ) -> None: ... def __attrs_post_init__(self) -> None: use_conda = not self.conda.is_empty() diff --git a/src/bentoml/_internal/client/__init__.py b/src/bentoml/_internal/client/__init__.py index 2be587975b4..dc64b2cabaa 100644 --- a/src/bentoml/_internal/client/__init__.py +++ b/src/bentoml/_internal/client/__init__.py @@ -87,18 +87,17 @@ async def async_wait_until_server_ready( @t.overload @staticmethod - def from_url(server_url: str, *, kind: None | t.Literal["auto"] = ...) -> Client: - ... + def from_url( + server_url: str, *, kind: None | t.Literal["auto"] = ... + ) -> Client: ... @t.overload @staticmethod - def from_url(server_url: str, *, kind: t.Literal["http"] = ...) -> HTTPClient: - ... + def from_url(server_url: str, *, kind: t.Literal["http"] = ...) -> HTTPClient: ... @t.overload @staticmethod - def from_url(server_url: str, *, kind: t.Literal["grpc"] = ...) -> GrpcClient: - ... + def from_url(server_url: str, *, kind: t.Literal["grpc"] = ...) -> GrpcClient: ... @staticmethod def from_url( @@ -205,22 +204,19 @@ async def wait_until_server_ready( @classmethod async def from_url( cls, server_url: str, *, kind: None | t.Literal["auto"] = ... - ) -> AsyncGrpcClient | AsyncHTTPClient: - ... + ) -> AsyncGrpcClient | AsyncHTTPClient: ... @t.overload @classmethod async def from_url( cls, server_url: str, *, kind: t.Literal["http"] = ... - ) -> AsyncHTTPClient: - ... + ) -> AsyncHTTPClient: ... @t.overload @classmethod async def from_url( cls, server_url: str, *, kind: t.Literal["grpc"] = ... - ) -> AsyncGrpcClient: - ... + ) -> AsyncGrpcClient: ... @classmethod async def from_url( @@ -326,22 +322,19 @@ def wait_until_server_ready( @classmethod def from_url( cls, server_url: str, *, kind: None | t.Literal["auto"] = ... - ) -> SyncGrpcClient | SyncHTTPClient: - ... + ) -> SyncGrpcClient | SyncHTTPClient: ... @t.overload @classmethod def from_url( cls, server_url: str, *, kind: t.Literal["http"] = ... - ) -> SyncHTTPClient: - ... + ) -> SyncHTTPClient: ... @t.overload @classmethod def from_url( cls, server_url: str, *, kind: t.Literal["grpc"] = ... - ) -> SyncGrpcClient: - ... + ) -> SyncGrpcClient: ... @classmethod def from_url( diff --git a/src/bentoml/_internal/cloud/schemas/modelschemas.py b/src/bentoml/_internal/cloud/schemas/modelschemas.py index 185c19dd86a..752dd724e17 100644 --- a/src/bentoml/_internal/cloud/schemas/modelschemas.py +++ b/src/bentoml/_internal/cloud/schemas/modelschemas.py @@ -341,9 +341,9 @@ class DeploymentTargetConfig: default=None ) deployment_strategy: t.Optional[str] = attr.field(default=None) # Specific - bento_deployment_overrides: t.Optional[ - ApiServerBentoDeploymentOverrides - ] = attr.field(default=None) + bento_deployment_overrides: t.Optional[ApiServerBentoDeploymentOverrides] = ( + attr.field(default=None) + ) bento_request_overrides: t.Optional[BentoRequestOverrides] = attr.field( default=None ) # Put into image builder diff --git a/src/bentoml/_internal/container/__init__.py b/src/bentoml/_internal/container/__init__.py index b1ac7c80851..6fce49535db 100644 --- a/src/bentoml/_internal/container/__init__.py +++ b/src/bentoml/_internal/container/__init__.py @@ -33,17 +33,14 @@ class DefaultBackendImpl(types.ModuleType): ENV: dict[str, str] | None BUILDKIT_SUPPORT: bool - def find_binary(self) -> str | None: - ... + def find_binary(self) -> str | None: ... def construct_build_args( self, **kwargs: t.Any, # pylint: disable=unused-argument - ) -> Arguments: - ... + ) -> Arguments: ... - def health(self) -> bool: - ... + def health(self) -> bool: ... DefaultBuilder: t.TypeAlias = t.Literal[ "docker", "podman", "buildah", "buildx", "nerdctl", "buildctl" @@ -153,11 +150,10 @@ def construct_containerfile( dockerfile_path = "env/docker/Dockerfile" instruction: list[str] = [] - with fs.open_fs("temp://") as temp_fs, open( - bento.path_of("bento.yaml"), "rb" - ) as bento_yaml: + with fs.open_fs("temp://") as temp_fs: tempdir = temp_fs.getsyspath("/") - options = BentoInfo.from_yaml_file(bento_yaml) + with open(bento.path_of("bento.yaml"), "rb") as bento_yaml: + options = BentoInfo.from_yaml_file(bento_yaml) # tmpdir is our new build context. fs.mirror.mirror(bento._fs, temp_fs, copy_if_newer=True) @@ -304,13 +300,11 @@ def register_backend( @t.overload -def health(backend: DefaultBuilder) -> bool: - ... +def health(backend: DefaultBuilder) -> bool: ... @t.overload -def health(backend: str) -> bool: - ... +def health(backend: str) -> bool: ... def health(backend: str) -> bool: @@ -332,13 +326,11 @@ def health(backend: str) -> bool: @t.overload -def get_backend(backend: DefaultBuilder) -> OCIBuilder: - ... +def get_backend(backend: DefaultBuilder) -> OCIBuilder: ... @t.overload -def get_backend(backend: str) -> OCIBuilder: - ... +def get_backend(backend: str) -> OCIBuilder: ... def get_backend(backend: str) -> OCIBuilder: diff --git a/src/bentoml/_internal/context.py b/src/bentoml/_internal/context.py index c6f7d74eb8e..2347a51e164 100644 --- a/src/bentoml/_internal/context.py +++ b/src/bentoml/_internal/context.py @@ -81,12 +81,12 @@ def mutablecopy(self) -> Metadata: class ServiceContext: def __init__(self) -> None: - self._request_var: contextvars.ContextVar[ - starlette.requests.Request - ] = contextvars.ContextVar("request") - self._response_var: contextvars.ContextVar[ - ServiceContext.ResponseContext - ] = contextvars.ContextVar("response") + self._request_var: contextvars.ContextVar[starlette.requests.Request] = ( + contextvars.ContextVar("request") + ) + self._response_var: contextvars.ContextVar[ServiceContext.ResponseContext] = ( + contextvars.ContextVar("response") + ) # A dictionary for storing global state shared by the process self.state: dict[str, t.Any] = {} diff --git a/src/bentoml/_internal/external_typing/starlette.py b/src/bentoml/_internal/external_typing/starlette.py index 7c05b6fbeb0..3045939dbf7 100644 --- a/src/bentoml/_internal/external_typing/starlette.py +++ b/src/bentoml/_internal/external_typing/starlette.py @@ -10,8 +10,7 @@ from starlette.types import Send as ASGISend class AsgiMiddleware(t.Protocol): - def __call__(self, app: ASGIApp, **options: t.Any) -> ASGIApp: - ... + def __call__(self, app: ASGIApp, **options: t.Any) -> ASGIApp: ... __all__ = [ "AsgiMiddleware", diff --git a/src/bentoml/_internal/external_typing/tensorflow.py b/src/bentoml/_internal/external_typing/tensorflow.py index 15a942acdfe..60147ca4e4e 100644 --- a/src/bentoml/_internal/external_typing/tensorflow.py +++ b/src/bentoml/_internal/external_typing/tensorflow.py @@ -38,14 +38,12 @@ from tensorflow.python.eager.function import ConcreteFunction class GenericFunction(t.Protocol): - def __call__(self, *args: t.Any, **kwargs: t.Any): - ... + def __call__(self, *args: t.Any, **kwargs: t.Any): ... # NOTE: future proof when tensorflow decided to remove EagerTensor # and enable eager execution on Tensor by default. This class only serves # as type fallback. - class EagerTensor(Tensor): - ... + class EagerTensor(Tensor): ... class SignatureMap(t.Mapping[str, t.Any], Trackable): @@ -53,22 +51,17 @@ class SignatureMap(t.Mapping[str, t.Any], Trackable): _signatures: t.Dict[str, t.Union[ConcreteFunction, RestoredFunction, Function]] - def __init__(self) -> None: - ... + def __init__(self) -> None: ... def __getitem__( self, key: str - ) -> t.Union[ConcreteFunction, RestoredFunction, Function]: - ... + ) -> t.Union[ConcreteFunction, RestoredFunction, Function]: ... - def __iter__(self) -> t.Iterator[str]: - ... + def __iter__(self) -> t.Iterator[str]: ... - def __len__(self) -> int: - ... + def __len__(self) -> int: ... - def __repr__(self) -> str: - ... + def __repr__(self) -> str: ... # This denotes all decorated function with `tf.function` diff --git a/src/bentoml/_internal/frameworks/diffusers.py b/src/bentoml/_internal/frameworks/diffusers.py index 5da553eb3bd..e2a2a25c42e 100644 --- a/src/bentoml/_internal/frameworks/diffusers.py +++ b/src/bentoml/_internal/frameworks/diffusers.py @@ -653,9 +653,9 @@ def get_runnable(bento_model: bentoml.Model) -> t.Type[bentoml.Runnable]: type[diffusers.DiffusionPipeline], _str2cls(pipeline_class) ) - scheduler_class: str | type[ - diffusers.SchedulerMixin - ] | None = bento_options.scheduler_class + scheduler_class: str | type[diffusers.SchedulerMixin] | None = ( + bento_options.scheduler_class + ) if scheduler_class and isinstance(scheduler_class, str): scheduler_class = t.cast( @@ -673,9 +673,9 @@ def get_runnable(bento_model: bentoml.Model) -> t.Type[bentoml.Runnable]: low_cpu_mem_usage: bool | None = bento_options.low_cpu_mem_usage variant: str | None = bento_options.variant _torch_dtype: str | torch.dtype | None = bento_options.torch_dtype - device_map: str | dict[ - str, int | str | torch.device - ] | None = bento_options.device_map + device_map: str | dict[str, int | str | torch.device] | None = ( + bento_options.device_map + ) load_pretrained_extra_kwargs = bento_options.load_pretrained_extra_kwargs support_lora = True if issubclass(pipeline_class, LoraLoaderMixin) else False diff --git a/src/bentoml/_internal/frameworks/transformers.py b/src/bentoml/_internal/frameworks/transformers.py index 9185f4fed58..a6504d51208 100644 --- a/src/bentoml/_internal/frameworks/transformers.py +++ b/src/bentoml/_internal/frameworks/transformers.py @@ -56,17 +56,14 @@ class ModelDefaultMapping(t.TypedDict): class PreTrainedProtocol(t.Protocol): @property - def framework(self) -> str: - ... + def framework(self) -> str: ... - def save_pretrained(self, save_directory: str, **kwargs: t.Any) -> None: - ... + def save_pretrained(self, save_directory: str, **kwargs: t.Any) -> None: ... @classmethod def from_pretrained( cls, pretrained_model_name_or_path: str, *args: t.Any, **kwargs: t.Any - ) -> PreTrainedProtocol: - ... + ) -> PreTrainedProtocol: ... P = t.ParamSpec("P") @@ -362,15 +359,13 @@ def delete_pipeline(task: str) -> None: @t.overload def load_model( bento_model: str | Tag | Model, **kwargs: t.Any -) -> transformers.Pipeline: - ... +) -> transformers.Pipeline: ... @t.overload def load_model( bento_model: str | Tag | Model, *args: t.Any, **kwargs: t.Any -) -> TransformersPreTrained: - ... +) -> TransformersPreTrained: ... def load_model(bento_model: str | Tag | Model, *args: t.Any, **kwargs: t.Any) -> t.Any: diff --git a/src/bentoml/_internal/io_descriptors/base.py b/src/bentoml/_internal/io_descriptors/base.py index fb79a2056ea..10412a53846 100644 --- a/src/bentoml/_internal/io_descriptors/base.py +++ b/src/bentoml/_internal/io_descriptors/base.py @@ -79,8 +79,7 @@ class IODescriptor(ABC, _OpenAPIMeta, t.Generic[IOType]): if t.TYPE_CHECKING: # Populated by subclasses. Makes pyright happy. - def __init__(self, **kwargs: t.Any) -> None: - ... + def __init__(self, **kwargs: t.Any) -> None: ... __slots__ = ( "_mime_type", @@ -140,8 +139,7 @@ def sample(self, value: IOType) -> None: if t.TYPE_CHECKING: @classmethod - def from_sample(cls, sample: t.Any, **attrs: t.Any) -> t.Self: - ... + def from_sample(cls, sample: t.Any, **attrs: t.Any) -> t.Self: ... @abstractmethod def _from_sample(self, sample: t.Any) -> IOType: diff --git a/src/bentoml/_internal/io_descriptors/multipart.py b/src/bentoml/_internal/io_descriptors/multipart.py index a403529f63e..568281c68b1 100644 --- a/src/bentoml/_internal/io_descriptors/multipart.py +++ b/src/bentoml/_internal/io_descriptors/multipart.py @@ -327,14 +327,12 @@ async def from_proto(self, field: pb.Multipart) -> dict[str, t.Any]: @t.overload async def _to_proto_impl( self, obj: dict[str, t.Any], *, version: t.Literal["v1"] - ) -> pb.Multipart: - ... + ) -> pb.Multipart: ... @t.overload async def _to_proto_impl( self, obj: dict[str, t.Any], *, version: t.Literal["v1alpha1"] - ) -> pb_v1alpha1.Multipart: - ... + ) -> pb_v1alpha1.Multipart: ... async def _to_proto_impl( self, obj: dict[str, t.Any], *, version: str diff --git a/src/bentoml/_internal/io_descriptors/numpy.py b/src/bentoml/_internal/io_descriptors/numpy.py index 02b53b51424..b909dcf36bd 100644 --- a/src/bentoml/_internal/io_descriptors/numpy.py +++ b/src/bentoml/_internal/io_descriptors/numpy.py @@ -65,15 +65,13 @@ @t.overload def dtypepb_to_npdtype_map( version: t.Literal["v1"] = ..., -) -> dict[pb.NDArray.DType.ValueType, ext.NpDTypeLike]: - ... +) -> dict[pb.NDArray.DType.ValueType, ext.NpDTypeLike]: ... @t.overload def dtypepb_to_npdtype_map( version: t.Literal["v1alpha1"] = ..., -) -> dict[pb_v1alpha1.NDArray.DType.ValueType, ext.NpDTypeLike]: - ... +) -> dict[pb_v1alpha1.NDArray.DType.ValueType, ext.NpDTypeLike]: ... @lru_cache(maxsize=2) @@ -97,15 +95,13 @@ def dtypepb_to_npdtype_map( @t.overload def dtypepb_to_fieldpb_map( version: t.Literal["v1"] = ..., -) -> dict[pb.NDArray.DType.ValueType, str]: - ... +) -> dict[pb.NDArray.DType.ValueType, str]: ... @t.overload def dtypepb_to_fieldpb_map( version: t.Literal["v1alpha1"] = ..., -) -> dict[pb_v1alpha1.NDArray.DType.ValueType, str]: - ... +) -> dict[pb_v1alpha1.NDArray.DType.ValueType, str]: ... @lru_cache(maxsize=2) @@ -125,15 +121,13 @@ def fieldpb_to_npdtype_map() -> dict[str, ext.NpDTypeLike]: @t.overload def npdtype_to_dtypepb_map( version: t.Literal["v1"] = ..., -) -> dict[ext.NpDTypeLike, pb.NDArray.DType.ValueType]: - ... +) -> dict[ext.NpDTypeLike, pb.NDArray.DType.ValueType]: ... @t.overload def npdtype_to_dtypepb_map( version: t.Literal["v1alpha1"] = ..., -) -> dict[ext.NpDTypeLike, pb_v1alpha1.NDArray.DType.ValueType]: - ... +) -> dict[ext.NpDTypeLike, pb_v1alpha1.NDArray.DType.ValueType]: ... @lru_cache(maxsize=2) @@ -593,14 +587,12 @@ async def from_proto(self, field: pb.NDArray | bytes) -> ext.NpNDArray: @t.overload async def _to_proto_impl( self, obj: ext.NpNDArray, *, version: t.Literal["v1"] - ) -> pb.NDArray: - ... + ) -> pb.NDArray: ... @t.overload async def _to_proto_impl( self, obj: ext.NpNDArray, *, version: t.Literal["v1alpha1"] - ) -> pb_v1alpha1.NDArray: - ... + ) -> pb_v1alpha1.NDArray: ... async def _to_proto_impl( self, obj: ext.NpNDArray, *, version: str diff --git a/src/bentoml/_internal/io_descriptors/pandas.py b/src/bentoml/_internal/io_descriptors/pandas.py index 92752bad9f1..7c0c99a32c3 100644 --- a/src/bentoml/_internal/io_descriptors/pandas.py +++ b/src/bentoml/_internal/io_descriptors/pandas.py @@ -682,14 +682,12 @@ def process_columns_contents(content: pb.Series) -> dict[str, t.Any]: @t.overload async def _to_proto_impl( self, obj: ext.PdDataFrame, *, version: t.Literal["v1"] - ) -> pb.DataFrame: - ... + ) -> pb.DataFrame: ... @t.overload async def _to_proto_impl( self, obj: ext.PdDataFrame, *, version: t.Literal["v1alpha1"] - ) -> pb_v1alpha1.DataFrame: - ... + ) -> pb_v1alpha1.DataFrame: ... async def _to_proto_impl( self, obj: ext.PdDataFrame, *, version: str @@ -1143,14 +1141,12 @@ async def from_proto(self, field: pb.Series | bytes) -> ext.PdSeries: @t.overload async def _to_proto_impl( self, obj: ext.PdSeries, *, version: t.Literal["v1"] - ) -> pb.Series: - ... + ) -> pb.Series: ... @t.overload async def _to_proto_impl( self, obj: ext.PdSeries, *, version: t.Literal["v1alpha1"] - ) -> pb_v1alpha1.Series: - ... + ) -> pb_v1alpha1.Series: ... async def _to_proto_impl( self, obj: ext.PdSeries, *, version: str diff --git a/src/bentoml/_internal/marshal/dispatcher.py b/src/bentoml/_internal/marshal/dispatcher.py index 43af475a796..e8a3e846ea3 100644 --- a/src/bentoml/_internal/marshal/dispatcher.py +++ b/src/bentoml/_internal/marshal/dispatcher.py @@ -143,9 +143,9 @@ def __init__( self.tick_interval = 0.001 self._controller = None - self._queue: collections.deque[ - Job[T_IN, T_OUT] - ] = collections.deque() # TODO(bojiang): maxlen + self._queue: collections.deque[Job[T_IN, T_OUT]] = ( + collections.deque() + ) # TODO(bojiang): maxlen self.get_batch_size = get_batch_size self._sema = shared_sema if shared_sema else NonBlockSema(1) diff --git a/src/bentoml/_internal/models/model.py b/src/bentoml/_internal/models/model.py index 422121c3bd6..8e1d0d6cb3e 100644 --- a/src/bentoml/_internal/models/model.py +++ b/src/bentoml/_internal/models/model.py @@ -639,12 +639,10 @@ def to_dict(self) -> t.Dict[str, t.Any]: return bentoml_cattr.unstructure(self) @overload - def dump(self, stream: io.StringIO) -> io.BytesIO: - ... + def dump(self, stream: io.StringIO) -> io.BytesIO: ... @overload - def dump(self, stream: None = None) -> None: - ... + def dump(self, stream: None = None) -> None: ... def dump(self, stream: io.StringIO | None = None) -> io.BytesIO | None: return yaml.safe_dump(self.to_dict(), stream=stream, sort_keys=False) # type: ignore (bad yaml types) diff --git a/src/bentoml/_internal/monitoring/api.py b/src/bentoml/_internal/monitoring/api.py index c8067b8694b..8eaf34fdafb 100644 --- a/src/bentoml/_internal/monitoring/api.py +++ b/src/bentoml/_internal/monitoring/api.py @@ -26,8 +26,7 @@ def monitor( name: str | t.Any, monitor_class: DefaultMonitor = ..., monitor_options: dict[str, t.Any] | None = ..., -) -> t.Generator[DefaultMonitor, None, None]: - ... +) -> t.Generator[DefaultMonitor, None, None]: ... @t.overload @@ -36,8 +35,7 @@ def monitor( name: str | t.Any, monitor_class: str = ..., monitor_options: dict[str, t.Any] | None = ..., -) -> t.Generator[MonitorBase[t.Any], None, None]: - ... +) -> t.Generator[MonitorBase[t.Any], None, None]: ... @t.overload @@ -46,8 +44,7 @@ def monitor( name: str | t.Any, monitor_class: None = ..., monitor_options: dict[str, t.Any] | None = ..., -) -> t.Generator[MonitorBase[t.Any], None, None]: - ... +) -> t.Generator[MonitorBase[t.Any], None, None]: ... @contextlib.contextmanager diff --git a/src/bentoml/_internal/monitoring/base.py b/src/bentoml/_internal/monitoring/base.py index 38a01ebab20..d6b1ae2aca4 100644 --- a/src/bentoml/_internal/monitoring/base.py +++ b/src/bentoml/_internal/monitoring/base.py @@ -5,12 +5,12 @@ import logging import typing as t -MON_COLUMN_VAR: contextvars.ContextVar[ - "dict[str, dict[str, str]] | None" -] = contextvars.ContextVar("MON_COLUMN_VAR", default=None) -MON_DATAS_VAR: contextvars.ContextVar[ - "dict[str, collections.deque[t.Any]] | None" -] = contextvars.ContextVar("MON_DATAS_VAR", default=None) +MON_COLUMN_VAR: contextvars.ContextVar["dict[str, dict[str, str]] | None"] = ( + contextvars.ContextVar("MON_COLUMN_VAR", default=None) +) +MON_DATAS_VAR: contextvars.ContextVar["dict[str, collections.deque[t.Any]] | None"] = ( + contextvars.ContextVar("MON_DATAS_VAR", default=None) +) DT = t.TypeVar("DT") MT = t.TypeVar("MT", bound="MonitorBase[t.Any]") diff --git a/src/bentoml/_internal/runner/container.py b/src/bentoml/_internal/runner/container.py index fc1694a1279..d64ef0cacf1 100644 --- a/src/bentoml/_internal/runner/container.py +++ b/src/bentoml/_internal/runner/container.py @@ -54,13 +54,11 @@ def create_payload( @classmethod @abc.abstractmethod - def to_payload(cls, batch: BatchType, batch_dim: int) -> Payload: - ... + def to_payload(cls, batch: BatchType, batch_dim: int) -> Payload: ... @classmethod @abc.abstractmethod - def from_payload(cls, payload: Payload) -> BatchType: - ... + def from_payload(cls, payload: Payload) -> BatchType: ... @t.overload @classmethod @@ -69,8 +67,7 @@ def to_triton_payload( inp: tritongrpcclient.InferInput, meta: tritongrpcclient.service_pb2.ModelMetadataResponse.TensorMetadata, _use_http_client: t.Literal[False] = ..., - ) -> tritongrpcclient.InferInput: - ... + ) -> tritongrpcclient.InferInput: ... @t.overload @classmethod @@ -79,8 +76,7 @@ def to_triton_payload( inp: tritonhttpclient.InferInput, meta: dict[str, t.Any], _use_http_client: t.Literal[True] = ..., - ) -> tritongrpcclient.InferInput: - ... + ) -> tritongrpcclient.InferInput: ... @classmethod def to_triton_payload( @@ -131,29 +127,25 @@ def to_triton_http_payload( @abc.abstractmethod def batches_to_batch( cls, batches: t.Sequence[BatchType], batch_dim: int - ) -> tuple[BatchType, list[int]]: - ... + ) -> tuple[BatchType, list[int]]: ... @classmethod @abc.abstractmethod def batch_to_batches( cls, batch: BatchType, indices: t.Sequence[int], batch_dim: int - ) -> list[BatchType]: - ... + ) -> list[BatchType]: ... @classmethod @abc.abstractmethod def batch_to_payloads( cls, batch: BatchType, indices: t.Sequence[int], batch_dim: int - ) -> list[Payload]: - ... + ) -> list[Payload]: ... @classmethod @abc.abstractmethod def from_batch_payloads( cls, payloads: t.Sequence[Payload], batch_dim: int - ) -> tuple[BatchType, list[int]]: - ... + ) -> tuple[BatchType, list[int]]: ... @classmethod def get_batch_size(cls, batch: BatchType, batch_dim: int) -> int: @@ -702,16 +694,16 @@ def register_builtin_containers(): class AutoContainer(DataContainer[t.Any, t.Any]): @classmethod def to_payload(cls, batch: t.Any, batch_dim: int) -> Payload: - container_cls: t.Type[ - DataContainer[t.Any, t.Any] - ] = DataContainerRegistry.find_by_batch_type(type(batch)) + container_cls: t.Type[DataContainer[t.Any, t.Any]] = ( + DataContainerRegistry.find_by_batch_type(type(batch)) + ) return container_cls.to_payload(batch, batch_dim) @classmethod def get_batch_size(cls, batch: Any, batch_dim: int) -> int: - container_cls: t.Type[ - DataContainer[t.Any, t.Any] - ] = DataContainerRegistry.find_by_batch_type(type(batch)) + container_cls: t.Type[DataContainer[t.Any, t.Any]] = ( + DataContainerRegistry.find_by_batch_type(type(batch)) + ) return container_cls.get_batch_size(batch, batch_dim) @classmethod @@ -726,8 +718,7 @@ def to_triton_payload( inp: tritongrpcclient.InferInput, meta: tritongrpcclient.service_pb2.ModelMetadataResponse.TensorMetadata, _use_http_client: t.Literal[False] = ..., - ) -> tritongrpcclient.InferInput: - ... + ) -> tritongrpcclient.InferInput: ... @t.overload @classmethod @@ -736,8 +727,7 @@ def to_triton_payload( inp: tritonhttpclient.InferInput, meta: dict[str, t.Any], _use_http_client: t.Literal[True] = ..., - ) -> tritongrpcclient.InferInput: - ... + ) -> tritongrpcclient.InferInput: ... @classmethod def to_triton_payload( @@ -762,18 +752,18 @@ def to_triton_payload( def batches_to_batch( cls, batches: t.Sequence[BatchType], batch_dim: int = 0 ) -> tuple[BatchType, list[int]]: - container_cls: t.Type[ - DataContainer[t.Any, t.Any] - ] = DataContainerRegistry.find_by_batch_type(type(batches[0])) + container_cls: t.Type[DataContainer[t.Any, t.Any]] = ( + DataContainerRegistry.find_by_batch_type(type(batches[0])) + ) return container_cls.batches_to_batch(batches, batch_dim) @classmethod def batch_to_batches( cls, batch: BatchType, indices: t.Sequence[int], batch_dim: int = 0 ) -> list[BatchType]: - container_cls: t.Type[ - DataContainer[t.Any, t.Any] - ] = DataContainerRegistry.find_by_batch_type(type(batch)) + container_cls: t.Type[DataContainer[t.Any, t.Any]] = ( + DataContainerRegistry.find_by_batch_type(type(batch)) + ) return container_cls.batch_to_batches(batch, indices, batch_dim) @classmethod @@ -783,9 +773,9 @@ def batch_to_payloads( indices: t.Sequence[int], batch_dim: int = 0, ) -> list[Payload]: - container_cls: t.Type[ - DataContainer[t.Any, t.Any] - ] = DataContainerRegistry.find_by_batch_type(type(batch)) + container_cls: t.Type[DataContainer[t.Any, t.Any]] = ( + DataContainerRegistry.find_by_batch_type(type(batch)) + ) return container_cls.batch_to_payloads(batch, indices, batch_dim) @classmethod diff --git a/src/bentoml/_internal/runner/runnable.py b/src/bentoml/_internal/runner/runnable.py index 39937b3b625..3dedfcb351c 100644 --- a/src/bentoml/_internal/runner/runnable.py +++ b/src/bentoml/_internal/runner/runnable.py @@ -83,8 +83,7 @@ def method( batch_dim: tuple[int, int] | int = 0, input_spec: AnyType | tuple[AnyType, ...] | None = None, output_spec: AnyType | None = None, - ) -> RunnableMethod[T, P, R]: - ... + ) -> RunnableMethod[T, P, R]: ... @overload @staticmethod @@ -95,8 +94,7 @@ def method( batch_dim: tuple[int, int] | int = 0, input_spec: AnyType | tuple[AnyType, ...] | None = None, output_spec: AnyType | None = None, - ) -> t.Callable[[t.Callable[t.Concatenate[T, P], R]], RunnableMethod[T, P, R]]: - ... + ) -> t.Callable[[t.Callable[t.Concatenate[T, P], R]], RunnableMethod[T, P, R]]: ... @staticmethod def method( diff --git a/src/bentoml/_internal/runner/runner.py b/src/bentoml/_internal/runner/runner.py index d392df8eac9..a9e64e74c97 100644 --- a/src/bentoml/_internal/runner/runner.py +++ b/src/bentoml/_internal/runner/runner.py @@ -130,11 +130,11 @@ def __getattr__( ... @t.overload - def __getattr__(self, item: t.LiteralString) -> RunnerMethod[t.Any, P, t.Any]: - ... + def __getattr__( + self, item: t.LiteralString + ) -> RunnerMethod[t.Any, P, t.Any]: ... - def __getattr__(self, item: str) -> t.Any: - ... + def __getattr__(self, item: str) -> t.Any: ... runner_methods: list[RunnerMethod[t.Any, t.Any, t.Any]] scheduling_strategy: type[Strategy] diff --git a/src/bentoml/_internal/runner/runner_handle/__init__.py b/src/bentoml/_internal/runner/runner_handle/__init__.py index 828ae336b6b..fe9df40e915 100644 --- a/src/bentoml/_internal/runner/runner_handle/__init__.py +++ b/src/bentoml/_internal/runner/runner_handle/__init__.py @@ -22,8 +22,7 @@ class RunnerHandle(ABC): @abstractmethod - def __init__(self, runner: AbstractRunner) -> None: - ... + def __init__(self, runner: AbstractRunner) -> None: ... @abstractmethod async def is_ready(self, timeout: int) -> bool: @@ -35,8 +34,7 @@ def run_method( __bentoml_method: RunnerMethod[t.Any, P, R], *args: P.args, **kwargs: P.kwargs, - ) -> R: - ... + ) -> R: ... @abstractmethod async def async_run_method( @@ -44,8 +42,7 @@ async def async_run_method( __bentoml_method: RunnerMethod[t.Any, P, R], *args: P.args, **kwargs: P.kwargs, - ) -> R: - ... + ) -> R: ... @abstractmethod def async_stream_method( @@ -53,8 +50,7 @@ def async_stream_method( __bentoml_method: RunnerMethod[t.Any, P, R], *args: P.args, **kwargs: P.kwargs, - ) -> t.AsyncGenerator[R, None]: - ... + ) -> t.AsyncGenerator[R, None]: ... class DummyRunnerHandle(RunnerHandle): diff --git a/src/bentoml/_internal/runner/strategy.py b/src/bentoml/_internal/runner/strategy.py index e253bafadec..7d44278af92 100644 --- a/src/bentoml/_internal/runner/strategy.py +++ b/src/bentoml/_internal/runner/strategy.py @@ -22,8 +22,7 @@ def get_worker_count( runnable_class: type[Runnable], resource_request: dict[str, t.Any] | None, workers_per_resource: int | float, - ) -> int: - ... + ) -> int: ... @classmethod @abc.abstractmethod diff --git a/src/bentoml/_internal/server/base_app.py b/src/bentoml/_internal/server/base_app.py index aaf19cc9f70..ff254d0da5c 100644 --- a/src/bentoml/_internal/server/base_app.py +++ b/src/bentoml/_internal/server/base_app.py @@ -35,8 +35,7 @@ def __init__( @property @abc.abstractmethod - def name(self) -> str: - ... + def name(self) -> str: ... @property def on_startup(self) -> list[LifecycleHook]: diff --git a/src/bentoml/_internal/service/service.py b/src/bentoml/_internal/service/service.py index c41dfed797b..c3bc14b8602 100644 --- a/src/bentoml/_internal/service/service.py +++ b/src/bentoml/_internal/service/service.py @@ -98,9 +98,9 @@ class Service: mount_apps: t.List[t.Tuple[ext.ASGIApp, str, str]] = attr.field( init=False, factory=list ) - middlewares: t.List[ - t.Tuple[t.Type[ext.AsgiMiddleware], t.Dict[str, t.Any]] - ] = attr.field(init=False, factory=list) + middlewares: t.List[t.Tuple[t.Type[ext.AsgiMiddleware], t.Dict[str, t.Any]]] = ( + attr.field(init=False, factory=list) + ) # gRPC related mount_servicers: list[tuple[ServicerClass, AddServicerFn, list[str]]] = attr.field( diff --git a/src/bentoml/_internal/utils/__init__.py b/src/bentoml/_internal/utils/__init__.py index e41f41e8ad1..9893931710a 100644 --- a/src/bentoml/_internal/utils/__init__.py +++ b/src/bentoml/_internal/utils/__init__.py @@ -115,13 +115,11 @@ def add_experimental_docstring(f: t.Callable[P, t.Any]) -> t.Callable[P, t.Any]: @overload -def first_not_none(*args: T | None, default: T) -> T: - ... +def first_not_none(*args: T | None, default: T) -> T: ... @overload -def first_not_none(*args: T | None) -> T | None: - ... +def first_not_none(*args: T | None) -> T | None: ... def first_not_none(*args: T | None, default: None | T = None) -> T | None: diff --git a/src/bentoml/_internal/utils/dotenv.py b/src/bentoml/_internal/utils/dotenv.py index 00bd48fb533..0d436a82a64 100644 --- a/src/bentoml/_internal/utils/dotenv.py +++ b/src/bentoml/_internal/utils/dotenv.py @@ -23,6 +23,7 @@ This module is a port of jpadilla/django-dotenv. Refer to https://github.com/jpadilla/django-dotenv for original implementation """ + from __future__ import annotations import logging diff --git a/src/bentoml/_internal/utils/unflatten.py b/src/bentoml/_internal/utils/unflatten.py index 95d461be001..52b43fe2e2a 100644 --- a/src/bentoml/_internal/utils/unflatten.py +++ b/src/bentoml/_internal/utils/unflatten.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -""" Unflatten nested dict/array data +"""Unflatten nested dict/array data *** This is a modified version of the original unflatten.py from https://github.com/dairiki/unflatten, which is published under the license *** @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. """ + from __future__ import absolute_import from __future__ import annotations diff --git a/src/bentoml/container.py b/src/bentoml/container.py index cffbe1cebc0..00769a5f80b 100644 --- a/src/bentoml/container.py +++ b/src/bentoml/container.py @@ -61,8 +61,7 @@ def build( ssh: str | ArgType = ..., target: str | ArgType = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @t.overload @@ -88,8 +87,7 @@ def build( metadata_file: PathType | None = ..., opt: tuple[str, ...] | dict[str, str | tuple[str, ...]] | None = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @t.overload @@ -132,8 +130,7 @@ def build( target: str | None = ..., ulimit: str | dict[str, tuple[int, int]] | ArgType = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @t.overload @@ -177,8 +174,7 @@ def build( snapshotter: str | None = ..., storage_driver: str | None = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @t.overload @@ -277,8 +273,7 @@ def build( variant: str | None = ..., volume: str | tuple[str, str, str] | None = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @t.overload @@ -360,8 +355,7 @@ def build( variant: str | None = ..., volume: str | tuple[str, str, str] | None = ..., **kwargs: t.Any, -) -> t.Any: - ... +) -> t.Any: ... @inject diff --git a/src/bentoml/deployment.py b/src/bentoml/deployment.py index ddbaf6a39af..4906cd7ed29 100644 --- a/src/bentoml/deployment.py +++ b/src/bentoml/deployment.py @@ -39,8 +39,7 @@ def create( strategy: str | None = ..., envs: t.List[EnvItemSchema] | t.List[dict[str, t.Any]] | None = ..., extras: dict[str, t.Any] | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @t.overload @@ -52,8 +51,7 @@ def create( *, bento: Tag | str | None = ..., config_file: str | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @t.overload @@ -65,8 +63,7 @@ def create( *, bento: Tag | str | None = ..., config_dict: dict[str, t.Any] | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @inject @@ -139,8 +136,7 @@ def update( strategy: str | None = ..., envs: t.List[EnvItemSchema] | t.List[dict[str, t.Any]] | None = ..., extras: dict[str, t.Any] | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @t.overload @@ -153,8 +149,7 @@ def update( *, bento: Tag | str | None = ..., config_file: str | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @t.overload @@ -167,8 +162,7 @@ def update( *, bento: Tag | str | None = ..., config_dict: dict[str, t.Any] | None = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @inject @@ -241,8 +235,7 @@ def apply( *, bento: t.Optional[t.Union[Tag, str]] = ..., config_dict: t.Optional[dict[str, t.Any]] = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @t.overload @@ -255,8 +248,7 @@ def apply( *, bento: t.Optional[t.Union[Tag, str]] = ..., config_file: t.Optional[str] = ..., -) -> DeploymentInfo: - ... +) -> DeploymentInfo: ... @inject diff --git a/src/bentoml/models.py b/src/bentoml/models.py index 06006cbf313..75ad5ccffeb 100644 --- a/src/bentoml/models.py +++ b/src/bentoml/models.py @@ -246,8 +246,7 @@ class CreateKwargs(t.TypedDict): @contextmanager def _create( name: Tag | str, /, **attrs: t.Unpack[CreateKwargs] -) -> t.Generator[Model, None, None]: - ... +) -> t.Generator[Model, None, None]: ... @t.overload @@ -265,8 +264,7 @@ def _create( metadata: dict[str, t.Any] | None = ..., context: ModelContext, _model_store: ModelStore = ..., -) -> t.Generator[Model, None, None]: - ... +) -> t.Generator[Model, None, None]: ... @inject diff --git a/src/bentoml/testing/server.py b/src/bentoml/testing/server.py index 60e24131359..a5925bee115 100644 --- a/src/bentoml/testing/server.py +++ b/src/bentoml/testing/server.py @@ -197,10 +197,9 @@ def run_bento_server_container( from bentoml._internal.configuration.containers import BentoMLContainer container_name = f"bentoml-test-{image_tag.replace(':', '_')}-{hash(config_file)}" - with reserve_free_port(enable_so_reuseport=use_grpc) as port, reserve_free_port( - enable_so_reuseport=use_grpc - ) as prom_port: - pass + with reserve_free_port(enable_so_reuseport=use_grpc) as port: + with reserve_free_port(enable_so_reuseport=use_grpc) as prom_port: + pass cmd = [ backend, diff --git a/src/bentoml/triton.py b/src/bentoml/triton.py index 5e861116786..9968cbf02c7 100644 --- a/src/bentoml/triton.py +++ b/src/bentoml/triton.py @@ -203,16 +203,14 @@ def __getattr__(self, item: t.Literal["__attrs_init__"]) -> t.Callable[..., None @t.overload def __getattr__( self, item: _ClientMethod - ) -> t.Callable[..., t.Coroutine[t.Any, t.Any, t.Any]]: - ... + ) -> t.Callable[..., t.Coroutine[t.Any, t.Any, t.Any]]: ... @t.overload def __getattr__( self, item: _ModelName ) -> _RunnerMethod[ t.Any, _P, _tritongrpcclient.InferResult | _tritonhttpclient.InferResult - ]: - ... + ]: ... def __getattr__(self, item: str) -> t.Any: from ._internal.runner.runner_handle.remote import TritonRunnerHandle diff --git a/src/bentoml_cli/utils.py b/src/bentoml_cli/utils.py index 48b1f996d5b..3ec3d3e9d75 100644 --- a/src/bentoml_cli/utils.py +++ b/src/bentoml_cli/utils.py @@ -32,8 +32,7 @@ class ClickFunctionWrapper(t.Protocol[P]): def __call__( # pylint: disable=no-method-argument *args: P.args, **kwargs: P.kwargs, - ) -> t.Any: - ... + ) -> t.Any: ... WrappedCLI = t.Callable[P, ClickFunctionWrapper[P]] @@ -127,13 +126,11 @@ def validate_docker_tag( @t.overload -def normalize_none_type(value: t.Mapping[str, t.Any]) -> t.Mapping[str, t.Any]: - ... +def normalize_none_type(value: t.Mapping[str, t.Any]) -> t.Mapping[str, t.Any]: ... @t.overload -def normalize_none_type(value: ClickParamType) -> ClickParamType: - ... +def normalize_none_type(value: ClickParamType) -> ClickParamType: ... def normalize_none_type(