Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
trs
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
trs
Commits
b7a6d95d
Commit
b7a6d95d
authored
13 years ago
by
Sander Mathijs van Veen
Committed by
Taddeus Kroes
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Validation now iterates over best possibilities instead of best indices.
parent
e4b29aa3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/possibilities.py
+1
-0
1 addition, 0 deletions
src/possibilities.py
src/validation.py
+7
-5
7 additions, 5 deletions
src/validation.py
with
8 additions
and
5 deletions
src/possibilities.py
+
1
−
0
View file @
b7a6d95d
...
@@ -122,6 +122,7 @@ def pick_best_possibility(parser, possibilities):
...
@@ -122,6 +122,7 @@ def pick_best_possibility(parser, possibilities):
def
traverse_breadth_first
(
node
,
result
,
depth
=
0
):
def
traverse_breadth_first
(
node
,
result
,
depth
=
0
):
if
depth
>
MAX_TREE_DEPTH
:
if
depth
>
MAX_TREE_DEPTH
:
print
'
warning: Aborting because MAX_TREE_DEPTH is reached.
'
return
return
node_expr
=
str
(
node
)
node_expr
=
str
(
node
)
...
...
This diff is collapsed.
Click to expand it.
src/validation.py
+
7
−
5
View file @
b7a6d95d
...
@@ -18,16 +18,18 @@ def validate(exp, result):
...
@@ -18,16 +18,18 @@ def validate(exp, result):
node_expr
=
str
(
node
)
node_expr
=
str
(
node
)
possibilities
=
find_possibilities
(
node
)
# If a best possibility chain of rewrite steps is discovered before,
# use the corresponding possibility index of that chain instead.
if
node_expr
in
BEST_POSSIBILITY_CACHE
:
if
node_expr
in
BEST_POSSIBILITY_CACHE
:
p
ossibility_index
=
BEST_POSSIBILITY_CACHE
[
node_expr
]
p
=
BEST_POSSIBILITY_CACHE
[
node_expr
]
# If there is no possible rewrite step, bail out
# If there is no possible rewrite step, bail out
if
p
ossibility_index
is
None
:
if
p
is
None
:
return
False
return
False
possibilities
=
[
possibility_index
]
possibilities
=
possibilities
[
p
]
else
:
possibilities
=
find_possibilities
(
node
)
for
p
in
possibilities
:
for
p
in
possibilities
:
# Clone the root node because it will be used in multiple
# Clone the root node because it will be used in multiple
...
...
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