Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
gwinc
pygwinc
Commits
ec5cc9ba
Commit
ec5cc9ba
authored
Dec 16, 2020
by
Jameson Rollins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: better arg parsing error handling
parent
cb2cefe5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
gwinc/__main__.py
gwinc/__main__.py
+13
-5
No files found.
gwinc/__main__.py
View file @
ec5cc9ba
...
...
@@ -141,8 +141,11 @@ def main():
if
args
.
ifo
:
for
paramval
in
args
.
ifo
:
param
,
val
=
paramval
.
split
(
'='
,
1
)
ifo
[
param
]
=
float
(
val
)
try
:
param
,
val
=
paramval
.
split
(
'='
,
1
)
ifo
[
param
]
=
float
(
val
)
except
ValueError
:
parser
.
error
(
"Improper IFO parameter specification."
)
if
args
.
yaml
:
if
not
ifo
:
...
...
@@ -178,6 +181,8 @@ def main():
for
path
in
args
.
save
:
if
os
.
path
.
splitext
(
path
)[
1
]
in
io
.
DATA_SAVE_FORMATS
:
out_data_files
.
add
(
path
)
else
:
parser
.
exit
(
2
,
"Save file extension not specified.
\n
"
)
out_plot_files
=
set
(
args
.
save
)
-
out_data_files
if
args
.
plot
or
out_plot_files
:
...
...
@@ -215,9 +220,12 @@ def main():
for
param
in
args
.
range
.
split
(
','
):
if
not
param
:
continue
p
,
v
=
param
.
split
(
'='
)
if
not
v
:
raise
ValueError
(
'missing parameter value "{}"'
.
format
(
p
))
try
:
p
,
v
=
param
.
split
(
'='
)
if
not
v
:
raise
ValueError
except
ValueError
:
parser
.
error
(
"Improper range parameter specification."
)
try
:
v
=
float
(
v
)
except
ValueError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment