Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _parse_args_kwargs(params):
from fire.parser import DefaultParseValue
args = ()
kwargs = {}
for param in _param_split(params):
if '=' not in param:
args += (DefaultParseValue(param),)
else:
k, v = param.split('=')
kwargs[k.strip()] = DefaultParseValue(v)
return args, kwargs
def _parse_args_kwargs(params):
from fire.parser import DefaultParseValue
args = ()
kwargs = {}
for param in _param_split(params):
if '=' not in param:
args += (DefaultParseValue(param),)
else:
k, v = param.split('=')
kwargs[k.strip()] = DefaultParseValue(v)
return args, kwargs
def set_nested(dictionary, value, *path):
"""Set the value in the given path to the given nested dictionary."""
for level in path[:-1]:
dictionary = dictionary.setdefault(level, {})
# Use fire parser to convert raw argument into a value
dictionary[path[-1]] = parser.DefaultParseValue(value)