From d11d871afd3ad9aa5a7f27561f56771005480e9f Mon Sep 17 00:00:00 2001 From: Jeff Fessler Date: Sat, 26 Jun 2021 15:44:12 -0400 Subject: [PATCH 1/3] fix deprecations --- src/core.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core.jl b/src/core.jl index 190152a..9bace10 100644 --- a/src/core.jl +++ b/src/core.jl @@ -240,9 +240,9 @@ function AxisArray(A::AbstractArray{T,N}, names::NTuple{N,Symbol}, steps::NTuple end # Alternative constructor, takes names as keywords: -AxisArray(A; kw...) = AxisArray(A, nt_to_axes(kw.data)...) -@generated nt_to_axes(nt::NamedTuple) = - Expr(:tuple, (:(Axis{$(QuoteNode(n))}(getfield(nt, $(QuoteNode(n))))) for n in nt.names)...) +AxisArray(A; kw...) = AxisArray(A, nt_to_axes(values(kw))) +@generated nt_to_axes(nt::NamedTuple{names,T}) where {names,T} = + Expr(:tuple, (:(Axis{$(QuoteNode(n))}(getfield(nt, $(QuoteNode(n))))) for n in names)...) AxisArray(A::AxisArray) = A AxisArray(A::AxisArray, ax::Vararg{Axis, N}) where N = From 3b3d6200edca28ec2c578f83f888ef796a59bbd2 Mon Sep 17 00:00:00 2001 From: Jeff Fessler Date: Sun, 27 Jun 2021 21:03:57 -0400 Subject: [PATCH 2/3] rm T Co-authored-by: David Widmann --- src/core.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.jl b/src/core.jl index 9bace10..1cdf42a 100644 --- a/src/core.jl +++ b/src/core.jl @@ -241,7 +241,7 @@ end # Alternative constructor, takes names as keywords: AxisArray(A; kw...) = AxisArray(A, nt_to_axes(values(kw))) -@generated nt_to_axes(nt::NamedTuple{names,T}) where {names,T} = +@generated nt_to_axes(nt::NamedTuple{names}) where {names} = Expr(:tuple, (:(Axis{$(QuoteNode(n))}(getfield(nt, $(QuoteNode(n))))) for n in names)...) AxisArray(A::AxisArray) = A From b13994cdeff3832864c56bf789a1b34583d8507e Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Sun, 25 Jul 2021 09:58:13 +0800 Subject: [PATCH 3/3] more depwarn fixes --- src/indexing.jl | 6 +++--- test/intervals.jl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/indexing.jl b/src/indexing.jl index 4e4a482..b50e82d 100644 --- a/src/indexing.jl +++ b/src/indexing.jl @@ -160,11 +160,11 @@ end # Keyword indexing, reconstructs the Axis{}() objects @propagate_inbounds Base.view(A::AxisArray; kw...) = - view(A, kw_to_axes(parent(A), kw.data)...) + view(A, kw_to_axes(parent(A), values(kw))...) @propagate_inbounds Base.getindex(A::AxisArray; kw...) = - getindex(A, kw_to_axes(parent(A), kw.data)...) + getindex(A, kw_to_axes(parent(A), values(kw))...) @propagate_inbounds Base.setindex!(A::AxisArray, val; kw...) = - setindex!(A, val, kw_to_axes(parent(A), kw.data)...) + setindex!(A, val, kw_to_axes(parent(A), values(kw))...) function kw_to_axes(A::AbstractArray, nt::NamedTuple) length(nt) == 0 && throw(BoundsError(A, ())) # Trivial case A[] lands here diff --git a/test/intervals.jl b/test/intervals.jl index f3840fb..80464e3 100644 --- a/test/intervals.jl +++ b/test/intervals.jl @@ -27,8 +27,8 @@ v = [1 .. 2, 3.0 .. 4.0] @test 4 in 2.0 .. 6.0 @test 4 in 4.0 .. 4.0 @test 4 in 4.0 .. 5 -@test (1..2) in (0.5 .. 2.5) -@test !((1..2) in (1.5 .. 2.5)) +@test (1..2) ⊆ (0.5 .. 2.5) +@test !((1..2) ⊆ (1.5 .. 2.5)) @test maximum(1..2) === 2 @test minimum(1..2) === 1