in src/smepu/argparse.py [0:0]
def _round_1(cli_args: Iterable[str]) -> ArgsDict:
"""Convert list of ['--name', 'value', ...] to {'name': val}, where 'val' will be in the nearest data type.
Conversion follows the principle: "if it looks like a duck and quacks like a duck, then it must be a duck".
"""
d = {}
it = iter(cli_args)
try:
# Each iteration swallows ["--kwarg", "value"]
expected = 0
while True:
# Get --key
key = next(it)[2:]
expected += 1
# Get the value. Warn if it looks fishy.
value = next(it)
expected -= 1
if value[:2] == "--":
warnings.warn(f'Fishy cli args / hyperparams: {key}="{value}"')
d[key] = value
except StopIteration:
if expected > 1:
raise ValueError(f"CLI arg --{key} has no value, so ignored")
# Infer data types.
dd = {k: infer_dtype(v) for k, v in d.items()}
return dd