Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
e1bbce4c
Commit
e1bbce4c
authored
8 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Use a slightly cleaner approach to fix ConditionDict for True/False
parent
ff7b045f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/perftool/generation/cache.py
+8
-13
8 additions, 13 deletions
python/dune/perftool/generation/cache.py
with
8 additions
and
13 deletions
python/dune/perftool/generation/cache.py
+
8
−
13
View file @
e1bbce4c
...
@@ -196,19 +196,14 @@ class _ConditionDict(dict):
...
@@ -196,19 +196,14 @@ class _ConditionDict(dict):
self
.
tags
=
tags
self
.
tags
=
tags
def
__getitem__
(
self
,
i
):
def
__getitem__
(
self
,
i
):
# If we do not add these special cases the dictionary will return False
# We first evaluate the given string with eval. This is necessary
# when we execute the following code:
# to ensure that 'True' and 'False' are correctly evaluated. Only
#
# if this failed with a NameError, we check for the existence of
# eval ("True", _ConditionDict(v.tags)
# of the given string in the tag list.
#
try
:
# But in this case we want to return True! A normal dictionary would not attempt
return
eval
(
i
)
# to replace "True" if "True" is not a key. The _ConditionDict obviously has no
except
NameError
:
# such concerns ;).
return
i
in
self
.
tags
if
i
==
"
True
"
:
return
True
if
i
==
"
False
"
:
return
False
return
i
in
self
.
tags
def
_filter_cache_items
(
condition
):
def
_filter_cache_items
(
condition
):
...
...
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