From 0ac2eb057b1644db26c2fa612bae46359395f686 Mon Sep 17 00:00:00 2001 From: Brendan Harris Date: Thu, 7 Mar 2024 16:16:54 +1100 Subject: [PATCH] Fix whitespace --- src/array/methods.jl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/array/methods.jl b/src/array/methods.jl index 50af61962..e5ca00349 100644 --- a/src/array/methods.jl +++ b/src/array/methods.jl @@ -109,7 +109,7 @@ end ds = DD.dims(A, _astuple(dims)) # Run one slice with dimensions to get the transformed dim d_inds = map(d -> rebuild(d, 1), otherdims(A, ds)) - example_dims = DD.dims(f(view(A, d_inds...))) + example_dims = length(d_inds) > 0 ? DD.dims(f(view(A, d_inds...))) : () replacement_dims = if isnothing(example_dims) || length(example_dims) != length(ds) map(d -> rebuild(d, NoLookup()), ds) else @@ -390,8 +390,8 @@ end check_cat_lookups(dims::Dimension...) = _check_cat_lookups(basetypeof(first(dims)), lookup(dims)...) -# LookupArrays may need adjustment for `cat` -_check_cat_lookups(D, lookups::LookupArray...) = _check_cat_lookup_order(D, lookups...) +# Lookups may need adjustment for `cat` +_check_cat_lookups(D, lookups::Lookup...) = _check_cat_lookup_order(D, lookups...) _check_cat_lookups(D, l1::NoLookup, lookups::NoLookup...) = true function _check_cat_lookups(D, l1::AbstractSampled, lookups::AbstractSampled...) length(lookups) > 0 || return true @@ -430,7 +430,7 @@ function _check_cat_lookups(D, ::Irregular, lookups...) end |> all end -function _check_cat_lookup_order(D, lookups::LookupArray...) +function _check_cat_lookup_order(D, lookups::Lookup...) l1 = first(lookups) length(l1) == 0 && return _check_cat_lookup_order(D, Base.tail(lookups)...) L = basetypeof(l1) @@ -481,8 +481,8 @@ function _vcat_dims(d1::Dimension, ds::Dimension...) return rebuild(d1, newlookup) end -# LookupArrays may need adjustment for `cat` -function _vcat_lookups(lookups::LookupArray...) +# Lookups may need adjustment for `cat` +function _vcat_lookups(lookups::Lookup...) newindex = _vcat_index(lookups...) return rebuild(lookups[1]; data=newindex) end @@ -520,10 +520,10 @@ end _vcat_index(A1::NoLookup, A::NoLookup...) = OneTo(mapreduce(length, +, (A1, A...))) # TODO: handle vcat OffsetArrays? # Otherwise just vcat. TODO: handle order breaking vcat? -# function _vcat_index(lookup::LookupArray, lookups...) +# function _vcat_index(lookup::Lookup, lookups...) # _vcat_index(span(lookup), lookup, lookups...) # end -function _vcat_index(lookup1::LookupArray, lookups::LookupArray...) +function _vcat_index(lookup1::Lookup, lookups::Lookup...) shifted = map((lookup1, lookups...)) do l parent(maybeshiftlocus(locus(lookup1), l)) end