Skip to content

Commit

Permalink
Use @show_name, @show_special for all (?) parent show methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 16, 2024
1 parent fb345b6 commit c83ac03
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/AbsMSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ end

@enable_all_show_via_expressify MSeriesElem

function show(io::IO, ::MIME"text/plain", p::MSeriesRing)
function show(io::IO, mime::MIME"text/plain", p::MSeriesRing)
@show_name(io, p)
@show_special(io, mime, p)

Check warning on line 118 in src/AbsMSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/AbsMSeries.jl#L116-L118

Added lines #L116 - L118 were not covered by tests

max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate power series ring")
Expand All @@ -131,6 +134,9 @@ function show(io::IO, ::MIME"text/plain", p::MSeriesRing)
end

function show(io::IO, p::MSeriesRing)
@show_name(io, p)
@show_special(io, p)

if get(io, :supercompact, false)
# no nested printing
print(io, "Multivariate power series ring")
Expand Down
8 changes: 7 additions & 1 deletion src/Fraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,20 @@ end

@enable_all_show_via_expressify FracElem

function show(io::IO, ::MIME"text/plain", a::FracField)
function show(io::IO, mime::MIME"text/plain", a::FracField)
@show_name(io, a)
@show_special(io, mime, a)

Check warning on line 136 in src/Fraction.jl

View check run for this annotation

Codecov / codecov/patch

src/Fraction.jl#L134-L136

Added lines #L134 - L136 were not covered by tests

println(io, "Fraction field")
io = pretty(io)
print(io, Indent(), "of ", Lowercase(), base_ring(a))
print(io, Dedent())
end

function show(io::IO, a::FracField)
@show_name(io, a)
@show_special(io, a)

if get(io, :supercompact, false)
print(io, "Fraction field")
else
Expand Down
8 changes: 7 additions & 1 deletion src/FreeAssAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ end

@enable_all_show_via_expressify FreeAssAlgElem

function show(io::IO, ::MIME"text/plain", a::FreeAssAlgebra)
function show(io::IO, mime::MIME"text/plain", a::FreeAssAlgebra)
@show_name(io, a)
@show_special(io, mime, a)

max_vars = 5 # largest number of variables to print
n = nvars(a)
print(io, "Free associative algebra")
Expand All @@ -77,6 +80,9 @@ function show(io::IO, ::MIME"text/plain", a::FreeAssAlgebra)
end

function show(io::IO, a::FreeAssAlgebra)
@show_name(io, a)
@show_special(io, a)

if get(io, :supercompact, false)
# no nested printing
print(io, "Free associative algebra")
Expand Down
8 changes: 7 additions & 1 deletion src/LaurentMPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ end

@enable_all_show_via_expressify LaurentMPolyRingElem

function show(io::IO, ::MIME"text/plain", p::LaurentMPolyRing)
function show(io::IO, mime::MIME"text/plain", p::LaurentMPolyRing)
@show_name(io, p)
@show_special(io, mime, p)

max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate Laurent polynomial ring")
Expand All @@ -50,6 +53,9 @@ function show(io::IO, ::MIME"text/plain", p::LaurentMPolyRing)
end

function show(io::IO, p::LaurentMPolyRing)
@show_name(io, p)
@show_special(io, p)

if get(io, :supercompact, false)
# no nested printing
print(io, "Multivariate Laurent polynomial ring")
Expand Down
8 changes: 7 additions & 1 deletion src/MPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,10 @@ end

@enable_all_show_via_expressify MPolyRingElem

function show(io::IO, ::MIME"text/plain", p::MPolyRing)
function show(io::IO, mime::MIME"text/plain", p::MPolyRing)
@show_name(io, p)
@show_special(io, mime, p)

Check warning on line 564 in src/MPoly.jl

View check run for this annotation

Codecov / codecov/patch

src/MPoly.jl#L562-L564

Added lines #L562 - L564 were not covered by tests

max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate polynomial ring")
Expand All @@ -577,6 +580,9 @@ function show(io::IO, ::MIME"text/plain", p::MPolyRing)
end

function show(io::IO, p::MPolyRing)
@show_name(io, p)
@show_special(io, p)

if get(io, :supercompact, false)
# no nested printing
print(io, "Multivariate polynomial ring")
Expand Down
2 changes: 1 addition & 1 deletion src/Map.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function check_composable(a::Map, b::Map)
codomain(a) !== domain(b) && error("Incompatible maps")
end

function Base.show(io::IO, ::MIME"text/plain", M::AbstractAlgebra.Map)
function Base.show(io::IO, mime::MIME"text/plain", M::AbstractAlgebra.Map)
# the "header" is identical to the supercompact output; this
# allows other map types to reuse this method
println(IOContext(io, :supercompact => true), M)
Expand Down
2 changes: 1 addition & 1 deletion src/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ is_square(a::MatRingElem) = true
#
###############################################################################

function show(io::IO, ::MIME"text/plain", a::MatRing)
function show(io::IO, mime::MIME"text/plain", a::MatRing)
print(io, "Matrix ring of")
print(io, " degree ", a.n)
println(io)
Expand Down
2 changes: 2 additions & 0 deletions src/NCPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ number_of_generators(R::NCPolyRing) = 1
###############################################################################

function show(io::IO, p::NCPolyRing)
@show_name(io, p)
@show_special(io, p)

Check warning on line 154 in src/NCPoly.jl

View check run for this annotation

Codecov / codecov/patch

src/NCPoly.jl#L153-L154

Added lines #L153 - L154 were not covered by tests
io = pretty(io)
print(io, "Univariate polynomial ring in ", var(p), " over ")
print(IOContext(io, :compact => true), Lowercase(), base_ring(p))
Expand Down
3 changes: 3 additions & 0 deletions src/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ end
@enable_all_show_via_expressify Union{PolynomialElem, NCPolyRingElem}

function show(io::IO, p::PolyRing)
@show_name(io, p)
@show_special(io, p)

if get(io, :supercompact, false)
print(io, "Univariate polynomial ring")
else
Expand Down
8 changes: 7 additions & 1 deletion src/RelSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,10 @@ end

@enable_all_show_via_expressify SeriesElem

function show(io::IO, ::MIME"text/plain", a::SeriesRing)
function show(io::IO, mime::MIME"text/plain", a::SeriesRing)
@show_name(io, a)
@show_special(io, mime, a)

Check warning on line 280 in src/RelSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/RelSeries.jl#L278-L280

Added lines #L278 - L280 were not covered by tests

print(io, "Univariate power series ring in ", var(a), " with precision ", a.prec_max)
println(io)
io = pretty(io)
Expand All @@ -284,6 +287,9 @@ function show(io::IO, ::MIME"text/plain", a::SeriesRing)
end

function show(io::IO, a::SeriesRing)
@show_name(io, a)
@show_special(io, a)

if get(io, :supercompact, false)
print(io, "Univariate power series ring")
else
Expand Down
2 changes: 2 additions & 0 deletions src/Residue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ end
@enable_all_show_via_expressify ResElem

function show(io::IO, a::ResidueRing)
@show_name(io, a)
@show_special(io, a)
if get(io, :supercompact, false)
print(io, "Residue ring")
else
Expand Down
2 changes: 2 additions & 0 deletions src/ResidueField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ end
@enable_all_show_via_expressify ResFieldElem

function show(io::IO, a::ResidueField)
@show_name(io, a)
@show_special(io, a)

Check warning on line 136 in src/ResidueField.jl

View check run for this annotation

Codecov / codecov/patch

src/ResidueField.jl#L135-L136

Added lines #L135 - L136 were not covered by tests
if get(io, :supercompact, false)
print(io, "Residue field")
else
Expand Down
6 changes: 5 additions & 1 deletion src/algorithms/LaurentPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,9 @@ canonical_unit(x::LaurentPolyRingElem) = canonical_unit(leading_coefficient(x))
#
###############################################################################

function show(io::IO, ::MIME"text/plain", p::LaurentPolyRing)
function show(io::IO, mime::MIME"text/plain", p::LaurentPolyRing)
@show_name(io, p)
@show_special(io, mime, p)
print(io, "Univariate Laurent polynomial ring in ", var(p))
println(io)
io = pretty(io)
Expand All @@ -212,6 +214,8 @@ function show(io::IO, ::MIME"text/plain", p::LaurentPolyRing)
end

function show(io::IO, p::LaurentPolyRing)
@show_name(io, p)
@show_special(io, p)
if get(io, :supercompact, false)
print(io, "Univariate Laurent polynomial ring")
else
Expand Down
2 changes: 2 additions & 0 deletions src/generic/DirectSum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ summands(M::DirectSumModule{T}) where T <: RingElement = M.m
###############################################################################

function show(io::IO, N::DirectSumModule{T}) where T <: RingElement
@show_name(io, N)
@show_special(io, N)

Check warning on line 48 in src/generic/DirectSum.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/DirectSum.jl#L47-L48

Added lines #L47 - L48 were not covered by tests
if get(io, :supercompact, false)
io = pretty(io)
print(io, LowercaseOff(), "DirectSumModule")
Expand Down
2 changes: 2 additions & 0 deletions src/generic/FunctionField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ end
@enable_all_show_via_expressify FunctionFieldElem

function show(io::IO, R::FunctionField)
@show_name(io, R)
@show_special(io, R)

Check warning on line 776 in src/generic/FunctionField.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/FunctionField.jl#L775-L776

Added lines #L775 - L776 were not covered by tests
print(IOContext(io, :compact => true), "Function Field over ",
base_ring(base_ring(R)), " with defining polynomial ",
numerator(R))
Expand Down
4 changes: 4 additions & 0 deletions src/generic/InvariantFactorDecomposition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ end
###############################################################################

function show(io::IO, N::SNFModule{T}) where T <: RingElement
@show_name(io, N)
@show_special(io, N)

Check warning on line 60 in src/generic/InvariantFactorDecomposition.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/InvariantFactorDecomposition.jl#L59-L60

Added lines #L59 - L60 were not covered by tests
print(io, "Invariant factor decomposed module over ")
print(IOContext(io, :compact => true), base_ring(N))
print(io, " with invariant factors ")
print(IOContext(io, :compact => true), invariant_factors(N))
end

function show(io::IO, N::SNFModule{T}) where T <: FieldElement
@show_name(io, N)
@show_special(io, N)

Check warning on line 69 in src/generic/InvariantFactorDecomposition.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/InvariantFactorDecomposition.jl#L68-L69

Added lines #L68 - L69 were not covered by tests
print(io, "Vector space over ")
print(IOContext(io, :compact => true), base_ring(N))
print(io, " with dimension ")
Expand Down
4 changes: 4 additions & 0 deletions src/generic/LaurentSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ function Base.show(io::IO, a::LaurentSeriesElem)
end

function show(io::IO, p::LaurentSeriesRing)
@show_name(io, p)
@show_special(io, p)

Check warning on line 521 in src/generic/LaurentSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/LaurentSeries.jl#L520-L521

Added lines #L520 - L521 were not covered by tests
if get(io, :supercompact, false)
print(io, "Laurent series ring")
else
Expand All @@ -527,6 +529,8 @@ function show(io::IO, p::LaurentSeriesRing)
end

function show(io::IO, p::LaurentSeriesField)
@show_name(io, p)
@show_special(io, p)

Check warning on line 533 in src/generic/LaurentSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/LaurentSeries.jl#L532-L533

Added lines #L532 - L533 were not covered by tests
if get(io, :supercompact, false)
print(io, "Laurent series field")
else
Expand Down
2 changes: 2 additions & 0 deletions src/generic/Misc/Localization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ function show(io::IO, a::LocalizedEuclideanRingElem)
end

function show(io::IO, L::LocalizedEuclideanRing)
@show_name(io, L)
@show_special(io, L)

Check warning on line 170 in src/generic/Misc/Localization.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/Misc/Localization.jl#L169-L170

Added lines #L169 - L170 were not covered by tests
if L.comp
print(io, "Localization of ", base_ring(L), " at complement of ", prime(L))
else
Expand Down
2 changes: 2 additions & 0 deletions src/generic/PermGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ permtype(g::Perm) = sort!(diff(cycles(g).cptrs), rev=true)
###############################################################################

function show(io::IO, G::SymmetricGroup)
@show_name(io, G)
@show_special(io, G)

Check warning on line 283 in src/generic/PermGroups.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/PermGroups.jl#L282-L283

Added lines #L282 - L283 were not covered by tests
print(io, "Full symmetric group over $(G.n) elements")
end

Expand Down
4 changes: 4 additions & 0 deletions src/generic/PuiseuxSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ function Base.show(io::IO, a::PuiseuxSeriesElem)
end

function show(io::IO, p::PuiseuxSeriesRing)
@show_name(io, p)
@show_special(io, p)

Check warning on line 317 in src/generic/PuiseuxSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/PuiseuxSeries.jl#L316-L317

Added lines #L316 - L317 were not covered by tests
if get(io, :supercompact, false)
print(io, "Puiseux series ring")
else
Expand All @@ -323,6 +325,8 @@ function show(io::IO, p::PuiseuxSeriesRing)
end

function show(io::IO, p::PuiseuxSeriesField)
@show_name(io, p)
@show_special(io, p)

Check warning on line 329 in src/generic/PuiseuxSeries.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/PuiseuxSeries.jl#L328-L329

Added lines #L328 - L329 were not covered by tests
if get(io, :supercompact, false)
print(io, "Puiseux series field")
else
Expand Down
4 changes: 4 additions & 0 deletions src/generic/QuotientModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,16 @@ function show_gens_rels(io::IO, N::AbstractAlgebra.FPModule{T}) where T <: RingE
end

function show(io::IO, N::QuotientModule{T}) where T <: RingElement
@show_name(io, N)
@show_special(io, N)

Check warning on line 68 in src/generic/QuotientModule.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/QuotientModule.jl#L67-L68

Added lines #L67 - L68 were not covered by tests
print(io, "Quotient module over ")
print(IOContext(io, :compact => true), base_ring(N))
show_gens_rels(io, N)
end

function show(io::IO, N::QuotientModule{T}) where T <: FieldElement
@show_name(io, N)
@show_special(io, N)

Check warning on line 76 in src/generic/QuotientModule.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/QuotientModule.jl#L75-L76

Added lines #L75 - L76 were not covered by tests
println(io, "Quotient space over:")
print(IOContext(io, :compact => true), base_ring(N))
show_gens_rels(io, N)
Expand Down
2 changes: 2 additions & 0 deletions src/generic/RationalFunctionField.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ function show(io::IO, ::MIME"text/plain", a::RationalFunctionField)
end

function show(io::IO, a::RationalFunctionField)
@show_name(io, a)
@show_special(io, a)

Check warning on line 159 in src/generic/RationalFunctionField.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/RationalFunctionField.jl#L158-L159

Added lines #L158 - L159 were not covered by tests
if get(io, :supercompact, false)
# no nested printing
print(io, "Rational function field")
Expand Down
2 changes: 2 additions & 0 deletions src/generic/SparsePoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ function Base.show(io::IO, a::SparsePoly)
end

function show(io::IO, p::SparsePolyRing)
@show_name(io, p)
@show_special(io, p)

Check warning on line 113 in src/generic/SparsePoly.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/SparsePoly.jl#L112-L113

Added lines #L112 - L113 were not covered by tests
print(io, "Sparse Univariate Polynomial Ring in ")
print(io, string(p.S))
print(io, " over ")
Expand Down
2 changes: 2 additions & 0 deletions src/generic/TotalFraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ end
@enable_all_show_via_expressify TotFrac

function show(io::IO, a::TotFracRing)
@show_name(io, a)
@show_special(io, a)

Check warning on line 141 in src/generic/TotalFraction.jl

View check run for this annotation

Codecov / codecov/patch

src/generic/TotalFraction.jl#L140-L141

Added lines #L140 - L141 were not covered by tests
print(IOContext(io, :compact => true), "Total ring of fractions of ", base_ring(a))
end

Expand Down
2 changes: 2 additions & 0 deletions src/generic/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ end
###############################################################################

function show(io::IO, R::UniversalPolyRing)
@show_name(io, R)
@show_special(io, R)
print(io, "Universal Polynomial Ring over ")
show(io, base_ring(R))
end
Expand Down
2 changes: 2 additions & 0 deletions src/generic/imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ using ..AbstractAlgebra

import ..AbstractAlgebra: @attributes
import ..AbstractAlgebra: @enable_all_show_via_expressify
import ..AbstractAlgebra: @show_name
import ..AbstractAlgebra: @show_special
import ..AbstractAlgebra: CacheDictType
import ..AbstractAlgebra: CycleDec
import ..AbstractAlgebra: Dedent
Expand Down
2 changes: 2 additions & 0 deletions src/julia/GF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ function show(io::IO, x::GFElem)
end

function show(io::IO, R::GFField)
@show_name(io, R)
@show_special(io, R)
print(io, "Finite field F_", R.p)
end

Expand Down

0 comments on commit c83ac03

Please sign in to comment.