Skip to content

Commit

Permalink
remove deprecated AbstractTrees calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ExpandingMan committed May 31, 2022
1 parent 3d89dde commit f45853e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Convex"
uuid = "f65535da-76fb-5f13-bab9-19810c17039a"
version = "0.15.1"
version = "0.15.2"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -13,7 +13,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
AbstractTrees = "0.2, 0.3"
AbstractTrees = "0.2, 0.3, 0.4"
BenchmarkTools = "1"
ECOS = "1"
GLPK = "1"
Expand Down
19 changes: 8 additions & 11 deletions src/utilities/tree_print.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This module is needed until AbstractTrees.jl#37 is fixed.
# (PR: https://github.com/Keno/AbstractTrees.jl/pull/38)
# because currently `print_tree` does not respect `maxdepth`.
# This just implements the changes in the above PR.
# This module originally existed for AbstractTrees.jl#37,
# but has since diverged from the functionality of
# AbstractTrees.print_tree. It is now a separate implementation
# of tree printing
# Code in this file is modified from AbstractTrees.jl
# See LICENSE for a copy of its MIT license.
module TreePrint

using AbstractTrees: printnode, treekind, IndexedTree, children
using AbstractTrees: children, printnode

# Printing
struct TreeCharSet
Expand Down Expand Up @@ -83,19 +83,16 @@ function _print_tree(
if withinds
printnode(nodebuf, tree, inds)
else
tree != roottree && isa(treekind(roottree), IndexedTree) ?
printnode(nodebuf, roottree[tree]) : printnode(nodebuf, tree)
printnode(nodebuf, tree)
end
str = String(take!(isa(nodebuf, IOContext) ? nodebuf.io : nodebuf))
for (i, line) in enumerate(split(str, '\n'))
i != 1 && print_prefix(io, depth, charset, active_levels)
println(io, line)
end
depth > maxdepth && return
c =
isa(treekind(roottree), IndexedTree) ? childindices(roottree, tree) :
children(roottree, tree)
if c !== ()
c = children(tree)
if !isempty(c)
width = 0
s = Iterators.Stateful(
from === nothing ? pairs(c) : Iterators.Rest(pairs(c), from),
Expand Down

0 comments on commit f45853e

Please sign in to comment.