Skip to content

Commit

Permalink
improved parsing of cmmandline parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
denisri committed Sep 29, 2023
1 parent 700229c commit 855ccc3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions capsul/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from .api import Capsul
from .config.configuration import ApplicationConfiguration
from soma.controller import undefined


def executable_parser(executable):
Expand Down Expand Up @@ -82,12 +83,17 @@ def executable_parser(executable):
if field.type is int:
value = int(value)
elif field.type is float:
value = float(value)
elif field.type is str:
if value == 'None' or value == 'null' or value == 'undefined':
value = undefined
else:
value = float(value)
elif field.type is str or field.is_path():
if value and value[0] == '"':
value = json.loads(value)
else:
value = json.loads(value)
if value is None:
value = undefined
kwargs[name] = value
executable.import_dict(kwargs)
with capsul.engine() as ce:
Expand Down

0 comments on commit 855ccc3

Please sign in to comment.