Skip to content
Snippets Groups Projects
Commit eea41c8e authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

if valsep is not provided, it is set to a sensible default for the given

style. Fix to LOAD comparison - identity, not equality, otherwise ndarrays
will trigger an error.
parent 62df0964
No related branches found
No related tags found
No related merge requests found
......@@ -85,7 +85,7 @@ generated command line arguments.
"""
def applyArgStyle(style, valsep=' ', argmap=None, valmap=None, **kwargs):
def applyArgStyle(style, valsep=None, argmap=None, valmap=None, **kwargs):
"""Turns the given ``kwargs`` into command line options. This function
is intended to be used to automatically generate command line options
from arguments passed into a Python function.
......@@ -118,7 +118,8 @@ def applyArgStyle(style, valsep=' ', argmap=None, valmap=None, **kwargs):
:arg valsep: Controls how the values passed to command-line options
which expect multiple arguments are delimited - must be
one of ``' '`` (the default), ``','`` or ``'"'``.
one of ``' '``, ``','`` or ``'"'``. Defaults to ``' '``
if ``'=' not in style``, ``','`` otherwise.
:arg argmap: Dictionary of ``{kwarg-name : cli-name}`` mappings. This can
be used if you want to use different argument names in your
......@@ -148,6 +149,10 @@ def applyArgStyle(style, valsep=' ', argmap=None, valmap=None, **kwargs):
:returns: A list containing the generated command-line options.
"""
if valsep is None:
if '=' in style: valsep = ','
else: valsep = ' '
if style not in ('-', '--', '-=', '--='):
raise ValueError('Invalid style: {}'.format(style))
if valsep not in (' ', ',', '"'):
......@@ -519,7 +524,7 @@ class _FileOrThing(object):
if val is None:
continue
if val == LOAD:
if val is LOAD:
outfile = self.__prepOut(workdir, name, val)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment