From 9c6d1ebd700a5b9fc99b40736cf35e19c28ca0d3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:44:00 +0000 Subject: [PATCH] ci: auto fixes from pre-commit.ci For more information, see https://pre-commit.ci --- src/bentoml/_internal/io_descriptors/pandas.py | 15 ++++++++------- tests/e2e/bento_server_http/tests/test_io.py | 12 +++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bentoml/_internal/io_descriptors/pandas.py b/src/bentoml/_internal/io_descriptors/pandas.py index 537fc74849a..592c2386617 100644 --- a/src/bentoml/_internal/io_descriptors/pandas.py +++ b/src/bentoml/_internal/io_descriptors/pandas.py @@ -208,12 +208,9 @@ def _validate_serialization_format(serialization_format: SerializationFormat): "Parquet serialization is not available. Try installing pyarrow or fastparquet first." ) if ( - ( - serialization_format is SerializationFormat.ARROW_FILE - or serialization_format is SerializationFormat.ARROW_STREAM - ) - and find_spec("pyarrow") is None - ): + serialization_format is SerializationFormat.ARROW_FILE + or serialization_format is SerializationFormat.ARROW_STREAM + ) and find_spec("pyarrow") is None: raise MissingDependencyException( "Arrow serialization is not available. Try installing pyarrow first." ) @@ -349,7 +346,11 @@ def __init__( shape: tuple[int, ...] | None = None, enforce_shape: bool = False, default_format: t.Literal[ - "json", "parquet", "csv", "arrow_file", "arrow_stream", + "json", + "parquet", + "csv", + "arrow_file", + "arrow_stream", ] = "json", ): self._orient: ext.DataFrameOrient = orient diff --git a/tests/e2e/bento_server_http/tests/test_io.py b/tests/e2e/bento_server_http/tests/test_io.py index 190cecb91ff..03fd0c88f0b 100644 --- a/tests/e2e/bento_server_http/tests/test_io.py +++ b/tests/e2e/bento_server_http/tests/test_io.py @@ -7,8 +7,8 @@ from typing import Tuple import numpy as np -import pytest import pyarrow +import pytest from bentoml.client import AsyncHTTPClient from bentoml.testing.utils import parse_multipart_form @@ -145,7 +145,10 @@ async def test_pandas(host: str): assert response.status_code == 200 assert await response.aread() == b'[{"col1":202}]' - headers = {"Content-Type": "application/vnd.apache.arrow.stream", "Origin": ORIGIN} + headers = { + "Content-Type": "application/vnd.apache.arrow.stream", + "Origin": ORIGIN, + } sink = pyarrow.BufferOutputStream() batch = pyarrow.RecordBatch.from_pandas(df, preserve_index=True) with pyarrow.ipc.new_stream(sink, batch.schema) as writer: @@ -157,7 +160,10 @@ async def test_pandas(host: str): assert response.status_code == 200 assert await response.aread() == b'[{"col1":202}]' - headers = {"Content-Type": "application/vnd.apache.arrow.file", "Origin": ORIGIN} + headers = { + "Content-Type": "application/vnd.apache.arrow.file", + "Origin": ORIGIN, + } sink = pyarrow.BufferOutputStream() batch = pyarrow.RecordBatch.from_pandas(df, preserve_index=True) with pyarrow.ipc.new_file(sink, batch.schema) as writer: