Skip to content

Commit 2e8f4d3

Browse files
committed
Fix format
1 parent 0044bc3 commit 2e8f4d3

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

src/comparison.jl

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,31 @@ struct ExponentsIterator{M,D<:Union{Nothing,Int},O}
387387
inline::Bool
388388
end
389389

390-
function ExponentsIterator{M}(object; mindegree::Int = 0, maxdegree::Union{Nothing,Int} = nothing, inline::Bool = false) where {M}
391-
ExponentsIterator{M,typeof(maxdegree),typeof(object)}(object, mindegree, maxdegree, inline)
390+
function ExponentsIterator{M}(
391+
object;
392+
mindegree::Int = 0,
393+
maxdegree::Union{Nothing,Int} = nothing,
394+
inline::Bool = false,
395+
) where {M}
396+
return ExponentsIterator{M,typeof(maxdegree),typeof(object)}(
397+
object,
398+
mindegree,
399+
maxdegree,
400+
inline,
401+
)
392402
end
393403

394404
function ExponentsIterator(args...; kws...)
395405
return ExponentsIterator{Graded{LexOrder}}(args...; kws...)
396406
end
397407

398408
Base.eltype(::Type{ExponentsIterator{M,D,O}}) where {M,D,O} = O
399-
Base.IteratorSize(::Type{<:ExponentsIterator{M,Nothing}}) where {M} = Base.IsInfinite()
400-
Base.IteratorSize(::Type{<:ExponentsIterator{M,Int}}) where {M} = Base.HasLength()
409+
function Base.IteratorSize(::Type{<:ExponentsIterator{M,Nothing}}) where {M}
410+
return Base.IsInfinite()
411+
end
412+
function Base.IteratorSize(::Type{<:ExponentsIterator{M,Int}}) where {M}
413+
return Base.HasLength()
414+
end
401415

402416
function Base.length(it::ExponentsIterator{M,Int}) where {M}
403417
len = binomial(nvariables(it) + it.maxdegree, nvariables(it))
@@ -412,7 +426,9 @@ nvariables(it::ExponentsIterator) = length(it.object)
412426
_increase_degree(it::ExponentsIterator{<:Graded,Nothing}, _) = false
413427
_increase_degree(it::ExponentsIterator{<:Graded,Int}, _) = false
414428
_increase_degree(it::ExponentsIterator{M,Nothing}, _) where {M} = true
415-
_increase_degree(it::ExponentsIterator{M,Int}, deg) where {M} = deg < it.maxdegree
429+
function _increase_degree(it::ExponentsIterator{M,Int}, deg) where {M}
430+
return deg < it.maxdegree
431+
end
416432

417433
# We just changed the degree by removing `Δ`,
418434
# In graded ordering, we just add `Δ` to maintain the same degree

test/exponents_iterator.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ end
1919
function test_all()
2020
@testset "nvariables = $nvars" for nvars in 0:3
2121
@testset "mindegree = $mindegree" for mindegree in 0:3
22-
@testset "maxdegree = $maxdegree" for maxdegree in vcat(nothing; 0:3)
22+
@testset "maxdegree = $maxdegree" for maxdegree in
23+
vcat(nothing; 0:3)
2324
for L in [LexOrder, InverseLexOrder]
24-
@testset "M = $M" for M in [
25-
L, Graded{L},
26-
]
25+
@testset "M = $M" for M in [L, Graded{L}]
2726
_test(nvars, M; mindegree, maxdegree)
2827
end
2928
end

0 commit comments

Comments
 (0)