From 404fca1e5a1a791b0258a3c0f790c1cf84c5a029 Mon Sep 17 00:00:00 2001 From: Lilith Orion Hafner Date: Sat, 24 Feb 2024 21:39:00 -0600 Subject: [PATCH] Remove unused IdxMap type parameter from ShapedAxis (#244) --- src/axis.jl | 11 +++++------ src/show.jl | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/axis.jl b/src/axis.jl index 3c5de224..b3927966 100644 --- a/src/axis.jl +++ b/src/axis.jl @@ -59,14 +59,13 @@ const NullorFlatAxis = Union{NullAxis, FlatAxis} """ - sa = ShapedAxis(shape, index_map) + sa = ShapedAxis(shape) Preserves higher-dimensional array components in `ComponentArray`s (matrix components, for example) """ -struct ShapedAxis{Shape, IdxMap} <: AbstractAxis{IdxMap} end -@inline ShapedAxis(Shape, IdxMap) = ShapedAxis{Shape, IdxMap}() -ShapedAxis(Shape) = ShapedAxis(Shape, NamedTuple()) +struct ShapedAxis{Shape} <: AbstractAxis{nothing} end +@inline ShapedAxis(Shape) = ShapedAxis{Shape}() ShapedAxis(::Tuple{<:Int}) = FlatAxis() const Shape = ShapedAxis @@ -74,7 +73,7 @@ const Shape = ShapedAxis unshape(ax) = ax unshape(ax::ShapedAxis) = Axis(indexmap(ax)) -Base.size(::ShapedAxis{Shape, IdxMap}) where {Shape, IdxMap} = Shape +Base.size(::ShapedAxis{Shape}) where {Shape} = Shape @@ -135,7 +134,7 @@ Axis(::NamedTuple{()}) = FlatAxis() Axis(x) = FlatAxis() const NotShapedAxis = Union{Axis{IdxMap}, FlatAxis, NullAxis} where {IdxMap} -const NotPartitionedAxis = Union{Axis{IdxMap}, FlatAxis, NullAxis, ShapedAxis{Shape, IdxMap}} where {Shape, IdxMap} +const NotPartitionedAxis = Union{Axis{IdxMap}, FlatAxis, NullAxis, ShapedAxis{Shape}} where {Shape, IdxMap} const NotShapedOrPartitionedAxis = Union{Axis{IdxMap}, FlatAxis, NullAxis} where {IdxMap} diff --git a/src/show.jl b/src/show.jl index 2a08a47f..dbe03cf6 100644 --- a/src/show.jl +++ b/src/show.jl @@ -12,14 +12,14 @@ Base.show(io::IO, ::MIME"text/plain", ::PartitionedAxis{PartSz, IdxMap, Ax}) whe Base.show(io::IO, ::PartitionedAxis{PartSz, IdxMap, Ax}) where {PartSz, IdxMap, Ax} = print(io, "PartitionedAxis($PartSz, $(Ax()))") -Base.show(io::IO, ::ShapedAxis{Shape, IdxMap}) where {Shape, IdxMap} = - print(io, "ShapedAxis($Shape, $IdxMap)") +Base.show(io::IO, ::ShapedAxis{Shape}) where {Shape} = + print(io, "ShapedAxis($Shape)") -Base.show(io::IO, ::MIME"text/plain", ::ViewAxis{Inds, IdxMap, Ax}) where {Inds, IdxMap, Ax} = +Base.show(io::IO, ::MIME"text/plain", ::ViewAxis{Inds, IdxMap, Ax}) where {Inds, IdxMap, Ax} = print(io, "ViewAxis($Inds, $(Ax()))") -Base.show(io::IO, ::ViewAxis{Inds, IdxMap, <:Ax}) where {Inds, IdxMap, Ax} = +Base.show(io::IO, ::ViewAxis{Inds, IdxMap, <:Ax}) where {Inds, IdxMap, Ax} = print(io, "ViewAxis($Inds, $(Ax()))") -Base.show(io::IO, ::ViewAxis{Inds, IdxMap, <:NullorFlatAxis}) where {Inds, IdxMap} = +Base.show(io::IO, ::ViewAxis{Inds, IdxMap, <:NullorFlatAxis}) where {Inds, IdxMap} = print(io, Inds) Base.show(io::IO, ci::ComponentIndex) = print(io, "ComponentIndex($(ci.idx), $(ci.ax))")