Skip to content

Commit

Permalink
Remove dependency on Compat.jl (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
nalimilan committed Dec 21, 2019
1 parent d7d1441 commit 3213fc4
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 60 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
version = "0.7.4"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Future = "9fa8497b-333b-5362-9e8d-4d0656e87820"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Missings = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[compat]
Compat = "1.0, 2.0, 3.0"
DataAPI = "1.1"
JSON = "0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21"
Missings = "0.4.3"
julia = "1"

[extras]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Dates", "Test"]
1 change: 0 additions & 1 deletion src/CategoricalArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module CategoricalArrays
export categorical, compress, decompress, droplevels!, levels, levels!, isordered, ordered!
export cut, recode, recode!

using Compat
using JSON
using DataAPI
using Missings
Expand Down
3 changes: 1 addition & 2 deletions src/array.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
## Code for CategoricalArray

import Base: Array, convert, collect, copy, getindex, setindex!, similar, size,
unique, vcat, in, summary, float, complex
import Compat: copyto!
unique, vcat, in, summary, float, complex, copyto!

# Used for keyword argument default value
_isordered(x::AbstractCategoricalArray) = isordered(x)
Expand Down
2 changes: 1 addition & 1 deletion src/extras.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Compat.Statistics
using Statistics

function fill_refs!(refs::AbstractArray, X::AbstractArray,
breaks::AbstractVector, extend::Bool, allow_missing::Bool)
Expand Down
4 changes: 2 additions & 2 deletions src/pool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function mergelevels(ordered, levels...)
T = Base.promote_eltype(levels...)
res = Vector{T}(undef, 0)

nonempty_lv = Compat.findfirst(!isempty, levels)
nonempty_lv = findfirst(!isempty, levels)
if nonempty_lv === nothing
# no levels
return res, ordered
Expand Down Expand Up @@ -161,7 +161,7 @@ function mergelevels(ordered, levels...)

# Check that result is ordered
if ordered
levelsmaps = [Compat.indexin(res, l) for l in levels]
levelsmaps = [indexin(res, l) for l in levels]

# Check that each original order is preserved
for m in levelsmaps
Expand Down
3 changes: 1 addition & 2 deletions test/01_typedef.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestTypeDef
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType, level, reftype, leveltype

Expand Down
3 changes: 1 addition & 2 deletions test/02_buildorder.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestUpdateOrder
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType

Expand Down
3 changes: 1 addition & 2 deletions test/03_buildfields.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestBuildFields
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType

Expand Down
3 changes: 1 addition & 2 deletions test/04_constructors.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestConstructors
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType

Expand Down
3 changes: 1 addition & 2 deletions test/05_convert.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestConvert
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType, level, reftype, leveltype

Expand Down
3 changes: 1 addition & 2 deletions test/06_length.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestLength
using Compat
using Compat.Test
using Test
using CategoricalArrays

@testset "length(pool)" begin
Expand Down
5 changes: 2 additions & 3 deletions test/06_show.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module TestShow
using Compat
using Compat.Test
using Compat.Dates
using Test
using Dates
using CategoricalArrays

@testset "show() for CategoricalPool{String} and its values" begin
Expand Down
3 changes: 1 addition & 2 deletions test/07_levels.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestLevels
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType, levels!

Expand Down
3 changes: 1 addition & 2 deletions test/08_equality.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestEquality
using Compat
using Compat.Test
using Test
using CategoricalArrays

@testset "== and isequal() for CategoricalPool{Int} and CategoricalPool{Float64}" begin
Expand Down
21 changes: 10 additions & 11 deletions test/08_string.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module TestString
using Compat
using Compat.Test
using Compat.Unicode
using Test
using Unicode
using CategoricalArrays

@testset "AbstractString operations on values of CategoricalPool{String}" begin
Expand Down Expand Up @@ -129,15 +128,15 @@ using CategoricalArrays
@test rpad(v2, 1) == "café"
@test rpad(v2, 5) == "café "

@test Compat.findfirst("", v1) === 1:0
@test Compat.findfirst("a", v2) === 2:2
@test Compat.findfirst(==('a'), v2) === 2
@test Compat.findnext(==('a'), v2, 3) === nothing
@test findfirst("", v1) === 1:0
@test findfirst("a", v2) === 2:2
@test findfirst(==('a'), v2) === 2
@test findnext(==('a'), v2, 3) === nothing

@test Compat.findlast("a", v1) === nothing
@test Compat.findlast("a", v2) === 2:2
@test Compat.findlast(==('a'), v2) === 2
@test Compat.findprev(==('a'), v2, 1) === nothing
@test findlast("a", v1) === nothing
@test findlast("a", v2) === 2:2
@test findlast(==('a'), v2) === 2
@test findprev(==('a'), v2, 1) === nothing

@test !occursin("a", v1)
@test occursin("", v1)
Expand Down
3 changes: 1 addition & 2 deletions test/09_hash.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestHash
using Compat
using Compat.Test
using Test
using CategoricalArrays

@testset "hash() for CategoricalPool{Int} and CategoricalPool{Float64} and its values" begin
Expand Down
3 changes: 1 addition & 2 deletions test/10_isless.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestIsLess
using Compat
using Compat.Test
using Test
using CategoricalArrays

pool = CategoricalPool([1, 2, 3])
Expand Down
3 changes: 1 addition & 2 deletions test/11_array.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestArray
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType, leveltype

Expand Down
3 changes: 1 addition & 2 deletions test/12_missingarray.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestMissingArray
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType, leveltype
using Missings
Expand Down
7 changes: 2 additions & 5 deletions test/13_arraycommon.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module TestArrayCommon
using Compat
using Compat.Test
@static if VERSION >= v"0.7.0-DEV.3208"
using Future: copy!
end
using Test
using Future: copy!
using CategoricalArrays, DataAPI
using CategoricalArrays: DefaultRefType, index

Expand Down
3 changes: 1 addition & 2 deletions test/14_view.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestView
using Compat
using Compat.Test
using Test
using CategoricalArrays

const = isequal
Expand Down
3 changes: 1 addition & 2 deletions test/15_extras.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestExtras
using Compat
using Compat.Test
using Test
using CategoricalArrays

const = isequal
Expand Down
3 changes: 1 addition & 2 deletions test/16_recode.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module TestRecode
using Compat
using Compat.Test
using Test
using CategoricalArrays
using CategoricalArrays: DefaultRefType

Expand Down
3 changes: 1 addition & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module TestCategoricalArrays
quiet = length(ARGS) > 0 && ARGS[1] == "-q"
anyerrors = false

using Compat
using Compat.Test
using Test
using CategoricalArrays

tests = [
Expand Down

0 comments on commit 3213fc4

Please sign in to comment.