Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use @show_name, @show_special for all (?) parent show methods #1671

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 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)

max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate power series ring")
Expand All @@ -131,6 +134,8 @@ 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 is_terse(io)
print(io, "Multivariate power series ring")
else
Expand Down
7 changes: 6 additions & 1 deletion src/Fraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,19 @@ 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)

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 is_terse(io)
print(io, "Fraction field")
else
Expand Down
7 changes: 6 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,8 @@ 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 is_terse(io)
print(io, "Free associative algebra")
else
Expand Down
7 changes: 6 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,8 @@ 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 is_terse(io)
print(io, "Multivariate Laurent polynomial ring")
else
Expand Down
7 changes: 6 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)

max_vars = 5 # largest number of variables to print
n = nvars(p)
print(io, "Multivariate polynomial ring")
Expand All @@ -577,6 +580,8 @@ 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 is_terse(io)
print(io, "Multivariate polynomial ring")
else
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(terse(io), 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)
print(io, "Univariate polynomial ring in ", var(p), " over ")
print(terse(pretty(io)), Lowercase(), base_ring(p))
end
Expand Down
2 changes: 2 additions & 0 deletions src/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ end
@enable_all_show_via_expressify Union{PolynomialElem, NCPolyRingElem}

function show(io::IO, p::PolyRing)
@show_name(io, p)
@show_special(io, p)
if is_terse(io)
print(io, "Univariate polynomial ring")
else
Expand Down
7 changes: 6 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)

print(io, "Univariate power series ring in ", var(a), " with precision ", a.prec_max)
println(io)
io = pretty(io)
Expand All @@ -284,6 +287,8 @@ 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 is_terse(io)
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 is_terse(io)
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)
if is_terse(io)
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 is_terse(io)
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)
if is_terse(io)
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)
print(terse(pretty(io)), "Function Field over ", Lowercase(),
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 @@
###############################################################################

function show(io::IO, N::SNFModule{T}) where T <: RingElement
@show_name(io, N)
@show_special(io, N)
print(io, "Invariant factor decomposed module over ")
print(terse(pretty(io)), Lowercase(), 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(terse(pretty(io)), Lowercase(), 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)
if is_terse(io)
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)
if is_terse(io)
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 @@
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
io = pretty(io)
if L.comp
print(io, "Localization of ", Lowercase(), base_ring(L), " at complement of ", prime(L))
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)
if is_terse(io)
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)
if is_terse(io)
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)
print(io, "Quotient module over ")
print(terse(pretty(io)), Lowercase(), 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)
print(io, "Quotient space over ")
print(terse(pretty(io)), Lowercase(), 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)
if is_terse(io)
# 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 @@
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)
print(io, "Total ring of fractions of ")
print(terse(pretty(io)), Lowercase(), 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
Loading