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

remove deprecated AbstractTrees calls #494

Merged
merged 1 commit into from Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
@@ -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
@@ -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