diff --git a/docs/src/DeveloperDocumentation/printing_details.md b/docs/src/DeveloperDocumentation/printing_details.md index 155dc4662e51..771d6dbb9f8f 100644 --- a/docs/src/DeveloperDocumentation/printing_details.md +++ b/docs/src/DeveloperDocumentation/printing_details.md @@ -7,13 +7,13 @@ found in the [Developer Style Guide](@ref). ## Implementing `show` functions -Here is the translation between `:detail`, `one line` and `:supercompact`, +Here is the translation between `:detail`, `one line` and `terse`, where `io` is an `IO` object (such as `stdout` or an `IOBuffer`): ``` show(io, MIME"text/plain"(), x) # detailed printing print(io, x) # one line printing -print(IOContext(io, :supercompact => true), x) # supercompact printing +print(terse(io), x) # terse printing ``` For reference, string interpolation `"$(x)"` uses one line printing via `print(io, x)`, @@ -49,16 +49,16 @@ function Base.show(io::IO, ::MIME"text/plain", R::NewRing) end ``` -The following is a template for `one line` and `:supercompact` printing. +The following is a template for `one line` and `terse` printing. ```julia function Base.show(io::IO, R::NewRing) - if get(io, :supercompact, false) + if is_terse(io) # no nested printing - print(io, "supercompact printing of newring ") + print(io, "terse printing of newring ") else - # nested printing allowed, preferably supercompact + # nested printing allowed, preferably terse print(io, "one line printing of newring with ") - print(IOContext(io, :supercompact => true), "supercompact ", base_ring(R)) + print(terse(io), "terse ", base_ring(R)) end end ``` @@ -71,8 +71,8 @@ QQ julia> [R,R] 2-element Vector{NewRing}: - one line printing of newring with supercompact QQ - one line printing of newring with supercompact QQ + one line printing of newring with terse QQ + one line printing of newring with terse QQ ``` @@ -81,7 +81,7 @@ julia> [R,R] This version needs to be used in case the detailed printing does not contain newlines. Then detailed and one line printing agree. -The `if` clause takes care of supercompact printing as well. +The `if` clause takes care of terse printing as well. ```julia struct NewRing2 @@ -91,13 +91,13 @@ end base_ring(R::NewRing2) = R.base_ring function Base.show(io::IO, R::NewRing2) - if get(io, :supercompact, false) + if is_terse(io) # no nested printing - print(io, "supercompact printing of newring") + print(io, "terse printing of newring") else - # nested printing allowed, preferably supercompact + # nested printing allowed, preferably terse print(io, "I am a new ring and always print in one line " ) - print(IOContext(io, :supercompact => true), base_ring(R)) + print(terse(io), base_ring(R)) end end ``` @@ -111,11 +111,11 @@ julia> [R,R] I am a new ring and always print in one line Rational Field I am a new ring and always print in one line Rational Field -julia> print(IOContext(Base.stdout, :supercompact => true) ,R) -supercompact printing of newring +julia> print(terse(Base.stdout) ,R) +terse printing of newring ``` -The `supercompact` printing uses an `IOContext` (see [IOContext](https://docs.julialang.org/en/v1/base/io-network/#Base.IOContext) from +The `terse` printing uses an `IOContext` (see [IOContext](https://docs.julialang.org/en/v1/base/io-network/#Base.IOContext) from the Julia documentation) to pass information to other `show` methods invoked recursively (for example in nested printings). The same mechanism can be used to pass other context data. For instance, this is used by the `Scheme` code in @@ -140,11 +140,11 @@ It will be used for `print(io, R::NewRing)` though. ```julia function Base.show(io::IO, R::NewRing) - if get(io, :supercompact, false) - print(io, "supercompact printing of newring") + if is_terse(io) + print(io, "terse printing of newring") else # this is what we call one line print(io, "one line printing of newring with ") - print(IOContext(io, :supercompact => true), "supercompact ", R.base_ring) + print(terse(io), "terse ", R.base_ring) end end ``` @@ -161,7 +161,7 @@ julia> [R,R] # one line printing is ignored I am a new ring with a detailed printing of one line julia> print(Base.stdout, R) -one line printing of newring with supercompact QQ +one line printing of newring with terse QQ ``` ## Advanced printing functionality @@ -306,7 +306,7 @@ Here is an example with and without output using Unicode: - All `show` methods for parent objects such as rings or modules should use the `@show_name` macro. This macro ensures that if the object has a name (including one derived from the name of a Julia REPL variable to which the object is currently assigned) then in - a `compact` or `supercompact` io context it is printed using that name. + a `compact` or `terse` io context it is printed using that name. Here is an example illustrating this: ``` julia> vector_space(GF(2), 2) diff --git a/docs/src/DeveloperDocumentation/styleguide.md b/docs/src/DeveloperDocumentation/styleguide.md index 9b10d066614b..44490ecffaf8 100644 --- a/docs/src/DeveloperDocumentation/styleguide.md +++ b/docs/src/DeveloperDocumentation/styleguide.md @@ -275,7 +275,7 @@ matrix `A`, write `Oscar.parent(A)`. ### The 2 + 1 print modes of Oscar Oscar has two user print modes `detailed` and `one line` and one internal -print mode `:supercompact`. The latter is for use during recursion, +print mode `terse`. The latter is for use during recursion, e.g. to print the `base_ring(X)` when in `one line` mode. It exists to make sure that `one line` stays compact and human readable. @@ -302,7 +302,7 @@ General linear group of degree 24 # one line General linear group of degree 24 over GF(29^7) -# supercompact +# terse General linear group ``` @@ -317,17 +317,17 @@ The print modes are specified as follows - should make sense as a standalone without context - variable names/generators/relations should not be printed only their number. - Only the first word is capitalized e.g. `Polynomial ring` -- one should use `:supercompact` for nested printing in compact +- one should use `terse` for nested printing in compact - nested calls to `one line` (if you think them really necessary) should be at the end, - so that one can read sequentially. Calls to `:supercompact` can be anywhere. + so that one can read sequentially. Calls to `terse` can be anywhere. - commas must be enclosed in brackets so that printing tuples stays unambiguous -#### Super compact printing +#### Terse printing - a user readable version of the main (mathematical) type. - a single term or a symbol/letter mimicking mathematical notation - should usually only depend on the type and not of the type parameters or of the concrete instance - exceptions of this rule are possible e.g. for `GF(2)` - no nested printing. In particular variable names and `base_ring` must not be displayed. - This ensures that `one line` and `:supercompact` stay compact even for complicated things. + This ensures that `one line` and `terse` stay compact even for complicated things. If you want nested printing use `one line` or `detailed`. For further information and examples we refer you to our section [Details on diff --git a/experimental/BasisLieHighestWeight/src/MonomialBasis.jl b/experimental/BasisLieHighestWeight/src/MonomialBasis.jl index f5027ddb9ac5..84d4e535f7a6 100644 --- a/experimental/BasisLieHighestWeight/src/MonomialBasis.jl +++ b/experimental/BasisLieHighestWeight/src/MonomialBasis.jl @@ -92,7 +92,7 @@ function Base.show(io::IO, ::MIME"text/plain", basis::MonomialBasis) end function Base.show(io::IO, basis::MonomialBasis) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Monomial basis of a highest weight module") else io = pretty(io) @@ -100,6 +100,6 @@ function Base.show(io::IO, basis::MonomialBasis) io, "Monomial basis of a highest weight module with highest weight $(highest_weight(basis)) over ", ) - print(IOContext(io, :supercompact => true), Lowercase(), base_lie_algebra(basis)) + print(terse(io), Lowercase(), base_lie_algebra(basis)) end end diff --git a/experimental/GModule/GaloisCohomology.jl b/experimental/GModule/GaloisCohomology.jl index 900cd21d1f2f..9e7c029feab9 100644 --- a/experimental/GModule/GaloisCohomology.jl +++ b/experimental/GModule/GaloisCohomology.jl @@ -6,7 +6,7 @@ import Oscar.GrpCoh: CoChain, MultGrpElem, MultGrp, GModule, is_consistent, Group import Base: parent import Oscar: direct_sum -import Oscar: pretty, Lowercase, Indent, Dedent +import Oscar: pretty, Lowercase, Indent, Dedent, terse export is_coboundary, idel_class_gmodule, relative_brauer_group export local_invariants, global_fundamental_class, shrink @@ -1390,7 +1390,8 @@ end function Base.show(io::IO, m::MIME"text/plain", a::RelativeBrauerGroupElem) io = pretty(io) print(io, "Element of relative Brauer group of ", Lowercase(), parent(a).k) - io = IOContext(io, :supercompact => true, :compact => true) + io = terse(io) + io = IOContext(io, :compact => true) # FIXME: for now also enable compact printing print(io, Indent()) data = sort(collect(a.data); by =(x -> first(x) isa AbsSimpleNumFieldEmbedding ? Inf : minimum(first(x)))) for (p,v) in data diff --git a/experimental/InvariantTheory/src/InvariantTheory.jl b/experimental/InvariantTheory/src/InvariantTheory.jl index 1cfde8782f86..aabe10017163 100644 --- a/experimental/InvariantTheory/src/InvariantTheory.jl +++ b/experimental/InvariantTheory/src/InvariantTheory.jl @@ -59,7 +59,7 @@ function Base.show(io::IO, G::LinearlyReductiveGroup) io = pretty(io) if G.group[1] == :SL println(io, "Reductive group ", G.group[1], G.group[2]) - print(IOContext(io, :supercompact => true), Indent(), "over ", Lowercase(), field(G)) + print(terse(io), Indent(), "over ", Lowercase(), field(G)) print(io, Dedent()) end end diff --git a/experimental/InvariantTheory/src/TorusInvariantsFast.jl b/experimental/InvariantTheory/src/TorusInvariantsFast.jl index 7cbc628df96c..72c740891092 100644 --- a/experimental/InvariantTheory/src/TorusInvariantsFast.jl +++ b/experimental/InvariantTheory/src/TorusInvariantsFast.jl @@ -61,7 +61,7 @@ field(G::TorusGroup) = G.field function Base.show(io::IO, G::TorusGroup) io = pretty(io) println(io, "Torus of rank ", rank(G)) - print(IOContext(io, :supercompact => true), Indent(), "over ", Lowercase(), field(G)) + print(terse(io), Indent(), "over ", Lowercase(), field(G)) print(io, Dedent()) end @@ -152,7 +152,7 @@ group(R::RepresentationTorusGroup) = R.group function Base.show(io::IO, R::RepresentationTorusGroup) io = pretty(io) println(io, "Representation of torus of rank ", rank(group(R))) - println(IOContext(io, :supercompact => true), Indent(), "over ", Lowercase(), field(group(R)), " and weights ") + println(terse(io), Indent(), "over ", Lowercase(), field(group(R)), " and weights ") print(io, R.weights) print(io, Dedent()) end diff --git a/experimental/LieAlgebras/src/AbstractLieAlgebra.jl b/experimental/LieAlgebras/src/AbstractLieAlgebra.jl index 52ea93c7e50a..a12d9531f60d 100644 --- a/experimental/LieAlgebras/src/AbstractLieAlgebra.jl +++ b/experimental/LieAlgebras/src/AbstractLieAlgebra.jl @@ -120,12 +120,12 @@ function Base.show(io::IO, ::MIME"text/plain", L::AbstractLieAlgebra) end function Base.show(io::IO, L::AbstractLieAlgebra) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Abstract Lie algebra") else io = pretty(io) print(io, "Abstract Lie algebra over ", Lowercase()) - print(IOContext(io, :supercompact => true), coefficient_ring(L)) + print(terse(io), coefficient_ring(L)) end end diff --git a/experimental/LieAlgebras/src/LieAlgebraHom.jl b/experimental/LieAlgebras/src/LieAlgebraHom.jl index 1eed643e5b89..91ec4cc2aea5 100644 --- a/experimental/LieAlgebras/src/LieAlgebraHom.jl +++ b/experimental/LieAlgebras/src/LieAlgebraHom.jl @@ -71,7 +71,7 @@ end function Base.show(io::IO, ::MIME"text/plain", h::LieAlgebraHom) io = pretty(io) - println(IOContext(io, :supercompact => true), h) + println(terse(io), h) print(io, Indent()) println(io, "from ", Lowercase(), domain(h)) print(io, "to ", Lowercase(), codomain(h)) @@ -80,7 +80,7 @@ end function Base.show(io::IO, h::LieAlgebraHom) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, LowercaseOff(), "Lie algebra morphism") else print(io, LowercaseOff(), "Lie algebra morphism: ") diff --git a/experimental/LieAlgebras/src/LieAlgebraIdeal.jl b/experimental/LieAlgebras/src/LieAlgebraIdeal.jl index 14dd8759d4f1..c90a3960b3ed 100644 --- a/experimental/LieAlgebras/src/LieAlgebraIdeal.jl +++ b/experimental/LieAlgebras/src/LieAlgebraIdeal.jl @@ -114,11 +114,11 @@ end function Base.show(io::IO, I::LieAlgebraIdeal) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, LowercaseOff(), "Lie algebra ideal") else print(io, LowercaseOff(), "Lie algebra ideal of dimension $(dim(I)) over ", Lowercase()) - print(IOContext(io, :supercompact => true), base_lie_algebra(I)) + print(terse(io), base_lie_algebra(I)) end end diff --git a/experimental/LieAlgebras/src/LieAlgebraModule.jl b/experimental/LieAlgebras/src/LieAlgebraModule.jl index 253d5f61bbaa..853c2cdd3c0a 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModule.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModule.jl @@ -211,12 +211,12 @@ function _show_inner(io::IO, V::LieAlgebraModule) end function Base.show(io::IO, V::LieAlgebraModule) - if get(io, :supercompact, false) + if is_terse(io) print(io, _module_type_to_string(V)) else io = pretty(io) print(io, _module_type_to_string(V), " of dimension $(dim(V)) over ", Lowercase()) - print(IOContext(io, :supercompact => true), base_lie_algebra(V)) + print(terse(io), base_lie_algebra(V)) end end diff --git a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl index c92d9c2dc337..c2885ebe4b67 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl @@ -78,7 +78,7 @@ end function Base.show(io::IO, ::MIME"text/plain", h::LieAlgebraModuleHom) io = pretty(io) - println(IOContext(io, :supercompact => true), h) + println(terse(io), h) print(io, Indent()) println(io, "from ", Lowercase(), domain(h)) print(io, "to ", Lowercase(), codomain(h)) @@ -87,7 +87,7 @@ end function Base.show(io::IO, h::LieAlgebraModuleHom) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, LowercaseOff(), "Lie algebra module morphism") else print(io, LowercaseOff(), "Lie algebra module morphism: ") diff --git a/experimental/LieAlgebras/src/LieSubalgebra.jl b/experimental/LieAlgebras/src/LieSubalgebra.jl index 528e74bcabfe..4350e26731d0 100644 --- a/experimental/LieAlgebras/src/LieSubalgebra.jl +++ b/experimental/LieAlgebras/src/LieSubalgebra.jl @@ -112,11 +112,11 @@ end function Base.show(io::IO, S::LieSubalgebra) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, LowercaseOff(), "Lie subalgebra") else print(io, LowercaseOff(), "Lie subalgebra of dimension $(dim(S)) of ", Lowercase()) - print(IOContext(io, :supercompact => true), base_lie_algebra(S)) + print(terse(io), base_lie_algebra(S)) end end diff --git a/experimental/LieAlgebras/src/LinearLieAlgebra.jl b/experimental/LieAlgebras/src/LinearLieAlgebra.jl index 960f023c0278..55df81638c8d 100644 --- a/experimental/LieAlgebras/src/LinearLieAlgebra.jl +++ b/experimental/LieAlgebras/src/LinearLieAlgebra.jl @@ -91,7 +91,7 @@ function Base.show(io::IO, ::MIME"text/plain", L::LinearLieAlgebra) end function Base.show(io::IO, L::LinearLieAlgebra) - if get(io, :supercompact, false) + if is_terse(io) print(io, _lie_algebra_type_to_compact_string(get_attribute(L, :type, :unknown), L.n)) else io = pretty(io) @@ -101,7 +101,7 @@ function Base.show(io::IO, L::LinearLieAlgebra) " over ", Lowercase(), ) - print(IOContext(io, :supercompact => true), coefficient_ring(L)) + print(terse(io), coefficient_ring(L)) end end diff --git a/experimental/LieAlgebras/src/RootSystem.jl b/experimental/LieAlgebras/src/RootSystem.jl index 906572f16837..8c7598fc83c7 100644 --- a/experimental/LieAlgebras/src/RootSystem.jl +++ b/experimental/LieAlgebras/src/RootSystem.jl @@ -81,7 +81,7 @@ function Base.show(io::IO, ::MIME"text/plain", R::RootSystem) end function Base.show(io::IO, R::RootSystem) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Root system") else print(io, "Root system defined by Cartan matrix $(cartan_matrix(R))") diff --git a/experimental/QuadFormAndIsom/src/printings.jl b/experimental/QuadFormAndIsom/src/printings.jl index 5e1b334b2400..2f2f7d6da67a 100644 --- a/experimental/QuadFormAndIsom/src/printings.jl +++ b/experimental/QuadFormAndIsom/src/printings.jl @@ -20,7 +20,7 @@ function Base.show(io::IO, ::MIME"text/plain", Lf::ZZLatWithIsom) end function Base.show(io::IO, Lf::ZZLatWithIsom) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Integer lattice with isometry") else n = order_of_isometry(Lf) @@ -54,7 +54,7 @@ function Base.show(io::IO, ::MIME"text/plain", Vf::QuadSpaceWithIsom) end function Base.show(io::IO, Vf::QuadSpaceWithIsom) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Quadratic space with isometry") else n = order_of_isometry(Vf) diff --git a/experimental/Schemes/AlgebraicCycles.jl b/experimental/Schemes/AlgebraicCycles.jl index 2e699b2392f1..2b097ebf3b1c 100644 --- a/experimental/Schemes/AlgebraicCycles.jl +++ b/experimental/Schemes/AlgebraicCycles.jl @@ -358,7 +358,7 @@ function Base.show(io::IO, D::AlgebraicCycle) end if has_name(D) print(io, name(D)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Algebraic cycle") elseif length(components(D)) == 0 print(io, "Zero algebraic cycle on ", Lowercase(), scheme(D)) diff --git a/experimental/Schemes/BlowupMorphism.jl b/experimental/Schemes/BlowupMorphism.jl index e47b66380f86..c2e10c7dca01 100644 --- a/experimental/Schemes/BlowupMorphism.jl +++ b/experimental/Schemes/BlowupMorphism.jl @@ -686,7 +686,7 @@ end ############################################################################## function Base.show(io::IO, Bl::AbsSimpleBlowdownMorphism) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Blowup morphism") else print(io, "Blow-down: ", Lowercase(), domain(Bl)) diff --git a/experimental/Schemes/CartierDivisor.jl b/experimental/Schemes/CartierDivisor.jl index df33628f3f40..cae4f92cb8a1 100644 --- a/experimental/Schemes/CartierDivisor.jl +++ b/experimental/Schemes/CartierDivisor.jl @@ -413,7 +413,7 @@ function Base.show(io::IO, C::EffectiveCartierDivisor) cov = Oscar._covering_for_printing(io, scheme(C)) n = get(io, :label, "") _show_semi_compact(io, C, cov, n) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Effective cartier divisor") elseif has_attribute(C, :name) print(io, get_attribute(C, :name)) @@ -472,7 +472,7 @@ function Base.show(io::IO, C::CartierDivisor) cov = Oscar._covering_for_printing(io, scheme(C)) n = get(io, :label, "") _show_semi_compact(io, C, cov, n) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Cartier divisor") elseif has_attribute(C, :name) print(io, get_attribute(C, :name)) diff --git a/experimental/Schemes/CoherentSheaves.jl b/experimental/Schemes/CoherentSheaves.jl index 2e79344fe7fa..4b2a9349fc42 100644 --- a/experimental/Schemes/CoherentSheaves.jl +++ b/experimental/Schemes/CoherentSheaves.jl @@ -69,7 +69,7 @@ end function Base.show(io::IO, M::AbsCoherentSheaf) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Coherent sheaf of modules") elseif has_attribute(M, :name) print(io, get_attribute(M, :name)) @@ -1009,7 +1009,7 @@ function direct_sum(summands::Vector{<:AbsCoherentSheaf}) end function Base.show(io::IO, M::DirectSumSheaf) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Direct sum of sheaves") else s = summands(M) diff --git a/experimental/Schemes/CoveredProjectiveSchemes.jl b/experimental/Schemes/CoveredProjectiveSchemes.jl index 6b56b606d78d..55db8c4ae602 100644 --- a/experimental/Schemes/CoveredProjectiveSchemes.jl +++ b/experimental/Schemes/CoveredProjectiveSchemes.jl @@ -264,7 +264,7 @@ function Base.show(io::IO, CPS::CoveredProjectiveScheme) io = pretty(io) n = length(projective_patches(CPS)) K = base_ring(base_scheme(CPS)) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Relative projective scheme") else if length(projective_patches(CPS)) == 0 diff --git a/experimental/Schemes/CoveredScheme.jl b/experimental/Schemes/CoveredScheme.jl index 898c441fab23..8e863bc5ca5e 100644 --- a/experimental/Schemes/CoveredScheme.jl +++ b/experimental/Schemes/CoveredScheme.jl @@ -713,7 +713,7 @@ end ######################################################################## function Base.show(io::IO, f::CompositeCoveredSchemeMorphism) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Composite morphism") else print(io, "Composition of ", "$(domain(f)) -> ") diff --git a/experimental/Schemes/FunctionFields.jl b/experimental/Schemes/FunctionFields.jl index ef1b87969696..9cfcff5fdfdc 100644 --- a/experimental/Schemes/FunctionFields.jl +++ b/experimental/Schemes/FunctionFields.jl @@ -384,7 +384,7 @@ canonical_unit(f::VarietyFunctionFieldElem) = f # part of the ring interface tha function Base.show(io::IO, KK::VarietyFunctionField) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Field of rational functions") else print(io, "Field of rational functions on ", Lowercase(), variety(KK)) @@ -415,7 +415,7 @@ function Base.show(io::IO, f::VarietyFunctionFieldElem) cov = Oscar._covering_for_printing(io, X) k = get(io, :offset, 0) _show_semi_compact(io, f, cov, k) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Rational function") else print(io, "Rational function on ", Lowercase(), variety(parent(f))) diff --git a/experimental/Schemes/IdealSheaves.jl b/experimental/Schemes/IdealSheaves.jl index 9030f7dd6c44..174e2f4130b4 100644 --- a/experimental/Schemes/IdealSheaves.jl +++ b/experimental/Schemes/IdealSheaves.jl @@ -1136,7 +1136,7 @@ function Base.show(io::IO, I::AbsIdealSheaf) prim = get_attribute(I, :is_prime, false) if has_attribute(I, :name) print(io, get_attribute(I, :name)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Sheaf of ideals") else if get_attribute(I, :is_one, false) diff --git a/experimental/Schemes/MorphismFromRationalFunctions.jl b/experimental/Schemes/MorphismFromRationalFunctions.jl index a22f2139c2fb..7faa7548f454 100644 --- a/experimental/Schemes/MorphismFromRationalFunctions.jl +++ b/experimental/Schemes/MorphismFromRationalFunctions.jl @@ -92,7 +92,7 @@ morphism_from_rational_functions( ) = MorphismFromRationalFunctions(X, Y, U, V, a; check, domain_covering, codomain_covering) function Base.show(io::IOContext, Phi::MorphismFromRationalFunctions) - if get(io, :supercompact, false) + if is_terse(io) print("Morphism from rational functions") else io = pretty(io) diff --git a/experimental/Schemes/Sheaves.jl b/experimental/Schemes/Sheaves.jl index 9638cb9c16f5..5edc24fca55f 100644 --- a/experimental/Schemes/Sheaves.jl +++ b/experimental/Schemes/Sheaves.jl @@ -521,12 +521,12 @@ end function Base.show(io::IO, R::StructureSheafOfRings) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Structure sheaf of rings") else if is_unicode_allowed() print(io, "๐’ช_{") - print(IOContext(io, :supercompact => true), space(R), "}") + print(terse(io), space(R), "}") else print(io, "Structure sheaf of ", Lowercase(), space(R)) end diff --git a/experimental/Schemes/WeilDivisor.jl b/experimental/Schemes/WeilDivisor.jl index b2d7e6a15b7e..862b77063809 100644 --- a/experimental/Schemes/WeilDivisor.jl +++ b/experimental/Schemes/WeilDivisor.jl @@ -186,7 +186,7 @@ function Base.show(io::IO, D::AbsWeilDivisor) prim = eff && get_attribute(D, :is_prime, false) if has_name(D) print(io, name(D)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Weil divisor") # if the divisor is prime and the ideal sheaf has a name print that elseif length(components(D)) == 1 && has_attribute(first(components(D)), :name) @@ -608,7 +608,7 @@ generated by rational functions ``fโ‚,โ€ฆ,fแตฃ โˆˆ K(X)``. end function Base.show(io::IO, L::LinearSystem) - if get(io, :supercompact, true) + if is_terse(io) print(io, "Linear system") else io = pretty(io) diff --git a/experimental/Schemes/elliptic_surface.jl b/experimental/Schemes/elliptic_surface.jl index c8a29d1cddc4..35847bd9d029 100644 --- a/experimental/Schemes/elliptic_surface.jl +++ b/experimental/Schemes/elliptic_surface.jl @@ -366,7 +366,7 @@ end function Base.show(io::IO, S::EllipticSurface) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Elliptic surface") else E = generic_fiber(S) diff --git a/experimental/SymmetricIntersections/src/printings.jl b/experimental/SymmetricIntersections/src/printings.jl index 2fadaafbc24d..4b316669dfac 100644 --- a/experimental/SymmetricIntersections/src/printings.jl +++ b/experimental/SymmetricIntersections/src/printings.jl @@ -6,7 +6,7 @@ function Base.show(io::IO, EC::ElevCtx{T, U}) where {T, U} d = degree_of_elevations(EC) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Elevator") else print(io, "Degree $d elevator of a list with entries of type $T") @@ -30,7 +30,7 @@ function Base.show(io::IO, ::MIME"text/plain", LR::LinRep) end function Base.show(io::IO, LR::LinRep) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Linear representation") else print(io, "Linear representation of finite group of dimension $(dimension_representation(LR))") @@ -48,7 +48,7 @@ function Base.show(io::IO, ::MIME"text/plain", PR::ProjRep) end function Base.show(io::IO, PR::ProjRep) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Projective representation") else print(io, "Projective representation of finite group of dimension ", dimension_representation(PR)) @@ -66,7 +66,7 @@ function Base.show(io::IO, ::MIME"text/plain", RR::RepRing) end function Base.show(io::IO, RR::RepRing) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Representation ring") else print(io, "Representation ring of finite group over a field of characteristic 0") @@ -91,7 +91,7 @@ function Base.show(io::IO, ::MIME"text/plain", M::IsotGrass) end function Base.show(io::IO, M::IsotGrass) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Isotypical Grassmannian") else print(io, "Isotypical Grassmannian of dimension $(projective_dimension(M))") @@ -111,7 +111,7 @@ function Base.show(io::IO, ::MIME"text/plain", M::CharGrass) end function Base.show(io::IO, M::CharGrass) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Character Grassmannian") else print(io, "Character Grassmannian of dimension $(projective_dimension(M))") @@ -130,7 +130,7 @@ function Base.show(io::IO, ::MIME"text/plain", M::DetGrass) end function Base.show(io::IO, M::DetGrass) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Determinant Grassmannian") else print(io, "Determinant Grassmannian of dimension $(projective_dimension(M))") @@ -147,7 +147,7 @@ function Base.show(io::IO, ::MIME"text/plain", M::InvGrass) end function Base.show(io::IO, M::InvGrass) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Invariant Grassmannian") else print(io, "Invariant Grassmannian of dimension $(projective_dimension(M))") @@ -185,13 +185,13 @@ function Base.show(io::IO, ::MIME"text/plain", symci::SymInter) println(io, Indent(), "of type $(ty)") println(io, "in projective $(n-1)-space") print(io, Indent(), "over ", Lowercase()) - Base.show(IOContext(io, :supercompact => true), F) + Base.show(terse(io), F) println(io) print(io, Dedent(), Dedent(), "preserved under the action of ", Lowercase(), G) end function Base.show(io::IO, symci::SymInter) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Symmetric intersections") else print(io, "Parameter space for symmetric intersections") diff --git a/src/AlgebraicGeometry/Schemes/AffineAlgebraicSet/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineAlgebraicSet/Objects/Methods.jl index b8166613e7a0..37ce507e3089 100644 --- a/src/AlgebraicGeometry/Schemes/AffineAlgebraicSet/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineAlgebraicSet/Objects/Methods.jl @@ -24,13 +24,13 @@ end # For compact printing, we value the notation V(bla) since it tells everything # we need to know, in a given contextual printing function Base.show(io::IO, X::AffineAlgebraicSet{<:Field,<:MPolyQuoRing}) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine algebraic set") elseif get_attribute(X, :is_empty, false) io = pretty(io) print(io, "Empty affine algebraic set over ") K = base_ring(X) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else io = pretty(io) if isdefined(X, :Xred) @@ -53,13 +53,13 @@ function Base.show(io::IO, ::MIME"text/plain", X::AffineAlgebraicSet) end function Base.show(io::IO, X::AffineAlgebraicSet) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine algebraic set") elseif get_attribute(X, :is_empty, false) io = pretty(io) print(io, "Empty affine algebraic set over ") K = base_ring(X) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else io = pretty(io) print(io, "Reduced subscheme of ", Lowercase(), fat_scheme(X)) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Morphisms/Methods.jl index eafc5f2b6a15..64d15b54bf5b 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Morphisms/Methods.jl @@ -46,7 +46,7 @@ function Base.show(io::IO, ::MIME"text/plain", f::AffineSchemeOpenSubschemeMor) end function Base.show(io::IO, f::AffineSchemeOpenSubschemeMor) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine scheme open subscheme morphism") else io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Objects/Methods.jl index 7c6b977c6809..9cd15c88ea5f 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Objects/Methods.jl @@ -187,7 +187,7 @@ function Base.show(io::IO, U::AffineSchemeOpenSubscheme) _show_semi_compact(io, U) elseif isdefined(U, :name) print(io, name(U)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Open subset of affine scheme") elseif get_attribute(U, :is_empty, false) io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl index 327467b68d3e..b5b11f84c998 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl @@ -450,7 +450,7 @@ end ############################################################################### function Base.show(io::IO, R::AffineSchemeOpenSubschemeRing) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Ring of regular functions") else io = pretty(io) @@ -468,7 +468,7 @@ function Base.show(io::IO, ::MIME"text/plain", R::AffineSchemeOpenSubschemeRing) end function Base.show(io::IO, a::AffineSchemeOpenSubschemeRingElem) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Reguler function") else io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Methods.jl index 7f8f6f2081d3..33b2ab895606 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Morphisms/Methods.jl @@ -426,7 +426,7 @@ function Base.show(io::IO, ::MIME"text/plain", f::AbsAffineSchemeMor) end function Base.show(io::IO, f::AbsAffineSchemeMor) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine scheme morphism") else io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl index 71eecb87e370..432b9e540150 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl @@ -43,7 +43,7 @@ end function Base.show(io::IO, X::AbsAffineScheme) if has_attribute(X, :name) print(io, name(X)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Affine scheme") elseif get_attribute(X, :is_empty, false) print(io, "Empty affine scheme") diff --git a/src/AlgebraicGeometry/Schemes/AffineVariety/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineVariety/Objects/Methods.jl index 55df42ded672..5a6da53c0263 100644 --- a/src/AlgebraicGeometry/Schemes/AffineVariety/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineVariety/Objects/Methods.jl @@ -19,13 +19,13 @@ function Base.show(io::IO, ::MIME"text/plain", X::AffineVariety{<:Field,<:MPolyQ end function Base.show(io::IO, X::AffineVariety{<:Field,<:MPolyQuoRing}) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine variety") elseif get_attribute(X, :is_empty, false) io = pretty(io) print(io, "Empty affine variety over ") K = base_ring(X) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else print(io, underlying_scheme(X)) end @@ -42,13 +42,13 @@ function Base.show(io::IO, ::MIME"text/plain", X::AffineVariety) end function Base.show(io::IO, X::AffineVariety) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Affine variety") elseif get_attribute(X, :is_empty, false) io = pretty(io) print(io, "Empty affine variety over ") K = base_ring(X) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else io = pretty(io) print(io, "Affine open subset of ", Lowercase(), closure(X, ambient_space(X))) @@ -76,7 +76,7 @@ end function Base.show(io::IO, X::AffineVariety{<:Field, <:MPolyRing}) io = pretty(io) show_coord = get(io, :show_coordinates, true) - if get(io, :supercompact, false) + if is_terse(io) if is_unicode_allowed() ltx = Base.REPL_MODULE_REF.x.REPLCompletions.latex_symbols print(io, LowercaseOff(), "๐”ธ$(ltx["\\^$(dim(X))"])") @@ -86,7 +86,7 @@ function Base.show(io::IO, X::AffineVariety{<:Field, <:MPolyRing}) elseif get_attribute(X, :is_empty, false) print(io, "Empty affine space over ") K = base_ring(X) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else if is_unicode_allowed() ltx = Base.REPL_MODULE_REF.x.REPLCompletions.latex_symbols @@ -96,7 +96,7 @@ function Base.show(io::IO, X::AffineVariety{<:Field, <:MPolyRing}) print(io, ltx["\\^$d"]) end print(io, " over ") - print(IOContext(io, :supercompact => true), Lowercase(), base_ring(X)) + print(terse(io), Lowercase(), base_ring(X)) if show_coord c = coordinates(X) print(io, " with coordinate") @@ -106,7 +106,7 @@ function Base.show(io::IO, X::AffineVariety{<:Field, <:MPolyRing}) end else print(io, "Affine $(dim(X))-space over ") - print(IOContext(io, :supercompact => true), Lowercase(), base_ring(X)) + print(terse(io), Lowercase(), base_ring(X)) if show_coord c = coordinates(X) print(io, " with coordinate") diff --git a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl index 8f9c457197ec..ba8457f4cdf2 100644 --- a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Morphisms/Methods.jl @@ -186,11 +186,11 @@ end # We use a pattern for printings morphisms, gluings, etc... # -# In supercompact printing, we just write what it is, super shortly. +# In terse printing, we just write what it is, super shortly. # For normal compact printing, we mention what it is, then use colons to # describe "domain -> codomain". function Base.show(io::IO, f::AbsCoveredSchemeMorphism) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Covered scheme morphism") else io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl index ff8fc7c32536..b215a33aa684 100644 --- a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl @@ -132,7 +132,7 @@ function Base.show(io::IO, X::AbsCoveredScheme) n = n_patches(cov) if has_name(X) print(io, name(X)) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Covered scheme") else if get_attribute(X, :is_empty, false) || n == 0 @@ -140,7 +140,7 @@ function Base.show(io::IO, X::AbsCoveredScheme) else print(io, "Scheme over ") end - print(IOContext(io, :supercompact => true), Lowercase(), base_ring(X)) + print(terse(io), Lowercase(), base_ring(X)) end n > 0 && print(io, " covered with ", ItemQuantity(n, "patch")) end diff --git a/src/AlgebraicGeometry/Schemes/Covering/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/Covering/Morphisms/Methods.jl index eb405b150edd..8437b3758b14 100644 --- a/src/AlgebraicGeometry/Schemes/Covering/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/Covering/Morphisms/Methods.jl @@ -93,7 +93,7 @@ function Base.show(io::IO, f::CoveringMorphism) io = pretty(io) if get(io, :show_semi_compact, false) _show_semi_compact(io, f) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Covering morphism") else print(io, "Hom: ", Lowercase(), domain(f), " -> ", Lowercase(), codomain(f)) diff --git a/src/AlgebraicGeometry/Schemes/Covering/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/Covering/Objects/Methods.jl index 357588b91142..749247b39a45 100644 --- a/src/AlgebraicGeometry/Schemes/Covering/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/Covering/Objects/Methods.jl @@ -289,10 +289,10 @@ function Base.show(io::IO, ::MIME"text/plain", C::Covering) end function Base.show(io::IO, C::Covering) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Covering") else - print(io, "Covering with ", ItemQuantity(n_patches(C), "patch")) + print(io, "Covering with ", ItemQuantity(n_patches(C), "patch")) end end diff --git a/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl b/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl index 38582df92db5..b5912120a66b 100644 --- a/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/Gluing/Methods.jl @@ -66,7 +66,7 @@ end function Base.show(io::IO, G::AbsGluing) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Gluing") else print(io, "Gluing: ", Lowercase(), patches(G)[1], " -> ", Lowercase(), patches(G)[2]) diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveAlgebraicSet/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/ProjectiveAlgebraicSet/Objects/Methods.jl index b085fde691f9..f70ef8354463 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveAlgebraicSet/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveAlgebraicSet/Objects/Methods.jl @@ -18,7 +18,7 @@ end # If we know a radical ideal describing our algebraic set, we preferably print # that one (it is easier to read...) function Base.show(io::IO, X::AbsProjectiveAlgebraicSet{<:Field, <:MPolyQuoRing}) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Projective algebraic set") elseif get_attribute(X, :is_empty, false) print(io, "Empty projective algebraic set") diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl index 03f89ff31ec7..f3d60b82e5a1 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Morphisms/Methods.jl @@ -250,7 +250,7 @@ end function Base.show(io::IO, f::AbsProjectiveSchemeMorphism) if get(io, :show_semi_compact, false) _show_semi_compact(io, f) - elseif get(io, :supercompact, false) + elseif is_terse(io) print(io, "Projective scheme morphism") else io = pretty(io) diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl index 8eb7aa3d22fe..08ecfc9c40ab 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveSchemes/Objects/Methods.jl @@ -10,17 +10,17 @@ function Base.show(io::IO, ::MIME"text/plain", P::AbsProjectiveScheme{<:Any, <:M end function Base.show(io::IO, P::AbsProjectiveScheme{<:Any, <:MPolyQuoRing}) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Projective scheme") elseif get_attribute(P, :is_empty, false) io = pretty(io) print(io, "Empty projective scheme over ") K = base_ring(P) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else io = pretty(io) print(io, "Projective scheme in ") - print(IOContext(io, :supercompact => true), Lowercase(), ambient_space(P), " over ", Lowercase(), base_ring(P)) + print(terse(io), Lowercase(), ambient_space(P), " over ", Lowercase(), base_ring(P)) end end @@ -38,7 +38,7 @@ end function Base.show(io::IO, P::AbsProjectiveScheme{<:Any, <:MPolyDecRing}) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) if is_unicode_allowed() ltx = Base.REPL_MODULE_REF.x.REPLCompletions.latex_symbols print(io, LowercaseOff(), "โ„™$(ltx["\\^$(relative_ambient_dimension(P))"])") @@ -48,7 +48,7 @@ function Base.show(io::IO, P::AbsProjectiveScheme{<:Any, <:MPolyDecRing}) elseif get_attribute(P, :is_empty, false) print(io, "Empty projective space over ") K = base_ring(P) - print(IOContext(io, :supercompact => true), Lowercase(), K) + print(terse(io), Lowercase(), K) else if is_unicode_allowed() ltx = Base.REPL_MODULE_REF.x.REPLCompletions.latex_symbols @@ -58,10 +58,10 @@ function Base.show(io::IO, P::AbsProjectiveScheme{<:Any, <:MPolyDecRing}) print(io, ltx["\\^$d"]) end print(io, " over ") - print(IOContext(io, :supercompact => true), Lowercase(), base_ring(P)) + print(terse(io), Lowercase(), base_ring(P)) else print(io, "Projective $(relative_ambient_dimension(P))-space over ") - print(IOContext(io, :supercompact => true), Lowercase(), base_ring(P)) + print(terse(io), Lowercase(), base_ring(P)) c = homogeneous_coordinates(P) print(io, " with coordinate") length(c) != 1 && print(io, "s") diff --git a/src/AlgebraicGeometry/Schemes/ProjectiveVariety/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/ProjectiveVariety/Objects/Methods.jl index 250ac46d5c86..8e382c2bddd6 100644 --- a/src/AlgebraicGeometry/Schemes/ProjectiveVariety/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/ProjectiveVariety/Objects/Methods.jl @@ -12,7 +12,7 @@ end # one line printing function Base.show(io::IO, X::AbsProjectiveVariety{<:Field,<:MPolyQuoRing}) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Projective variety") elseif get_attribute(X, :is_empty, false) print(io, "Empty projective variety") diff --git a/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl b/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl index 65af5b0e59e1..17c1e9e8e35e 100644 --- a/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl +++ b/src/Combinatorics/EnumerativeCombinatorics/tableaux.jl @@ -57,7 +57,6 @@ young_tableau(v::Vector{Vector{T}}; check::Bool = true) where T <: IntegerUnion data(tab::YoungTableau) = tab.t -# supercompact and one-line printing function Base.show(io::IO, tab::YoungTableau) print(io, "Young tableau") # TODO: is there meaningful information to add in one-line mode? diff --git a/src/Combinatorics/EnumerativeCombinatorics/weak_compositions.jl b/src/Combinatorics/EnumerativeCombinatorics/weak_compositions.jl index be5f878fef1a..ecfb149a70ee 100644 --- a/src/Combinatorics/EnumerativeCombinatorics/weak_compositions.jl +++ b/src/Combinatorics/EnumerativeCombinatorics/weak_compositions.jl @@ -177,7 +177,7 @@ function Base.iterate(W::WeakCompositions{T}, s::Vector{T}) where T end function Base.show(io::IO, W::WeakCompositions) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Iterator") else io = pretty(io) diff --git a/src/Combinatorics/Graphs/functions.jl b/src/Combinatorics/Graphs/functions.jl index bc668c2c1999..44501f9d3652 100644 --- a/src/Combinatorics/Graphs/functions.jl +++ b/src/Combinatorics/Graphs/functions.jl @@ -1075,7 +1075,7 @@ function Base.show(io::IO, ::MIME"text/plain", G::Graph{T}) where {T <: Union{Po end function Base.show(io::IO, G::Graph{T}) where {T <: Union{Polymake.Directed, Polymake.Undirected}} - if get(io, :supercompact, false) + if is_terse(io) print(io, "$(_to_string(T)) graph") else print(io, "$(_to_string(T)) graph with $(n_vertices(G)) nodes and $(n_edges(G)) edges") diff --git a/src/Groups/GAPGroups.jl b/src/Groups/GAPGroups.jl index e3f0cf7d15b7..ec096929ce06 100644 --- a/src/Groups/GAPGroups.jl +++ b/src/Groups/GAPGroups.jl @@ -265,7 +265,7 @@ function Base.show(io::IO, G::GAPGroup) @show_name(io, G) @show_special(io, G) print(io, "Group") - if !get(io, :supercompact, false) + if !is_terse(io) if has_order(G) if is_finite(G) print(io, " of order ", order(G)) @@ -281,12 +281,12 @@ function Base.show(io::IO, G::FPGroup) @show_special(io, G) if GAPWrap.IsFreeGroup(GapObj(G)) print(io, "Free group") - if !get(io, :supercompact, false) && GAP.Globals.HasRankOfFreeGroup(GapObj(G))::Bool + if !is_terse(io) && GAP.Globals.HasRankOfFreeGroup(GapObj(G))::Bool print(io, " of rank ", GAP.Globals.RankOfFreeGroup(GapObj(G))::Int) end else print(io, "Finitely presented group") # FIXME: actually some of these groups are *not* finitely presented - if !get(io, :supercompact, false) + if !is_terse(io) if has_order(G) if is_finite(G) print(io, " of order ", order(G)) @@ -312,7 +312,7 @@ function Base.show(io::IO, G::PermGroup) print(io, LowercaseOff(), "Alt(", degree(G), ")") else print(io, "Permutation group") - if !get(io, :supercompact, false) + if !is_terse(io) print(io, " of degree ", degree(G)) if has_order(G) if is_finite(G) @@ -334,7 +334,7 @@ function Base.show(io::IO, G::PcGroup) @show_name(io, G) @show_special(io, G) print(io, "Pc group") - if !get(io, :supercompact, false) + if !is_terse(io) if isfinite(G) print(io, " of order ", order(G)) else @@ -566,7 +566,7 @@ function Base.show(io::IO, ::MIME"text/plain", x::GAPGroupConjClass) end function Base.show(io::IO, x::GAPGroupConjClass{T, S}) where T where S - if get(io, :supercompact, false) + if is_terse(io) if S <: GAPGroupElem print(io, "Conjugacy class of group elements") else @@ -575,7 +575,7 @@ function Base.show(io::IO, x::GAPGroupConjClass{T, S}) where T where S else print(io, "Conjugacy class of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.repr, " in ", Lowercase(), acting_group(x)) + print(terse(io), Lowercase(), x.repr, " in ", Lowercase(), acting_group(x)) end end diff --git a/src/Groups/cosets.jl b/src/Groups/cosets.jl index 827eaeb79630..02e135e62ebf 100644 --- a/src/Groups/cosets.jl +++ b/src/Groups/cosets.jl @@ -39,12 +39,12 @@ end function Base.show(io::IO, x::GroupCoset) side = x.side === :left ? "Left" : "Right" - if get(io, :supercompact, false) + if is_terse(io) print(io, "$side coset of a group") else print(io, "$side coset of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.H, " with representative ", x.repr) + print(terse(io), Lowercase(), x.H, " with representative ", x.repr) end end @@ -329,12 +329,12 @@ end function Base.show(io::IO, x::SubgroupTransversal) side = x.side === :left ? "Left" : "Right" - if get(io, :supercompact, false) + if is_terse(io) print(io, "$side transversal of groups") else print(io, "$side transversal of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.H, " in ", Lowercase(), x.G) + print(terse(io), Lowercase(), x.H, " in ", Lowercase(), x.G) end end @@ -480,12 +480,12 @@ function Base.show(io::IO, ::MIME"text/plain", x::GroupDoubleCoset) end function Base.show(io::IO, x::GroupDoubleCoset) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Double coset of a group") else print(io, "Double coset of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.H, + print(terse(io), Lowercase(), x.H, " and ", Lowercase(), x.K, " with representative ", x.repr) end end diff --git a/src/Groups/group_characters.jl b/src/Groups/group_characters.jl index 8a42a8da4f5a..427a3ed3ff24 100644 --- a/src/Groups/group_characters.jl +++ b/src/Groups/group_characters.jl @@ -625,17 +625,14 @@ function matrix_of_strings(tbl::GAPGroupCharacterTable; alphabet::String = "", r return (m, legend) end -# supercompact and one-line printing function Base.show(io::IO, tbl::GAPGroupCharacterTable) - if get(io, :supercompact, false) - # no nested printing + if is_terse(io) if characteristic(tbl) == 0 print(io, "character table of a group") else print(io, "$(characteristic(tbl))-modular Brauer table of a group") end else - # nested printing allowed, preferably supercompact if isdefined(tbl, :group) if characteristic(tbl) == 0 print(io, "character table of ") @@ -643,7 +640,7 @@ function Base.show(io::IO, tbl::GAPGroupCharacterTable) print(io, "$(characteristic(tbl))-modular Brauer table of ") end io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), group(tbl)) + print(terse(io), Lowercase(), group(tbl)) elseif characteristic(tbl) == 0 print(io, "character table of ", identifier(tbl)) else diff --git a/src/Groups/gsets.jl b/src/Groups/gsets.jl index e973645744f1..a81bfa3074bf 100644 --- a/src/Groups/gsets.jl +++ b/src/Groups/gsets.jl @@ -60,12 +60,12 @@ function Base.show(io::IO, ::MIME"text/plain", x::GSetByElements) end function Base.show(io::IO, x::GSetByElements) - if get(io, :supercompact, false) + if is_terse(io) print(io, "G-set") else print(io, "G-set of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.group, " with seeds ", x.seeds) + print(terse(io), Lowercase(), x.group, " with seeds ", x.seeds) end end @@ -541,12 +541,12 @@ end function Base.show(io::IO, x::GSetBySubgroupTransversal) side = (x.side == :right ? "Right" : "Left") - if get(io, :supercompact, false) + if is_terse(io) print(io, "$side cosets of groups") else print(io, "$side cosets of ") io = pretty(io) - print(IOContext(io, :supercompact => true), Lowercase(), x.subgroup, " in ", Lowercase(), x.group) + print(terse(io), Lowercase(), x.subgroup, " in ", Lowercase(), x.group) end end diff --git a/src/Groups/homomorphisms.jl b/src/Groups/homomorphisms.jl index 95b21f189792..0c02cfef444d 100644 --- a/src/Groups/homomorphisms.jl +++ b/src/Groups/homomorphisms.jl @@ -1,10 +1,10 @@ function Base.show(io::IO, x::GAPGroupHomomorphism) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Group homomorphism") else io = pretty(io) print(io, "Hom: ") - print(IOContext(io, :supercompact => true), Lowercase(), domain(x), " -> ", Lowercase(), codomain(x)) + print(terse(io), Lowercase(), domain(x), " -> ", Lowercase(), codomain(x)) end end diff --git a/src/Groups/matrices/MatGrp.jl b/src/Groups/matrices/MatGrp.jl index 439147c289a6..63dd8301e45c 100644 --- a/src/Groups/matrices/MatGrp.jl +++ b/src/Groups/matrices/MatGrp.jl @@ -118,7 +118,7 @@ function _print_matrix_group_desc(io::IO, x::MatrixGroup) elseif x.ring isa Field && is_finite(x.ring) print(io, order(x.ring),")") else - print(IOContext(io, :supercompact => true), x.ring) + print(terse(io), x.ring) print(io ,")") end end @@ -137,10 +137,10 @@ function Base.show(io::IO, x::MatrixGroup) @show_special(io, x) isdefined(x, :descr) && return _print_matrix_group_desc(io, x) print(io, "Matrix group") - if !get(io, :supercompact, false) + if !is_terse(io) print(io, " of degree ", degree(x)) io = pretty(io) - print(IOContext(io, :supercompact => true), " over ", Lowercase(), base_ring(x)) + print(terse(io), " over ", Lowercase(), base_ring(x)) end end diff --git a/src/InvariantTheory/invariant_rings.jl b/src/InvariantTheory/invariant_rings.jl index fe7fee51758b..478438222f4c 100644 --- a/src/InvariantTheory/invariant_rings.jl +++ b/src/InvariantTheory/invariant_rings.jl @@ -138,12 +138,12 @@ function Base.show(io::IO, ::MIME"text/plain", RG::FinGroupInvarRing) end function Base.show(io::IO, RG::FinGroupInvarRing) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Invariant ring") else io = pretty(io) print(io, "Invariant ring of ") - print(IOContext(io, :supercompact => true), Lowercase(), group(RG)) + print(terse(io), Lowercase(), group(RG)) end end diff --git a/src/InvariantTheory/iterators.jl b/src/InvariantTheory/iterators.jl index d4da8c6d3a99..eef9e028a735 100644 --- a/src/InvariantTheory/iterators.jl +++ b/src/InvariantTheory/iterators.jl @@ -91,12 +91,12 @@ function Base.show(io::IO, ::MIME"text/plain", AM::AllMonomials) end function Base.show(io::IO, AM::AllMonomials) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Iterator") else io = pretty(io) print(io, "Iterator over the monomials of degree $(AM.d) of") - print(IOContext(io, :supercompact => true), Lowercase(), AM.R) + print(terse(io), Lowercase(), AM.R) end end @@ -405,12 +405,12 @@ function Base.show(io::IO, ::MIME"text/plain", BI::FinGroupInvarRingBasisIterato end function Base.show(io::IO, BI::FinGroupInvarRingBasisIterator) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Iterator") else io = pretty(io) print(io, "Iterator over a graded component of ") - print(IOContext(io, :supercompact => true), Lowercase(), BI.R) + print(terse(io), Lowercase(), BI.R) end end diff --git a/src/Rings/MPolyMap/MPolyAnyMap.jl b/src/Rings/MPolyMap/MPolyAnyMap.jl index e8a67a182282..784727bccc0c 100644 --- a/src/Rings/MPolyMap/MPolyAnyMap.jl +++ b/src/Rings/MPolyMap/MPolyAnyMap.jl @@ -82,7 +82,7 @@ _images(f::MPolyAnyMap) = f.img_gens ################################################################################ function Base.show(io::IO, ::MIME"text/plain", f::MPolyAnyMap) io = pretty(io) - println(IOContext(io, :supercompact => true), f) + println(terse(io), f) print(io, Indent()) println(io, "from ", Lowercase(), domain(f)) println(io, "to ", Lowercase(), codomain(f)) @@ -104,14 +104,12 @@ end function Base.show(io::IO, f::MPolyAnyMap) io = pretty(io) - if get(io, :supercompact, false) - # no nested printing + if is_terse(io) print(io, "Ring homomorphism") else - # nested printing allowed, preferably supercompact print(io, "Hom: ") - print(IOContext(io, :supercompact => true), Lowercase(), domain(f), " -> ") - print(IOContext(io, :supercompact => true), Lowercase(), codomain(f)) + print(terse(io), Lowercase(), domain(f), " -> ") + print(terse(io), Lowercase(), codomain(f)) end end diff --git a/src/Rings/MPolyQuo.jl b/src/Rings/MPolyQuo.jl index 24ad06baf7ca..c3b019cd1d05 100644 --- a/src/Rings/MPolyQuo.jl +++ b/src/Rings/MPolyQuo.jl @@ -51,7 +51,7 @@ end function Base.show(io::IO, Q::MPolyQuoRing) @show_name(io, Q) @show_special(io, Q) - if get(io, :supercompact, false) + if is_terse(io) # no nested printing print(io, "Quotient of multivariate polynomial ring") else diff --git a/src/Rings/localization_interface.jl b/src/Rings/localization_interface.jl index 463b85b56ecd..ee1b5a1b2e5a 100644 --- a/src/Rings/localization_interface.jl +++ b/src/Rings/localization_interface.jl @@ -414,7 +414,7 @@ end function Base.show(io::IO, W::AbsLocalizedRing) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Localized ring") else print(io, "Localization of ", Lowercase(), base_ring(W)) diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index 42e0267e23f7..2a81d22a79be 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -85,15 +85,13 @@ function Base.show(io::IO, W::MPolyDecRing) Hecke.@show_name(io, W) Hecke.@show_special(io, W) io = pretty(io) - if get(io, :supercompact, false) - # no nested printing + if is_terse(io) if is_filtered(W) print(io, "Filtered multivariate polynomial ring") else print(io, "Graded multivariate polynomial ring") end else - # nested printing allowed, preferably supercompact R = forget_decoration(W) if is_filtered(W) print(io, "Filtered ", Lowercase(), R) diff --git a/src/Rings/mpoly-localizations.jl b/src/Rings/mpoly-localizations.jl index c64ce0297e66..d04ff7259f4d 100644 --- a/src/Rings/mpoly-localizations.jl +++ b/src/Rings/mpoly-localizations.jl @@ -60,8 +60,7 @@ function Base.show(io::IO, ::MIME"text/plain", S::MPolyPowersOfElement) end function Base.show(io::IO, S::MPolyPowersOfElement) - # no need for supercompact printing - if get(io, :supercompact, false) + if is_terse(io) print(io, "Products of ") print(io, ItemQuantity(length(denominators(S)), "element")) else @@ -207,7 +206,7 @@ function Base.show(io::IO, ::MIME"text/plain", S::MPolyComplementOfPrimeIdeal) end function Base.show(io::IO, S::MPolyComplementOfPrimeIdeal) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Complement of prime ideal") else io = pretty(io) @@ -360,7 +359,7 @@ function Base.show(io::IO, ::MIME"text/plain", S::MPolyComplementOfKPointIdeal) end function Base.show(io::IO, S::MPolyComplementOfKPointIdeal) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Complement of maximal ideal") else print(io, "Complement of maximal ideal of point ") @@ -436,12 +435,12 @@ end function Base.show(io::IO, S::MPolyProductOfMultSets) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Product of multiplicatively closed subsets") else print(io, "Product of the multiplicative subsets [") for s in sets(S) - print(IOContext(io, :supercompact=>true), Lowercase(), s) + print(terse(io), Lowercase(), s) s !== last(sets(S)) && print(io, ", ") end print(io, "]") @@ -496,11 +495,11 @@ end function Base.show(io::IO, S::MPolyLeadingMonOne) io = pretty(io) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Elements with leading monomial 1") else print(io, "Elements with leading monomial 1 w.r.t. ") - print(IOContext(io, :supercompact=>true), ordering(S)) + print(terse(io), ordering(S)) end end @@ -2297,7 +2296,7 @@ julia> (PSI, ) """ function Base.show(io::IO, ::MIME"text/plain", phi::MPolyLocalizedRingHom) io = pretty(io) - println(IOContext(io, :supercompact => true), phi) + println(terse(io), phi) print(io, Indent()) println(io, "from ", Lowercase(), domain(phi)) println(io, "to ", Lowercase(), codomain(phi)) @@ -2314,13 +2313,13 @@ function Base.show(io::IO, ::MIME"text/plain", phi::MPolyLocalizedRingHom) end function Base.show(io::IO, phi::MPolyLocalizedRingHom) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Ring homomorphism") else R = base_ring(domain(phi)) psi = restricted_map(phi) io = pretty(io) - io = IOContext(io, :supercompact=>true) + io = terse(io) print(io, "hom: ", domain(phi)) if is_unicode_allowed() print(io, " โ†’ ") diff --git a/src/Rings/mpolyquo-localizations.jl b/src/Rings/mpolyquo-localizations.jl index 3a1318d3336e..53737bb8f85c 100644 --- a/src/Rings/mpolyquo-localizations.jl +++ b/src/Rings/mpolyquo-localizations.jl @@ -220,10 +220,10 @@ function Base.show(io::IO, ::MIME"text/plain", L::MPolyQuoLocRing) end function Base.show(io::IO, L::MPolyQuoLocRing) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Localized quotient of multivariate polynomial ring") else - io = IOContext(pretty(io), :supercompact=>true) + io = terse(pretty(io)) print(io, "Localization of ") print(io, Lowercase(), underlying_quotient(L)) print(io, " at ", Lowercase(), inverted_set(L)) @@ -1173,7 +1173,7 @@ end ### printing function Base.show(io::IO, ::MIME"text/plain", phi::MPolyQuoLocalizedRingHom) io = pretty(io) - println(IOContext(io, :supercompact => true), phi) + println(terse(io), phi) print(io, Indent()) println(io, "from ", Lowercase(), domain(phi)) println(io, "to ", Lowercase(), codomain(phi)) @@ -1190,13 +1190,13 @@ function Base.show(io::IO, ::MIME"text/plain", phi::MPolyQuoLocalizedRingHom) end function Base.show(io::IO, phi::MPolyQuoLocalizedRingHom) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Ring homomorphism") else R = base_ring(domain(phi)) psi = restricted_map(phi) io = pretty(io) - io = IOContext(io, :supercompact=>true) + io = terse(io) print(io, "hom: ", domain(phi)) if is_unicode_allowed() print(io, " โ†’ ") @@ -1915,7 +1915,7 @@ function _get_generators_string_one_line(I::MPolyAnyIdeal, character_limit::Int end function Base.show(io::IO, I::MPolyAnyIdeal) - if get(io, :supercompact, false) + if is_terse(io) print(io, "Ideal") else print(io, "Ideal ", _get_generators_string_one_line(I)) diff --git a/src/imports.jl b/src/imports.jl index 19211835d0d2..70773c6e2745 100644 --- a/src/imports.jl +++ b/src/imports.jl @@ -86,6 +86,7 @@ import AbstractAlgebra: Ideal, Indent, is_finite_order, + is_terse, is_trivial, is_unicode_allowed, Lowercase, @@ -113,6 +114,7 @@ import AbstractAlgebra: set_attribute!, SetMap, symbols, + terse, total_degree, with_unicode diff --git a/test/Groups/group_characters.jl b/test/Groups/group_characters.jl index 71a0a1592a6b..e9ae2263853a 100644 --- a/test/Groups/group_characters.jl +++ b/test/Groups/group_characters.jl @@ -50,18 +50,18 @@ julia> show([t_a5_2]) Oscar.GAPGroupCharacterTable[2-modular Brauer table of A5] ``` -supercompact printing +terse printing ```jldoctest group_characters.test -julia> print(IOContext(stdout, :supercompact => true), t_a4) +julia> print(AbstractAlgebra.terse(stdout), t_a4) character table of a group -julia> print(IOContext(stdout, :supercompact => true), t_a5) +julia> print(AbstractAlgebra.terse(stdout), t_a5) character table of a group -julia> print(IOContext(stdout, :supercompact => true), t_a4_2) +julia> print(AbstractAlgebra.terse(stdout), t_a4_2) 2-modular Brauer table of a group -julia> print(IOContext(stdout, :supercompact => true), t_a5_2) +julia> print(AbstractAlgebra.terse(stdout), t_a5_2) 2-modular Brauer table of a group ```