Skip to content

Commit

Permalink
define isequal since it differs from == for Py objects, don't bother …
Browse files Browse the repository at this point in the history
…defining mixed-type comparisons to Py
  • Loading branch information
stevengj committed Apr 13, 2022
1 parent a560654 commit c5e299b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/PythonPlot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
5 changes: 2 additions & 3 deletions src/colormaps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit c5e299b

Please sign in to comment.