Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] committed Aug 24, 2017
1 parent ebf9872 commit bca324d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ convert(::Type{CategoricalArray{T, N}}, A::CategoricalArray{T, N}) where {T, N}
convert(::Type{CategoricalArray{T}}, A::CategoricalArray{T}) where {T} = A
convert(::Type{CategoricalArray}, A::CategoricalArray) = A

function @compat(Base.:(==))(A::CategoricalArray, B::CategoricalArray)
function Base.:(==)(A::CategoricalArray, B::CategoricalArray)
if size(A) != size(B)
return false
end
Expand Down
6 changes: 3 additions & 3 deletions src/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ function CategoricalPool(index::Vector{S},
CategoricalPool{S, R, CategoricalValue{S, R}}(index, invindex, order, ordered)
end

@compat (::Type{CategoricalPool{T, R}})(ordered::Bool=false) where {T, R} =
(::Type{CategoricalPool{T, R}})(ordered::Bool=false) where {T, R} =
CategoricalPool(T[], Dict{T, R}(), R[], ordered)
@compat (::Type{CategoricalPool{T}})(ordered::Bool=false) where {T} =
(::Type{CategoricalPool{T}})(ordered::Bool=false) where {T} =
CategoricalPool(T[], Dict{T, DefaultRefType}(), DefaultRefType[], ordered)

@compat function (::Type{CategoricalPool{T, R}})(index::Vector,
function (::Type{CategoricalPool{T, R}})(index::Vector,
ordered::Bool=false) where {T, R}
invindex = buildinvindex(index, R)
order = Vector{R}(1:length(index))
Expand Down
2 changes: 1 addition & 1 deletion src/typedefs.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Nulls

@compat const DefaultRefType = UInt32
const DefaultRefType = UInt32

## Pools

Expand Down
10 changes: 5 additions & 5 deletions src/value.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Base.convert(::Type{S}, x::CategoricalValue) where {S} = convert(S, index(x.pool
Base.convert(::Type{Union{S, Null}}, x::CategoricalValue) where {S} = convert(S, index(x.pool)[x.level])

function Base.show(io::IO, x::CategoricalValue{T}) where {T}
if @compat(get(io, :compact, false))
if get(io, :compact, false)
print(io, repr(index(x.pool)[x.level]))
elseif isordered(x.pool)
@printf(io, "%s %s (%i/%i)",
Expand All @@ -51,11 +51,11 @@ end
end

# To fix ambiguities with Base
@compat Base.:(==)(x::CategoricalValue, y::WeakRef) = index(x.pool)[x.level] == y
@compat Base.:(==)(x::WeakRef, y::CategoricalValue) = y == x
Base.:(==)(x::CategoricalValue, y::WeakRef) = index(x.pool)[x.level] == y
Base.:(==)(x::WeakRef, y::CategoricalValue) = y == x

@compat Base.:(==)(x::CategoricalValue, y::Any) = index(x.pool)[x.level] == y
@compat Base.:(==)(x::Any, y::CategoricalValue) = y == x
Base.:(==)(x::CategoricalValue, y::Any) = index(x.pool)[x.level] == y
Base.:(==)(x::Any, y::CategoricalValue) = y == x

@inline function Base.isequal(x::CategoricalValue, y::CategoricalValue)
if x.pool === y.pool
Expand Down

0 comments on commit bca324d

Please sign in to comment.