Skip to content

Commit

Permalink
ci: auto fixes from pre-commit.ci
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 6, 2024
1 parent 8757137 commit 9c6d1eb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 8 additions & 7 deletions src/bentoml/_internal/io_descriptors/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)
Expand Down Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions tests/e2e/bento_server_http/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 9c6d1eb

Please sign in to comment.