diff --git a/src/PythonPlot.jl b/src/PythonPlot.jl index 968eecf..a1148cc 100755 --- a/src/PythonPlot.jl +++ b/src/PythonPlot.jl @@ -36,7 +36,7 @@ function Base.show(io::IO, ::MIME"text/plain", h::LazyHelp) for k in h.keys o = pygetattr(o, k) end - if hasproperty(o, :__doc__) + if pyhasattr(o, "__doc__") print(io, pyconvert(String, o.__doc__)) else print(io, "no Python docstring found for ", o) @@ -76,7 +76,7 @@ Base.getproperty(f::Figure, s::Symbol) = getproperty(Py(f), s) Base.getproperty(f::Figure, s::AbstractString) = getproperty(f, Symbol(s)) Base.setproperty!(f::Figure, s::Symbol, x) = setproperty!(Py(f), s, x) Base.setproperty!(f::Figure, s::AbstractString, x) = setproperty!(f, Symbol(s), x) -Base.hasproperty(f::Figure, s::Symbol) = hasproperty(Py(f), s) +Base.hasproperty(f::Figure, s::Symbol) = pyhasattr(Py(f), s) Base.propertynames(f::Figure) = propertynames(Py(f)) for (mime,fmt) in aggformats @@ -175,10 +175,10 @@ const plt_funcs = (:acorr,:annotate,:arrow,:autoscale,:autumn,:axes,:axhline,:ax for f in plt_funcs sf = string(f) @eval @doc LazyHelp(pyplot,$sf) function $f(args...; kws...) - if !hasproperty(pyplot, $(QuoteNode(f))) + if !pyhasattr(pyplot, $sf) error("matplotlib ", version, " does not have pyplot.", $sf) end - return pycall(pyplot.$f, args...; kws...) + return pycall(pyplot.$sf, args...; kws...) end end diff --git a/src/colormaps.jl b/src/colormaps.jl index 39f9d90..bc430ec 100644 --- a/src/colormaps.jl +++ b/src/colormaps.jl @@ -26,7 +26,7 @@ Base.getproperty(c::ColorMap, s::AbstractString) = getproperty(Py(c), Symbol(s)) Base.setproperty!(c::ColorMap, s::Symbol, x) = setproperty!(Py(c), s, x) Base.setproperty!(c::ColorMap, s::AbstractString, x) = setproperty!(Py(c), Symbol(s), x) Base.propertynames(c::ColorMap) = propertynames(Py(c)) -Base.hasproperty(c::ColorMap, s::Union{Symbol,AbstractString}) = hasproperty(Py(c), s) +Base.hasproperty(c::ColorMap, s::Union{Symbol,AbstractString}) = pyhasattr(Py(c), s) function Base.show(io::IO, c::ColorMap) print(io, "ColorMap \"$(pyconvert(String, c.name))\"") diff --git a/src/plot3d.jl b/src/plot3d.jl index 90adc3b..635a8aa 100644 --- a/src/plot3d.jl +++ b/src/plot3d.jl @@ -12,7 +12,7 @@ PythonCall.Py(m::LazyPyModule) = _ispynull(getfield(m, :o)) ? PythonCall.pycopy! Base.Docs.doc(m::LazyPyModule) = Base.Docs.Text(pyconvert(String, Py(m).__doc__)) Base.getproperty(m::LazyPyModule, x::Symbol) = getproperty(Py(m), x) Base.setproperty!(m::LazyPyModule, x::Symbol, v) = setproperty!(Py(m), x, v) -Base.hasproperty(m::LazyPyModule, x::Symbol) = PyCall.hasproperty(Py(m), x) +Base.hasproperty(m::LazyPyModule, x::Symbol) = pyhasattr(Py(m), x) Base.propertynames(m::LazyPyModule) = propertynames(Py(m)) ###########################################################################