Skip to content

Commit

Permalink
fix stacktrace too long (JuliaHEP#149)
Browse files Browse the repository at this point in the history
* fix stacktrace too long

* fix stacktrace too long try 2

* fix stacktrace too long try 3

* fix before 1.6
  • Loading branch information
Moelf committed Jun 23, 2022
1 parent fefe821 commit 0180410
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/UnROOT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import LibDeflate: zlib_decompress!, Decompressor
import Tables, TypedTables, PrettyTables

@static if VERSION < v"1.6"
Base.first(itr, n::Integer) = collect(Iterators.take(itr, n))
Base.first(a::AbstractVector{S}, n::Integer) where S<: AbstractString = a[1:(length(a) > n ? n : end)]
Base.first(a::S, n::Integer) where S<: AbstractString = a[1:(length(a) > n ? n : end)]
end
Expand Down
9 changes: 9 additions & 0 deletions src/displays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ function _show(io::IO, tree::LazyTree; kwargs...)
)
nothing
end

# stop crazy stracktrace
function Base.show(io::IO,
::Type{<:LazyTree{<:UnROOT.TypedTables.Table{NamedTuple{Ns, Vs}}}}) where {T, Ns, Vs}
elip = length(Ns) > 5 ? "..." : ""
println(io, "LazyTree with $(length(Ns)) branches:")
println(io, join(first(Ns, 5), ", "), elip)
end

function Base.show(io::IO, ::MIME"text/html", tree::LazyTree)
_hs = _make_header(tree)
maxrows = 10
Expand Down

0 comments on commit 0180410

Please sign in to comment.