Skip to content

Commit

Permalink
Remove Compat, as we are now requiring minimum julia-0.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidavdav committed Oct 27, 2016
1 parent e404b7d commit 1998501
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 14 deletions.
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
julia 0.4
Compat
Combinatorics
Combinatorics 0.3.2
DataStructures 0.4.4
3 changes: 1 addition & 2 deletions src/NamedArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
## This code is licensed under the MIT license
## See the file LICENSE.md in this distribution

VERSION >= v"0.4.0-dev+6521" && __precompile__()
__precompile__()

module NamedArrays

using Compat
using DataStructures

export NamedArray, NamedVector, NamedMatrix, Not
Expand Down
4 changes: 2 additions & 2 deletions src/arithmetic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ end
## Abstract \ Named
## ambiguity
\{Tx<:Number,Ty<:Number}(x::Diagonal{Tx}, y::NamedVector{Ty}) = x \ y.array
@compat \{Tx<:Number,Ty<:Number}(x::Union{Bidiagonal{Tx},LinAlg.AbstractTriangular{Tx}}, y::NamedVector{Ty}) = x \ y.array
@compat \{Tx<:Number,Ty<:Number}(x::Union{Bidiagonal{Tx},LinAlg.AbstractTriangular{Tx}}, y::NamedMatrix{Ty}) = NamedArray(x \ y.array, (defaultnamesdict(size(x,1)), y.dicts[2]), (:A, y.dimnames[2]))
\{Tx<:Number,Ty<:Number}(x::Union{Bidiagonal{Tx},LinAlg.AbstractTriangular{Tx}}, y::NamedVector{Ty}) = x \ y.array
\{Tx<:Number,Ty<:Number}(x::Union{Bidiagonal{Tx},LinAlg.AbstractTriangular{Tx}}, y::NamedMatrix{Ty}) = NamedArray(x \ y.array, (defaultnamesdict(size(x,1)), y.dicts[2]), (:A, y.dimnames[2]))
if VERSION >= v"0.4.0-dev"
\(x::Bidiagonal,y::NamedVector) = NamedArray(x \ y.array, ([string(i) for i in 1:size(x,2)], names(y,2)), (:A, y.dimnames[2]))
\(x::Bidiagonal,y::NamedMatrix) = NamedArray(x \ y.array, ([string(i) for i in 1:size(x,2)], names(y,2)), (:A, y.dimnames[2]))
Expand Down
2 changes: 1 addition & 1 deletion src/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ for the dimensions (`:A`, `:B`, ...) and indices (`"1"`, `"2"`, ...).
function NamedArray(T::DataType, dims::Int...)
ld = length(dims)
names = [[string(j) for j=1:i] for i=dims]
dimnames = [@compat Symbol(letter(i)) for i=1:ld]
dimnames = [Symbol(letter(i)) for i=1:ld]
a = Array(T, dims...)
NamedArray(a, tuple(names...), tuple(dimnames...))
end
Expand Down
4 changes: 2 additions & 2 deletions src/namedarraytypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ end

typealias NamedVector{T} NamedArray{T,1}
typealias NamedMatrix{T} NamedArray{T,2}
@compat typealias NamedVecOrMat{T} Union{NamedVector{T},NamedMatrix{T}}
@compat typealias ArrayOrNamed{T,N} Union{Array{T,N}, NamedArray{T,N,Array}}
typealias NamedVecOrMat{T} Union{NamedVector{T},NamedMatrix{T}}
typealias ArrayOrNamed{T,N} Union{Array{T,N}, NamedArray{T,N,Array}}

end
1 change: 0 additions & 1 deletion src/nomodule.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Compat
using DataStructures

include("compat.jl")
Expand Down
2 changes: 1 addition & 1 deletion test/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ setnames!(n, ["a", "b", "c", "d"], 2)

a = [1 2 3; 4 5 6]
n3 = NamedArray(a, (["a","b"],["C","D","E"]))
n4 = NamedArray(a, (@compat OrderedDict("a"=>1,"b"=>2), @compat OrderedDict("C"=>1,"D"=>2,"E"=>3)))
n4 = NamedArray(a, (OrderedDict("a"=>1,"b"=>2), OrderedDict("C"=>1,"D"=>2,"E"=>3)))

@test n3.array == n4.array == a
@test dimnames(n3) == dimnames(n4) == Any[:A,:B]
Expand Down
2 changes: 1 addition & 1 deletion test/keepnames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include("init-namedarrays.jl")

print("hcat/vcat, ")

letters = [string(@compat Char(96+i)) for i=1:26]
letters = [string(Char(96+i)) for i=1:26]

## vectors
## same names
Expand Down
1 change: 0 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
## See the file LICENSE.md in this distribution

using NamedArrays
using Compat
using Base.Test
using DataStructures

Expand Down
2 changes: 1 addition & 1 deletion test/test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ print("sum, ")
print("conversions, ")
## conversion
@test convert(Array, n) == n.array
@test @compat map(Float32, n).array == @compat map(Float32, n.array)
@test map(Float32, n).array == map(Float32, n.array)

print("changing names, ")
## changingnames
Expand Down

0 comments on commit 1998501

Please sign in to comment.