Skip to content

Commit

Permalink
Fix py2.X issue
Browse files Browse the repository at this point in the history
  • Loading branch information
c0fec0de committed Mar 13, 2017
1 parent ef42ff3 commit 1b469e4
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions anytree/walker.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# -*- coding: utf-8 -*-

import six


@six.python_2_unicode_compatible
class Walker(object):

def __init__(self):
"""Walk from one node to another."""
super(Walker, self).__init__()

def walk(self, start, end):
u"""
"""
Walk from `start` node to `end` node.
Returns:
Expand All @@ -21,7 +18,7 @@ def walk(self, start, end):
Raises:
WalkError: on no common root node.
>>> from anytree import Node, RenderTree
>>> from anytree import Node, RenderTree, AsciiStyle
>>> f = Node("f")
>>> b = Node("b", parent=f)
>>> a = Node("a", parent=b)
Expand All @@ -31,16 +28,16 @@ def walk(self, start, end):
>>> g = Node("g", parent=f)
>>> i = Node("i", parent=g)
>>> h = Node("h", parent=i)
>>> print(RenderTree(f))
>>> print(RenderTree(f, style=AsciiStyle()))
Node('/f')
├── Node('/f/b')
├── Node('/f/b/a')
└── Node('/f/b/d')
├── Node('/f/b/d/c')
└── Node('/f/b/d/e')
└── Node('/f/g')
└── Node('/f/g/i')
└── Node('/f/g/i/h')
|-- Node('/f/b')
| |-- Node('/f/b/a')
| +-- Node('/f/b/d')
| |-- Node('/f/b/d/c')
| +-- Node('/f/b/d/e')
+-- Node('/f/g')
+-- Node('/f/g/i')
+-- Node('/f/g/i/h')
Create a walker:
Expand Down

0 comments on commit 1b469e4

Please sign in to comment.