Skip to content

Commit

Permalink
Improve one line printing of GenericCyclotomicFractions
Browse files Browse the repository at this point in the history
  • Loading branch information
SoongNoonien committed Nov 11, 2024
1 parent 387dbad commit 8a06a87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/GenericCyclotomicFractions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ function shrink(a::GenericCycloFrac) # TODO Move this to the constructor of Gen
return GenericCycloFrac(new_numerator, new_denominator, a.exceptions, simplify=false)
end

function show(io::IO, x::GenericCycloFrac)
function show(io::IO, ::MIME"text/plain", x::GenericCycloFrac)

Check warning on line 72 in src/GenericCyclotomicFractions.jl

View check run for this annotation

Codecov / codecov/patch

src/GenericCyclotomicFractions.jl#L72

Added line #L72 was not covered by tests
io=pretty(io)
print(io, x)
if is_restriction(x.exceptions)
print(io, "\nWith exceptions:\n", Indent())
print(io, x.exceptions)
print(io, Dedent())

Check warning on line 78 in src/GenericCyclotomicFractions.jl

View check run for this annotation

Codecov / codecov/patch

src/GenericCyclotomicFractions.jl#L74-L78

Added lines #L74 - L78 were not covered by tests
end
end

function show(io::IO, x::GenericCycloFrac)

Check warning on line 82 in src/GenericCyclotomicFractions.jl

View check run for this annotation

Codecov / codecov/patch

src/GenericCyclotomicFractions.jl#L82

Added line #L82 was not covered by tests
if isone(x.denominator)
print(io, "$(x.numerator)")
else
Expand All @@ -90,11 +99,6 @@ function show(io::IO, x::GenericCycloFrac)
print(io, "($(x.denominator))")
end
end
if is_restriction(x.exceptions)
print(io, "\nWith exceptions:\n", Indent())
print(io, x.exceptions)
print(io, Dedent())
end
end

isone(x::GenericCycloFrac) = isone(x.numerator) && isone(x.denominator)
Expand Down
1 change: 0 additions & 1 deletion src/Parameter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function Parameters(p::Vector{Parameter})
return Parameters(p,UPolyFrac[])
end

# TODO Use OSCAR's expressify system here.
function show(io::IO, a::Parameters)
print(io, join(a.params, ", "))
if !isempty(a.exceptions)
Expand Down

0 comments on commit 8a06a87

Please sign in to comment.