Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mkexp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esmenv
mkexp
Commits
d89bcaff
Commit
d89bcaff
authored
3 years ago
by
Karl-Hermann Wieners
Browse files
Options
Downloads
Patches
Plain Diff
Config: added configurable hiding (disabling) of namelist files
parent
5f9f2b70
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
CHANGES.txt
+1
-0
1 addition, 0 deletions
CHANGES.txt
doc/mkexp.fodt
+810
-776
810 additions, 776 deletions
doc/mkexp.fodt
doc/mkexp.pdf
+0
-0
0 additions, 0 deletions
doc/mkexp.pdf
mkexp
+5
-1
5 additions, 1 deletion
mkexp
test.py
+14
-0
14 additions, 0 deletions
test.py
with
830 additions
and
777 deletions
CHANGES.txt
+
1
−
0
View file @
d89bcaff
...
...
@@ -26,6 +26,7 @@ Configuration
* Added '.default' variable to namelists and namelist groups to define an
alternative default value if the empty string is a valid value
* Added 'is_set' utility to be used on logicals in 'eval(...)' expressions
* Added configurable hiding (disabling) of namelist files
Templates
---------
...
...
This diff is collapsed.
Click to expand it.
doc/mkexp.fodt
+
810
−
776
View file @
d89bcaff
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
doc/mkexp.pdf
+
0
−
0
View file @
d89bcaff
No preview for this file type
This diff is collapsed.
Click to expand it.
mkexp
+
5
−
1
View file @
d89bcaff
...
...
@@ -171,8 +171,12 @@ def format_namelist(section, group=None, default_value=''):
# Settings
base_indent
=
4
end_key
=
'
.end
'
hide_key
=
'
.hide
'
default_key
=
'
.default
'
default_value
=
section
.
get
(
default_key
,
default_value
)
# Skip if whole section (usually namelist file) is hidden
if
is_set
(
section
.
get
(
hide_key
,
'
false
'
)):
return
''
# Create list of removed namelist groups.
# Support old keyword for backward compatibility
remove_list
=
get_remove_list
(
section
,
'
.remove
'
)
...
...
@@ -184,7 +188,7 @@ def format_namelist(section, group=None, default_value=''):
iterator
=
{
group
:
section
[
group
]}.
iteritems
()
if
group
else
section
.
iteritems
()
for
group
,
contents
in
iterator
:
if
isinstance
(
contents
,
dict
):
hidden
=
is_set
(
contents
.
get
(
'
.
hide
'
,
'
false
'
))
hidden
=
is_set
(
contents
.
get
(
hide
_key
,
'
false
'
))
group_def_val
=
contents
.
get
(
default_key
,
default_value
)
group_id
=
group
.
lower
()
if
not
hidden
and
not
any
(
map
(
lambda
x
:
re
.
match
(
x
,
group_id
),
black_list
)):
...
...
This diff is collapsed.
Click to expand it.
test.py
+
14
−
0
View file @
d89bcaff
...
...
@@ -542,6 +542,8 @@ class NamelistTestCase(MkexpSimpleTestCase):
value = 43
"""
)
class
NamelistHiddenTestCase
(
MkexpSimpleTestCase
):
def
test_namelist_hide
(
self
):
self
.
run_test
(
"""
%{NAMELIST}
...
...
@@ -565,6 +567,18 @@ class NamelistTestCase(MkexpSimpleTestCase):
value = 43
"""
)
def
test_hidden_namelist_file
(
self
):
self
.
run_test
(
"""
%{NAMELIST}
"""
,
"""
"""
,
"""
[namelists]
[[namelist]]
.hide = true
[[[group]]]
value = 42
"""
)
class
NamelistDefaultValueTestCase
(
MkexpSimpleTestCase
):
def
test_standard_default_value
(
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