Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion src/Core/Py.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ function Base.show(io::IO, x::Py)
end
end

printPyPrefix = true

function printPyPrefix!(printPrefix::Bool=true)
global printPyPrefix = printPrefix
return printPyPrefix
end
export printPyPrefix!

function Base.show(io::IO, ::MIME"text/plain", o::Py)
if pyisnull(o)
str = "NULL"
Expand All @@ -184,7 +192,7 @@ function Base.show(io::IO, ::MIME"text/plain", o::Py)
compact = get(io, :compact, false)::Bool
multiline = '\n' in str
prefix = hasprefix ? compact ? "Py:$(multiline ? '\n' : ' ')" : "Python:$(multiline ? '\n' : ' ')" : ""
print(io, prefix)
printPyPrefix && print(io, prefix)
h, w = displaysize(io)
if get(io, :limit, true)
h, w = displaysize(io)
Expand Down
2 changes: 1 addition & 1 deletion src/PythonCall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
for k in [:python_executable_path, :python_library_path, :python_library_handle, :python_version]
@eval using .C: $k
end
for k in [:pynew, :pyisnull, :pycopy!, :getptr, :pydel!, :unsafe_pynext, :PyNULL, :CONFIG]
for k in [:pynew, :pyisnull, :pycopy!, :getptr, :pydel!, :unsafe_pynext, :PyNULL, :CONFIG, :printPyPrefix!]
@eval using .Core: $k
end
for k in [:pyconvert_add_rule, :pyconvert_return, :pyconvert_unconverted, :PYCONVERT_PRIORITY_WRAP, :PYCONVERT_PRIORITY_ARRAY, :PYCONVERT_PRIORITY_CANONICAL, :PYCONVERT_PRIORITY_NORMAL, :PYCONVERT_PRIORITY_FALLBACK]
Expand Down