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
19 changes: 18 additions & 1 deletion src/Core/Py.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,26 @@ function Base.show(io::IO, ::MIME"text/plain", o::Py)
hasprefix = (get(io, :typeinfo, Any) != Py)::Bool
compact = get(io, :compact, false)::Bool
multiline = '\n' in str
multilinePrefix = "Python:"
if multiline
if pyhasattr(o, "shape")
multilinePrefix *= " " * pyrepr(String, o.shape)
end
if pyhasattr(o, "dtype")
multilinePrefix *= " " * pyrepr(String, o.dtype)
end
if pyhasattr(o, "flags")
if haskey(o.flags, "F_CONTIGUOUS")
if pytruth(o.flags["F_CONTIGUOUS"])
multilinePrefix *= " (F order)"
end
end
end
end
prefix =
hasprefix ?
compact ? "Py:$(multiline ? '\n' : ' ')" : "Python:$(multiline ? '\n' : ' ')" : ""
compact ? "Py:$(multiline ? '\n' : ' ')" :
"$(multilinePrefix)$(multiline ? '\n' : ' ')" : ""
print(io, prefix)
h, w = displaysize(io)
if get(io, :limit, true)
Expand Down
Loading