Skip to content

Commit 33c76b9

Browse files
committed
properly qualify stack
1 parent 200dfc5 commit 33c76b9

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

src/functions.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ end
116116
@static if VERSION > v"1.9-DEV"
117117
# TODO: only supports dims=: for now
118118
function Base.stack(A::KeyedArray; dims::Colon=:)
119-
data = @invoke Base.stack(A::AbstractArray; dims)
119+
data = @invoke stack(A::AbstractArray; dims)
120120
if !allequal(named_axiskeys(a) for a in A)
121121
throw(DimensionMismatch("stack expects uniform axiskeys for all arrays"))
122122
end

src/stack.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
using LazyStack
2+
import LazyStack
33

44
# for stack_iter
55
LazyStack.no_wraps(a::KeyedArray) = LazyStack.no_wraps(NamedDims.unname(parent(a)))
@@ -23,14 +23,14 @@ stack_keys(xs::Tuple{Vararg{<:KeyedArray}}) =
2323

2424
# array of arrays: first strip off outer containers...
2525
function LazyStack.stack(xs::KeyedArray{<:AbstractArray})
26-
KeyedArray(stack(parent(xs)), stack_keys(xs))
26+
KeyedArray(LazyStack.stack(parent(xs)), stack_keys(xs))
2727
end
2828
function LazyStack.stack(xs::KeyedArray{<:AbstractArray,N,<:NamedDimsArray{L}}) where {L,N}
29-
data = stack(parent(parent(xs)))
29+
data = LazyStack.stack(parent(parent(xs)))
3030
KeyedArray(LazyStack.ensure_named(data, LazyStack.getnames(xs)), stack_keys(xs))
3131
end
3232
function LazyStack.stack(xs::NamedDimsArray{L,<:AbstractArray,N,<:KeyedArray}) where {L,N}
33-
data = stack(parent(parent(xs)))
33+
data = LazyStack.stack(parent(parent(xs)))
3434
LazyStack.ensure_named(KeyedArray(data, stack_keys(xs)), LazyStack.getnames(xs))
3535
end
3636

test/_functions.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ A3 = wrapdims(rand(Int8, 3,4,2), r='a':'c', c=2:5, p=[10.0, 20.0])
5353
KeyedArray([5, 6], a=[:x, :y]),
5454
], b=10:12)
5555

56-
sk = Base.stack(arr)::KeyedArray
56+
sk = stack(arr)::KeyedArray
5757
@test sk == [1 3 5; 2 4 6]
5858
@test named_axiskeys(sk) == (a=[:x, :y], b=10:12)
5959
end

test/_packages.jl

+10-10
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,25 @@ end
129129
end
130130
end
131131
@testset "stack" begin
132-
using LazyStack
132+
using LazyStack: stack as lstack
133133

134134
rin = [wrapdims(1:3, a='a':'c') for i=1:4]
135135

136-
@test axiskeys(stack(rin), :a) == 'a':'c'
137-
@test axiskeys(stack(:b, rin...), :a) == 'a':'c' # tuple
138-
@test axiskeys(stack(z for z in rin), :a) == 'a':'c' # generator
136+
@test axiskeys(lstack(rin), :a) == 'a':'c'
137+
@test axiskeys(lstack(:b, rin...), :a) == 'a':'c' # tuple
138+
@test axiskeys(lstack(z for z in rin), :a) == 'a':'c' # generator
139139

140140
rout = wrapdims([[1,2], [3,4]], b=10:11)
141-
@test axiskeys(stack(rout), :b) == 10:11
141+
@test axiskeys(lstack(rout), :b) == 10:11
142142

143143
rboth = wrapdims(rin, b=10:13)
144-
@test axiskeys(stack(rboth), :a) == 'a':'c'
145-
@test axiskeys(stack(rboth), :b) == 10:13
144+
@test axiskeys(lstack(rboth), :a) == 'a':'c'
145+
@test axiskeys(lstack(rboth), :b) == 10:13
146146

147147
nts = [(i=i, j="j", k=33) for i=1:3]
148-
@test axiskeys(stack(nts), 1) == [:i, :j, :k]
149-
@test axiskeys(stack(:z, nts...), 1) == [:i, :j, :k]
150-
@test axiskeys(stack(n for n in nts), 1) == [:i, :j, :k]
148+
@test axiskeys(lstack(nts), 1) == [:i, :j, :k]
149+
@test axiskeys(lstack(:z, nts...), 1) == [:i, :j, :k]
150+
@test axiskeys(lstack(n for n in nts), 1) == [:i, :j, :k]
151151

152152
end
153153
@testset "dates" begin

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Test, AxisKeys, NamedDims
2-
using Statistics, OffsetArrays, Tables, UniqueVectors, LazyStack
2+
using Statistics, OffsetArrays, Tables, UniqueVectors
33
using ChainRulesCore: ProjectTo, NoTangent
44
using ChainRulesTestUtils: test_rrule
55
using FiniteDifferences

0 commit comments

Comments
 (0)