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

overload 2 arg show for probs and sols #465

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions src/problems/problem_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
type_color, isinplace(prob),
no_color)
end
Base.show(io::IO, A::AbstractSciMLProblem) = show(io, MIME"text/plain", A)

Check warning on line 42 in src/problems/problem_utils.jl

View check run for this annotation

Codecov / codecov/patch

src/problems/problem_utils.jl#L42

Added line #L42 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this pretty much goes against the default and expected behaviour of show, see eg https://docs.julialang.org/en/v1/manual/types/#man-custom-pretty-printing. The two args method should print a compact one-line representation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. The 2 arg version shouldn't have the line breaks. I'll take another pass on this tomorrow (that also removes the redundancy of all the show methods.)

function Base.show(io::IO, mime::MIME"text/plain", A::AbstractLinearProblem)
summary(io, A)
println(io)
Expand Down
2 changes: 2 additions & 0 deletions src/solutions/solution_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@
type_color, eltype(A.t), no_color)
end


Base.show(io::IO, A::AbstractSciMLProblem) = show(io, MIME"text/plain", A)

Check warning on line 204 in src/solutions/solution_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/solutions/solution_interface.jl#L204

Added line #L204 was not covered by tests
function Base.show(io::IO, m::MIME"text/plain", A::AbstractTimeseriesSolution)
println(io, string("retcode: ", A.retcode))
println(io, string("Interpolation: "), interp_summary(A.interp))
Expand Down
Loading