Skip to content

Commit

Permalink
Allow bin enconding for non-numeric content
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Mar 7, 2024
1 parent 508cbdd commit 255090d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions h5grove/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response:
)

content_array = np.array(content, copy=False)
if not is_numeric_data(content_array):
raise QueryArgumentError(
f"Unsupported encoding {encoding} for non-numeric content"
)

if encoding == "bin":
return Response(
Expand All @@ -124,6 +120,11 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response:
},
)

if not is_numeric_data(content_array):
raise QueryArgumentError(
f"Unsupported encoding {encoding} for non-numeric content"
)

if encoding == "csv":
return Response(
csv_encode(content_array),
Expand Down

0 comments on commit 255090d

Please sign in to comment.