Skip to content

Commit 9bb2cb9

Browse files
paldayararslangithub-actions[bot]
authored
Fix markdown show on 1.13 (#829)
* more stability in ordering * slightly nicer mime constructor call * don't define method on Julia 13 * update test * NEWS + version bump --------- Co-authored-by: Alex Arslan <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 823e137 commit 9bb2cb9

12 files changed

+25
-14
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
MixedModels v4.35.2 Release Notes
2+
==============================
3+
- Update to the `show(::IO, ::MIME, x)` methods for consistent ordering across Julia versions of variance components without associated fixed effects. This may result in change of ordering on existing Julia versions, but ordering will now match the ordering in the default REPL display (and reflect the model internal ordering), [#829]
4+
15
MixedModels v4.35.1 Release Notes
26
==============================
37
- The final parameter vector `optsum.final` is now reset in calls to `unfit!`. This has the secondary effect of correctly starting the fit for `prfit!` at the initial parameter vector instead of the final parameter vector of any previous optimization. [#828]
@@ -637,3 +641,4 @@ Package dependencies
637641
[#823]: https://github.com/JuliaStats/MixedModels.jl/issues/823
638642
[#825]: https://github.com/JuliaStats/MixedModels.jl/issues/825
639643
[#828]: https://github.com/JuliaStats/MixedModels.jl/issues/828
644+
[#829]: https://github.com/JuliaStats/MixedModels.jl/issues/829

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MixedModels"
22
uuid = "ff71e718-51f3-5ec2-a782-8ffcbfa3c316"
33
author = ["Phillip Alday <[email protected]>", "Douglas Bates <[email protected]>"]
4-
version = "4.35.1"
4+
version = "4.35.2"
55

66
[deps]
77
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"

src/blockdescription.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ function Base.show(io::IO, ::MIME"text/plain", b::BlockDescription)
5555
end
5656
end
5757

58-
Base.show(io::IO, b::BlockDescription) = show(io, MIME"text/plain"(), b)
58+
Base.show(io::IO, b::BlockDescription) = show(io, MIME("text/plain"), b)

src/generalizedlinearmixedmodel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ function Base.show(
763763
return show(io, coeftable(m))
764764
end
765765

766-
Base.show(io::IO, m::GeneralizedLinearMixedModel) = show(io, MIME"text/plain"(), m)
766+
Base.show(io::IO, m::GeneralizedLinearMixedModel) = show(io, MIME("text/plain"), m)
767767

768768
function stderror!(v::AbstractVector{T}, m::GeneralizedLinearMixedModel{T}) where {T}
769769
# initialize to appropriate NaN for rank-deficient case

src/likelihoodratiotest.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function Base.show(io::IO, ::MIME"text/plain", lrt::LikelihoodRatioTest)
230230
return nothing
231231
end
232232

233-
Base.show(io::IO, lrt::LikelihoodRatioTest) = Base.show(io, MIME"text/plain"(), lrt)
233+
Base.show(io::IO, lrt::LikelihoodRatioTest) = Base.show(io, MIME("text/plain"), lrt)
234234

235235
function _iscomparable(m::LinearMixedModel...)
236236
isconstant(getproperty.(getproperty.(m, :optsum), :REML)) || throw(

src/linearmixedmodel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ function Base.show(io::IO, ::MIME"text/plain", m::LinearMixedModel)
10841084
return show(io, coeftable(m))
10851085
end
10861086

1087-
Base.show(io::IO, m::LinearMixedModel) = Base.show(io, MIME"text/plain"(), m)
1087+
Base.show(io::IO, m::LinearMixedModel) = Base.show(io, MIME("text/plain"), m)
10881088

10891089
"""
10901090
_coord(A::AbstractMatrix)

src/mimeshow.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,11 @@ function _markdown(m::MixedModel)
148148
push!(rows, newrow)
149149
end
150150

151-
re_without_fe = setdiff(
152-
mapfoldl(x -> Set(getproperty(x, :cnames)), , m.reterms), coefnames(m)
151+
re_without_fe = setdiff!(
152+
# why not use `Set`? because ordering can change between releases, while
153+
# unique preserves the original order
154+
unique!(mapfoldl(x -> getproperty(x, :cnames), append!, m.reterms; init=String[])),
155+
coefnames(m),
153156
)
154157

155158
for bname in re_without_fe

src/pca.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function Base.propertynames(pca::PCA, private::Bool=false)
5656
)
5757
end
5858

59-
Base.show(io::IO, pca::PCA; kwargs...) = Base.show(io, MIME"text/plain"(), pca; kwargs...)
59+
Base.show(io::IO, pca::PCA; kwargs...) = Base.show(io, MIME("text/plain"), pca; kwargs...)
6060

6161
function Base.show(
6262
io::IO,

src/randomeffectsterm.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function RandomEffectsTerm(lhs::StatsModels.TermOrTerms, rhs::NTuple{2,AbstractT
1616
return (RandomEffectsTerm(lhs, rhs[1]), RandomEffectsTerm(lhs, rhs[2]))
1717
end
1818

19-
Base.show(io::IO, t::RandomEffectsTerm) = Base.show(io, MIME"text/plain"(), t)
19+
Base.show(io::IO, t::RandomEffectsTerm) = Base.show(io, MIME("text/plain"), t)
2020

2121
function Base.show(io::IO, ::MIME"text/plain", t::RandomEffectsTerm)
2222
return print(io, "($(t.lhs) | $(t.rhs))")
@@ -243,7 +243,7 @@ StatsModels.degree(t::ZeroCorr) = StatsModels.degree(t.term)
243243
# cf https://github.com/JuliaStats/StatsModels.jl/blob/41b025409af03c0e019591ac6e817b22efbb4e17/src/terms.jl#L421-L422
244244
StatsModels.degree(t::FunctionTerm{typeof(zerocorr)}) = StatsModels.degree(only(t.args))
245245

246-
Base.show(io::IO, t::ZeroCorr) = Base.show(io, MIME"text/plain"(), t)
246+
Base.show(io::IO, t::ZeroCorr) = Base.show(io, MIME("text/plain"), t)
247247
function Base.show(io::IO, ::MIME"text/plain", t::ZeroCorr)
248248
# ranefterms already show with parens
249249
return print(io, "zerocorr", t.term)

src/varcorr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function aligncompact(v, digits=_printdigits(v))
2323
return Base.Ryu.writefixed.(v, Ref(digits))
2424
end
2525

26-
Base.show(io::IO, vc::VarCorr) = Base.show(io, MIME"text/plain"(), vc)
26+
Base.show(io::IO, vc::VarCorr) = Base.show(io, MIME("text/plain"), vc)
2727

2828
function Base.show(io::IO, ::MIME"text/plain", vc::VarCorr)
2929
σρ = vc.σρ

0 commit comments

Comments
 (0)