From c5e299be69e60d33f2a3b4fcd7daf461860aea52 Mon Sep 17 00:00:00 2001 From: "Steven G. Johnson" Date: Wed, 13 Apr 2022 14:34:00 -0400 Subject: [PATCH] define isequal since it differs from == for Py objects, don't bother defining mixed-type comparisons to Py --- src/PythonPlot.jl | 3 +-- src/colormaps.jl | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/PythonPlot.jl b/src/PythonPlot.jl index 16925b5..da857e1 100755 --- a/src/PythonPlot.jl +++ b/src/PythonPlot.jl @@ -65,8 +65,7 @@ end PythonCall.Py(f::Figure) = getfield(f, :o) PythonCall.pyconvert(::Type{Figure}, o::Py) = Figure(o) Base.:(==)(f::Figure, g::Figure) = pyconvert(Bool, Py(f) == Py(g)) -Base.:(==)(f::Figure, g::Py) = pyconvert(Bool, Py(f) == g) -Base.:(==)(f::Py, g::Figure) = pyconvert(Bool, f == Py(g)) +Base.isequal(f::Figure, g::Figure) = isequal(Py(f), Py(g)) Base.hash(f::Figure, h::UInt) = hash(Py(f), h) PythonCall.pycall(f::Figure, args...; kws...) = pycall(Py(f), args...; kws...) (f::Figure)(args...; kws...) = pycall(Py(f), PyAny, args...; kws...) diff --git a/src/colormaps.jl b/src/colormaps.jl index 20c2e7b..39f9d90 100644 --- a/src/colormaps.jl +++ b/src/colormaps.jl @@ -13,9 +13,8 @@ end PythonCall.Py(c::ColorMap) = getfield(c, :o) PythonCall.pyconvert(::Type{ColorMap}, o::Py) = ColorMap(o) -Base.:(==)(c::ColorMap, g::ColorMap) = Py(c) == Py(g) -Base.:(==)(c::Py, g::ColorMap) = c == Py(g) -Base.:(==)(c::ColorMap, g::Py) = Py(c) == g +Base.:(==)(c::ColorMap, g::ColorMap) = pyconvert(Bool, Py(c) == Py(g)) +Base.isequal(c::ColorMap, g::ColorMap) = isequal(Py(c), Py(g)) Base.hash(c::ColorMap, h::UInt) = hash(Py(c), h) PythonCall.pycall(c::ColorMap, args...; kws...) = pycall(Py(c), args...; kws...) (c::ColorMap)(args...; kws...) = pycall(Py(c), args...; kws...)