Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graph_drawing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
graph_drawing
Commits
e4a17ba8
Commit
e4a17ba8
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added negation to Leaf representation.
parent
122476b1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node.py
+7
-7
7 additions, 7 deletions
node.py
with
7 additions
and
7 deletions
node.py
+
7
−
7
View file @
e4a17ba8
...
...
@@ -22,14 +22,14 @@ class Node(object):
return
len
(
self
.
nodes
)
def
__eq__
(
self
,
node
):
return
isinstance
(
node
,
Node
)
\
and
self
.
value
==
node
.
value
and
self
.
nodes
==
node
.
nodes
return
isinstance
(
node
,
Node
)
and
self
.
value
==
node
.
value
\
and
self
.
nodes
==
node
.
nodes
def
__neg__
(
self
):
cop
y
=
deepcopy
(
self
)
cop
y
.
negated
+=
1
cop
ied
=
deepcopy
(
self
)
cop
ied
.
negated
+=
1
return
cop
y
return
cop
ied
def
__str__
(
self
):
return
'
<Node value=%s nodes=%s negated=%d>
'
\
...
...
@@ -50,7 +50,7 @@ class Leaf(Node):
return
len
(
str
(
self
.
value
))
def
__repr__
(
self
):
return
repr
(
self
.
value
)
return
repr
(
'
-
'
*
self
.
negated
+
str
(
self
.
value
)
)
def
__str__
(
self
):
return
'
-
'
*
self
.
negated
+
str
(
self
.
value
)
return
'
<Leaf %s>
'
%
repr
(
self
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment