Skip to content
Open
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
7 changes: 5 additions & 2 deletions marimo/_plugins/core/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ def io_to_data_url(
def is_data_empty(data: Union[str, bytes, io.BytesIO, Any]) -> bool:
"""Check if a data object is empty."""
if isinstance(data, str):
return data == ""
return not data

if isinstance(data, bytes):
return data == b""
return not data

if type(data) is io.BytesIO:
return data.getbuffer().nbytes == 0

if hasattr(data, "getbuffer"):
return cast(io.BytesIO, data).getbuffer().nbytes == 0
Expand Down