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
a9214974
Commit
a9214974
authored
11 years ago
by
Karl-Hermann Wieners
Browse files
Options
Downloads
Patches
Plain Diff
Script generation: added second to time string conversion, fixed setup info.
parent
af2a9c4e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
expconfig.py
+13
-0
13 additions, 0 deletions
expconfig.py
setup.py
+0
-3
0 additions, 3 deletions
setup.py
with
13 additions
and
3 deletions
expconfig.py
+
13
−
0
View file @
a9214974
...
...
@@ -195,6 +195,15 @@ class ExpConfig(ConfigObj):
result
=
''
return
result
def
sec2time
(
seconds
):
'''
Create time string (HH:MM:SS) from second of day
'''
seconds
=
int
(
seconds
)
if
seconds
>=
86400
:
raise
ValueError
(
"
invalid second of day
'
{0}
'"
.
format
(
seconds
))
minutes
,
s
=
divmod
(
seconds
,
60
)
h
,
m
=
divmod
(
minutes
,
60
)
return
"
{0:02}:{1:02}:{2:02}
"
.
format
(
h
,
m
,
s
)
def
split_date
(
value
):
'''
Re-format datetime string to list for use in namelists
'''
match
=
re
.
match
(
r
'
^0*(\d+)-0*(\d+)-0*(\d+)
'
...
...
@@ -244,6 +253,10 @@ class ExpConfig(ConfigObj):
if
match
:
return
split_date
(
match
.
group
(
1
))
match
=
re
.
match
(
r
'
^sec2time\((.*)\)$
'
,
value
,
re
.
S
)
if
match
:
return
sec2time
(
match
.
group
(
1
))
match
=
re
.
match
(
r
'
^read\((.*)\)$
'
,
value
,
re
.
S
)
if
match
:
return
read_value
(
match
.
group
(
1
))
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
0
−
3
View file @
a9214974
...
...
@@ -15,8 +15,5 @@ setup(
scripts
=
[
'
mkexp
'
,
'
getexp
'
,
'
rmexp
'
,
'
diffexp
'
,
'
diffpath
'
],
platforms
=
[
'
Posix
'
],
license
=
'
LICENSE.txt
'
,
data_files
=
[(
'
share/doc/
'
+
name
+
'
-
'
+
version
+
'
/examples
'
,
[
'
examples/
'
+
example
+
'
.config
'
for
example
in
[
'
reference
'
,
'
old_input_data
'
,
'
mean_values
'
]])],
requires
=
[
'
Jinja2(>= 2.6)
'
]
)
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