Skip to content

Commit

Permalink
json reading reshaping
Browse files Browse the repository at this point in the history
  • Loading branch information
imatiushin committed Sep 5, 2024
1 parent 640bf04 commit 74a9844
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions deker_server_adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,14 @@ def read_data(
message=f"Timeout on {self.type.name} read {array}",
)

numpy_array = res.json # type: ignore[call-overload]
shape = array[bounds].shape
if not shape and numpy_array.size:
return numpy_array[0]
data = res.json # type: ignore[call-overload]
if isinstance(data, list):
data = np.array(data, dtype=array.dtype)
np_array = np.array(data).reshape(array.shape)
else:
np_array = array.dtype(data)

return numpy_array
return np_array

def update(self, array: "BaseArray", bounds: Slice, data: Numeric) -> None:
"""Update array/varray on server.
Expand Down

0 comments on commit 74a9844

Please sign in to comment.