Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dreadnode/data_types/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def canonical_array(self) -> "np.ndarray[t.Any, np.dtype[np.float32]]":
Returns:
float32 numpy array in [0,1] range, HWC format
"""
return self._canonical_array.copy() # Always return a copy for safety
return t.cast("np.ndarray[t.Any, np.dtype[np.float32]]", self._canonical_array.copy()) # type: ignore[redundant-cast]

@property
def shape(self) -> tuple[int, ...]:
Expand Down Expand Up @@ -328,7 +328,7 @@ def to_numpy(self, dtype: t.Any = np.float32) -> "np.ndarray[t.Any, t.Any]":
# Keep float range [0, 1]
arr = arr.astype(dtype)

return arr
return t.cast("np.ndarray[t.Any, t.Any]", arr)

def to_pil(self) -> "PILImage":
"""Returns the image as a Pillow Image object."""
Expand Down