Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
graph_drawing
Commits
bea696ab
Commit
bea696ab
authored
Dec 01, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved magic methods from ExpressionNode to Node.
parent
e377e758
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
node.py
node.py
+17
-6
No files found.
node.py
View file @
bea696ab
...
...
@@ -2,8 +2,12 @@
class
Node
(
object
):
def
__init__
(
self
,
label
,
*
nodes
):
self
.
label
,
self
.
nodes
=
label
,
list
(
nodes
)
def
__init__
(
self
,
value
,
*
nodes
):
self
.
value
,
self
.
nodes
=
value
,
list
(
nodes
)
self
.
parent
=
None
for
a
in
self
.
nodes
:
a
.
parent
=
self
def
__getitem__
(
self
,
n
):
return
self
.
nodes
[
n
]
...
...
@@ -18,12 +22,19 @@ class Node(object):
return
len
(
self
.
nodes
)
def
title
(
self
):
return
str
(
self
.
label
)
return
str
(
self
.
value
)
class
Leaf
(
object
):
def
__init__
(
self
,
label
):
self
.
label
=
label
def
__init__
(
self
,
value
):
self
.
value
=
value
self
.
parent
=
None
def
__repr__
(
self
):
return
repr
(
self
.
value
)
def
__str__
(
self
):
return
str
(
self
.
value
)
def
title
(
self
):
return
str
(
self
.
label
)
return
str
(
self
.
value
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment