Skip to content

Commit 84d1b81

Browse files
Merge pull request #158 from ArnoStrouwen/format
reapply formatter
2 parents d652e95 + 85ba4c8 commit 84d1b81

File tree

9 files changed

+56
-45
lines changed

9 files changed

+56
-45
lines changed

.JuliaFormatter.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
style = "sciml"
2-
format_markdown = true
2+
format_markdown = true
3+
format_docstrings = true

docs/make.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ cp("./docs/Project.toml", "./docs/src/assets/Project.toml", force = true)
66
include("pages.jl")
77

88
makedocs(sitename = "LabelledArrays.jl",
9-
authors = "Chris Rackauckas",
10-
modules = [LabelledArrays],
11-
clean = true, doctest = false, linkcheck = true,
12-
format = Documenter.HTML(assets = ["assets/favicon.ico"],
13-
canonical = "https://docs.sciml.ai/LabelledArrays/stable/"),
14-
pages = pages)
9+
authors = "Chris Rackauckas",
10+
modules = [LabelledArrays],
11+
clean = true, doctest = false, linkcheck = true,
12+
format = Documenter.HTML(assets = ["assets/favicon.ico"],
13+
canonical = "https://docs.sciml.ai/LabelledArrays/stable/"),
14+
pages = pages)
1515

1616
deploydocs(repo = "github.com/SciML/LabelledArrays.jl.git";
17-
push_preview = true)
17+
push_preview = true)

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ pages = [
66
"SLArrays" => "SLArrays.md",
77
"LArrays" => "LArrays.md",
88
"Relation to NamedTuples" => "NamedTuples_relation.md",
9-
"Note_labelled_slices.md",
9+
"Note_labelled_slices.md"
1010
]

docs/src/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ file and the
8686
[project]($link_project)
8787
file.
8888
""")
89-
```
89+
```

src/LabelledArrays.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ end
2929

3030
import Base: eltype, length, ndims, size, axes, eachindex, stride, strides
3131
MacroTools.@forward PrintWrapper.x eltype, length, ndims, size, axes, eachindex, stride,
32-
strides
32+
strides
3333
Base.getindex(A::PrintWrapper, idxs...) = A.f(A.x, A.x[idxs...], idxs)
3434

3535
function lazypair(A, x, idxs)
@@ -72,8 +72,8 @@ function ArrayInterface.undefmatrix(x::LArray{T, N, D, Syms}) where {T, N, D, Sy
7272
end
7373

7474
function PreallocationTools.get_tmp(dc::PreallocationTools.DiffCache,
75-
u::LArray{T, N, D, Syms}) where {T <: ForwardDiff.Dual,
76-
N, D, Syms}
75+
u::LArray{T, N, D, Syms}) where {T <: ForwardDiff.Dual,
76+
N, D, Syms}
7777
nelem = div(sizeof(T), sizeof(eltype(dc.dual_du))) * length(dc.du)
7878
if nelem > length(dc.dual_du)
7979
PreallocationTools.enlargedualcache!(dc, nelem)

src/larray.jl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Base.@propagate_inbounds function Base.getindex(x::LArray, s::AbstractArray{Symb
126126
end
127127

128128
function Base.similar(x::LArray{T, K, D, Syms}, ::Type{S},
129-
dims::NTuple{N, Int}) where {T, K, D, Syms, S, N}
129+
dims::NTuple{N, Int}) where {T, K, D, Syms, S, N}
130130
tmp = similar(x.__x, S, dims)
131131
LArray{S, N, typeof(tmp), Syms}(tmp)
132132
end
@@ -144,15 +144,15 @@ Base.convert(::Type{T}, x) where {T <: LArray} = T(x)
144144
Base.convert(::Type{T}, x::T) where {T <: LArray} = x
145145
Base.convert(::Type{<:Array}, x::LArray) = convert(Array, getfield(x, :__x))
146146
function Base.convert(::Type{AbstractArray{T, N}},
147-
x::LArray{S, N, <:Any, Syms}) where {T, S, N, Syms}
147+
x::LArray{S, N, <:Any, Syms}) where {T, S, N, Syms}
148148
LArray{Syms}(convert(AbstractArray{T, N}, getfield(x, :__x)))
149149
end
150150
Base.convert(::Type{AbstractArray{T, N}}, x::LArray{T, N}) where {T, N} = x
151151

152152
function ArrayInterface.restructure(x::LArray{T, N, D, Syms},
153-
y::LArray{T2, N2, D2, Syms}) where {T, N, D, T2, N2,
154-
D2,
155-
Syms}
153+
y::LArray{T2, N2, D2, Syms}) where {T, N, D, T2, N2,
154+
D2,
155+
Syms}
156156
reshape(y, size(x)...)
157157
end
158158

@@ -163,7 +163,7 @@ struct LAStyle{T, N, L} <: Broadcast.AbstractArrayStyle{N} end
163163
LAStyle{T, N, L}(x::Val{i}) where {T, N, L, i} = LAStyle{T, N, L}()
164164
Base.BroadcastStyle(::Type{LArray{T, N, D, L}}) where {T, N, D, L} = LAStyle{T, N, L}()
165165
function Base.BroadcastStyle(::LabelledArrays.LAStyle{T, N, L},
166-
::LabelledArrays.LAStyle{E, N, L}) where {T, E, N, L}
166+
::LabelledArrays.LAStyle{E, N, L}) where {T, E, N, L}
167167
LAStyle{promote_type(T, E), N, L}()
168168
end
169169

@@ -177,7 +177,7 @@ end
177177
end
178178
end
179179
function Base.similar(bc::Broadcast.Broadcasted{LAStyle{T, N, L}},
180-
::Type{ElType}) where {T, N, L, ElType}
180+
::Type{ElType}) where {T, N, L, ElType}
181181
tmp = similar(Array{ElType}, axes(bc))
182182
if axes(bc) != labels2axes(Val(L))
183183
return tmp
@@ -368,23 +368,25 @@ For example:
368368
B2 = SLArray(B; c=30 )
369369
"""
370370
function SLArray(v1::Union{SLArray{S, T, N, L, Syms}, LArray{T, N, D, Syms}};
371-
kwargs...) where {S, T, N, L, Syms, D}
371+
kwargs...) where {S, T, N, L, Syms, D}
372372
t2 = merge(convert(NamedTuple, v1), values(kwargs))
373373
SLArray{S}(t2)
374374
end
375375

376376
function Base.vcat(x::LArray, y::LArray)
377-
LArray{(LabelledArrays.symnames(typeof(x))..., LabelledArrays.symnames(typeof(y))...)}(vcat(x.__x,
378-
y.__x))
377+
LArray{(LabelledArrays.symnames(typeof(x))..., LabelledArrays.symnames(typeof(y))...)}(vcat(
378+
x.__x,
379+
y.__x))
379380
end
380381

381382
Base.elsize(::Type{<:LArray{T}}) where {T} = sizeof(T)
382383

383-
function RecursiveArrayTools.recursive_unitless_eltype(a::Type{LArray{T, N, D, Syms}}) where {
384-
T,
385-
N,
386-
D,
387-
Syms
388-
}
384+
function RecursiveArrayTools.recursive_unitless_eltype(a::Type{LArray{
385+
T, N, D, Syms}}) where {
386+
T,
387+
N,
388+
D,
389+
Syms
390+
}
389391
LArray{typeof(one(T)), N, D, Syms}
390392
end

src/slarray.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ end
2929
#####################################
3030
## SLArray to named tuple
3131
function Base.convert(::Type{NamedTuple},
32-
x::SLArray{S, T, N, L, Syms}) where {S, T, N, L, Syms}
32+
x::SLArray{S, T, N, L, Syms}) where {S, T, N, L, Syms}
3333
tup = NTuple{length(Syms), T}(x.__x)
3434
NamedTuple{Syms, typeof(tup)}(tup)
3535
end
3636
Base.keys(x::SLArray{S, T, N, L, Syms}) where {S, T, N, L, Syms} = Syms
3737

3838
function StaticArrays.similar_type(::Type{SLArray{S, T, N, L, Syms}}, T2,
39-
::Size{S}) where {S, T, N, L, Syms}
39+
::Size{S}) where {S, T, N, L, Syms}
4040
SLArray{S, T2, N, L, Syms}
4141
end
4242
function RecursiveArrayTools.recursive_unitless_eltype(a::Type{T}) where {T <: SLArray}
@@ -157,8 +157,8 @@ Base.@propagate_inbounds Base.getindex(x::SLArray, i::Int) = getfield(x, :__x)[i
157157
@inline Base.Tuple(x::SLArray) = Tuple(x.__x)
158158

159159
function StaticArrays.similar_type(::Type{SLArray{S, T, N, L, Syms}}, ::Type{NewElType},
160-
::Size{NewSize}) where {S, T, N, L, Syms, NewElType,
161-
NewSize}
160+
::Size{NewSize}) where {S, T, N, L, Syms, NewElType,
161+
NewSize}
162162
n = prod(NewSize)
163163
if n == L
164164
SLArray{Tuple{NewSize...}, NewElType, length(NewSize), L, Syms}
@@ -168,7 +168,7 @@ function StaticArrays.similar_type(::Type{SLArray{S, T, N, L, Syms}}, ::Type{New
168168
end
169169

170170
function Base.similar(::Type{SLArray{S, T, N, L, Syms}}, ::Type{NewElType},
171-
::Size{NewSize}) where {S, T, N, L, Syms, NewElType, NewSize}
171+
::Size{NewSize}) where {S, T, N, L, Syms, NewElType, NewSize}
172172
n = prod(NewSize)
173173
if n == L
174174
tmp = Array{NewElType}(undef, NewSize)
@@ -188,9 +188,9 @@ Base.@propagate_inbounds function Base.getindex(x::SLArray, s::Symbol)
188188
end
189189
Base.@propagate_inbounds Base.getindex(x::SLArray, s::Val) = __getindex(x, s)
190190
Base.@propagate_inbounds function Base.getindex(x::SLArray,
191-
inds::AbstractArray{I, 1}) where {
192-
I <:
193-
Integer}
191+
inds::AbstractArray{I, 1}) where {
192+
I <:
193+
Integer}
194194
getindex(x.__x, inds)
195195
end
196196
Base.@propagate_inbounds function Base.getindex(x::SLArray, inds::StaticVector{<:Any, Int})
@@ -203,7 +203,7 @@ Base.@propagate_inbounds function Base.getindex(x::SLArray, s::AbstractArray{Sym
203203
end
204204

205205
function Base.vcat(x1::SLArray{S1, T, 1, L1, Syms1},
206-
x2::SLArray{S2, T, 1, L2, Syms2}) where {S1, S2, T, L1, L2, Syms1, Syms2}
206+
x2::SLArray{S2, T, 1, L2, Syms2}) where {S1, S2, T, L1, L2, Syms1, Syms2}
207207
__x = vcat(x1.__x, x2.__x)
208208
SLArray{StaticArrays.size_tuple(Size(__x)), (Syms1..., Syms2...)}(__x)
209209
end
@@ -335,7 +335,7 @@ function Base.:\(A::StaticArrays.LU, b::SLArray{S, T, N, L, Syms}) where {S, T,
335335
end
336336

337337
function Base.reshape(x::SLArray{S, T, N, L, Syms},
338-
ax::Tuple{SOneTo, Vararg{SOneTo}}) where {S <: Tuple, T, N, L, Syms,
339-
SOneTo <: SOneTo}
338+
ax::Tuple{SOneTo, Vararg{SOneTo}}) where {S <: Tuple, T, N, L, Syms,
339+
SOneTo <: SOneTo}
340340
SLArray{S, T, N, L, Syms}(reshape(x.__x, ax))
341341
end

test/larrays.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ using LabelledArrays, Test, InteractiveUtils
8080
@test_throws ErrorException x.z
8181

8282
# Ref #93, #154
83-
@test_broken @LVector [1, 2, 3] (:a, :b, :c)
83+
@test_broken @LVector [1, 2, 3] (:a, :b, :c)
8484
end
8585

8686
@testset "Alternate array backends" begin

test/runtests.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ using InteractiveUtils
55
using ChainRulesTestUtils
66

77
@time begin
8-
@time @testset "SLArrays" begin include("slarrays.jl") end
9-
@time @testset "LArrays" begin include("larrays.jl") end
10-
@time @testset "DiffEq" begin include("diffeq.jl") end
11-
@time @testset "ChainRules" begin include("chainrules.jl") end
8+
@time @testset "SLArrays" begin
9+
include("slarrays.jl")
10+
end
11+
@time @testset "LArrays" begin
12+
include("larrays.jl")
13+
end
14+
@time @testset "DiffEq" begin
15+
include("diffeq.jl")
16+
end
17+
@time @testset "ChainRules" begin
18+
include("chainrules.jl")
19+
end
1220
end

0 commit comments

Comments
 (0)