Skip to content

Commit

Permalink
Remove Julia 0.5 VERSION checks
Browse files Browse the repository at this point in the history
We require Julia 0.5 now.
  • Loading branch information
nalimilan committed Feb 12, 2017
1 parent b6228e8 commit e4d4a9f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 70 deletions.
18 changes: 0 additions & 18 deletions src/CategoricalArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,4 @@ module CategoricalArrays
include("extras.jl")

include("deprecated.jl")

if VERSION < v"0.5.0-dev"
Base.convert{T,n,S}(::Type{Array{T}}, x::AbstractArray{S, n}) = convert(Array{T, n}, x)
Base.convert{T,n,S}(::Type{Array{T,n}}, x::AbstractArray{S,n}) = copy!(Array{T}(size(x)), x)

Base.convert{T}(::Type{Nullable }, x::T) = Nullable{T}(x)

Base.promote_op{S<:CategoricalValue, T<:CategoricalValue}(::typeof(@functorize(==)),
::Type{S}, ::Type{T}) = Bool
Base.promote_op{S<:CategoricalValue, T<:CategoricalValue}(::typeof(@functorize(>)),
::Type{S}, ::Type{T}) = Bool
Base.promote_op{S<:CategoricalValue, T<:CategoricalValue}(::typeof(@functorize(<)),
::Type{S}, ::Type{T}) = Bool
Base.promote_op{S<:CategoricalValue, T<:CategoricalValue}(::typeof(@functorize(>=)),
::Type{S}, ::Type{T}) = Bool
Base.promote_op{S<:CategoricalValue, T<:CategoricalValue}(::typeof(@functorize(<=)),
::Type{S}, ::Type{T}) = Bool
end
end
48 changes: 23 additions & 25 deletions src/nullablearray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,31 +81,29 @@ function NullableCategoricalArray{T, N}(A::AbstractArray{T, N},
res
end

if VERSION >= v"0.5.0-dev"
"""
NullableCategoricalVector(A::AbstractVector, missing::AbstractVector{Bool};
ordered::Bool=false)
Similar to definition above, but marks as null entries for which the corresponding entry
in `missing` is `true`.
"""
NullableCategoricalVector{T}(A::AbstractVector{T},
missing::AbstractVector{Bool};
ordered=false) =
NullableCategoricalArray(A, missing; ordered=ordered)

"""
NullableCategoricalMatrix(A::AbstractMatrix, missing::AbstractMatrix{Bool};
ordered::Bool=false)
Similar to definition above, but marks as null entries for which the corresponding entry
in `missing` is `true`.
"""
NullableCategoricalMatrix{T}(A::AbstractMatrix{T},
missing::AbstractMatrix{Bool};
ordered=false) =
NullableCategoricalArray(A, missing; ordered=ordered)
end
"""
NullableCategoricalVector(A::AbstractVector, missing::AbstractVector{Bool};
ordered::Bool=false)
Similar to definition above, but marks as null entries for which the corresponding entry
in `missing` is `true`.
"""
NullableCategoricalVector{T}(A::AbstractVector{T},
missing::AbstractVector{Bool};
ordered=false) =
NullableCategoricalArray(A, missing; ordered=ordered)

"""
NullableCategoricalMatrix(A::AbstractMatrix, missing::AbstractMatrix{Bool};
ordered::Bool=false)
Similar to definition above, but marks as null entries for which the corresponding entry
in `missing` is `true`.
"""
NullableCategoricalMatrix{T}(A::AbstractMatrix{T},
missing::AbstractMatrix{Bool};
ordered=false) =
NullableCategoricalArray(A, missing; ordered=ordered)

@inline function getindex(A::NullableCategoricalArray, I...)
@boundscheck checkbounds(A, I...)
Expand Down
5 changes: 0 additions & 5 deletions src/value.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ function Base.show{T}(io::IO, x::CategoricalValue{T})
end
end

if VERSION < v"0.5.0-dev+1936"
Base.showcompact{T}(io::IO, x::CategoricalValue{T}) =
print(io, repr(index(x.pool)[x.level]))
end

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

Expand Down
6 changes: 1 addition & 5 deletions test/11_array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -626,11 +626,7 @@ for ordered in (false, true)
@test levels(x) == []

x2 = compress(x)
if VERSION >= v"0.5.0-dev"
@test isa(x2, CategoricalArray{String, ndims(x), UInt8})
else
@test isa(x2, CategoricalArray{typeof(x).parameters[1], ndims(x), UInt8})
end
@test isa(x2, CategoricalArray{String, ndims(x), UInt8})
@test !isassigned(x2, 1) && isdefined(x2, 1)
@test !isassigned(x2, 2) && isdefined(x2, 2)
@test_throws UndefRefError x2[1]
Expand Down
28 changes: 11 additions & 17 deletions test/12_nullablearray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1005,18 +1005,16 @@ for ordered in (false, true)
@test isordered(x) == ordered
@test levels(x) == [2]

if VERSION >= v"0.5.0-dev"
x = NullableCategoricalVector(1:3, [true, false, true], ordered=ordered)
@test x == Nullable{Int}[Nullable(), 2, Nullable()]
@test isordered(x) === ordered
@test levels(x) == [2]

x = NullableCategoricalMatrix([1 2; 3 4], [true false; false true],
ordered=ordered)
@test x == Nullable{Int}[Nullable() 2; 3 Nullable()]
@test isordered(x) === ordered
@test levels(x) == [2, 3]
end
x = NullableCategoricalVector(1:3, [true, false, true], ordered=ordered)
@test x == Nullable{Int}[Nullable(), 2, Nullable()]
@test isordered(x) === ordered
@test levels(x) == [2]

x = NullableCategoricalMatrix([1 2; 3 4], [true false; false true],
ordered=ordered)
@test x == Nullable{Int}[Nullable() 2; 3 Nullable()]
@test isordered(x) === ordered
@test levels(x) == [2, 3]
end


Expand Down Expand Up @@ -1044,11 +1042,7 @@ for ordered in (false, true)

x2 = compress(x)
@test x2 == x
if VERSION >= v"0.5.0-dev"
@test isa(x2, NullableCategoricalArray{String, ndims(x), UInt8})
else
@test isa(x2, NullableCategoricalArray{typeof(x).parameters[1], ndims(x), UInt8})
end
@test isa(x2, NullableCategoricalArray{String, ndims(x), UInt8})
@test isordered(x2) === isordered(x)
@test levels(x2) == []

Expand Down

0 comments on commit e4d4a9f

Please sign in to comment.