# Path: quantrocket/cli/utils/parse.py
# def dict_str(value):
#     if ":" not in value:
#         raise ValueError("value {0} should have format key:value".format(value))
#     return value
# 
# def list_or_int_or_float_or_str(value):
#     """
#     Parses the value as an int, else a float, else a string. If the value
#     contains commas, treats it as a list of ints or floats or strings. Also
#     handles None, True, and False.
#     """
#     if "," in value:
#         return [list_or_int_or_float_or_str(item) for item in value.split(",")]
# 
#     special_vals = {
#         "None": None,
#         "True": True,
#         "False": False
#     }
#     if value in special_vals:
#         return special_vals[value]
# 
#     try:
#         return int(value)
#     except ValueError:
#         try:
#             return float(value)
#         except ValueError:
#             return str(value)


import argparse
from quantrocket.cli.utils.parse import dict_str, list_or_int_or_float_or_str
        "--param2",
        metavar="PARAM",
        type=str,
        help="name of a second parameter to test (for 2-D parameter scans)")
    backtest_options.add_argument(
        "--vals2",
        type=list_or_int_or_float_or_str,
        metavar="VALUE",
        nargs="*",
        help="values to test for parameter 2 (values can be integers, floats, strings, "
        "'True', 'False', 'None', or 'default' (to test current param value); for "
        "lists/tuples, use comma-separated values)")
    backtest_options.add_argument(
        "-l", "--allocations",
        type=dict_str,
        metavar="CODE:FLOAT",
        nargs="*",
        help="the allocation for each strategy, passed as 'code:allocation' (default "
        "allocation is 1.0 / number of strategies)")
    backtest_options.add_argument(
        "-n", "--nlv",
        nargs="*",
        type=dict_str,
        metavar="CURRENCY:NLV",
        help="the NLV (net liquidation value, i.e. account balance) to assume for "
        "the backtests, expressed in each currency represented in the backtest (pass "
        "as 'currency:nlv')")
    backtest_options.add_argument(
        "--params",
        nargs="*",

# Path: quantrocket/cli/utils/parse.py
# def dict_str(value):
#     if ":" not in value:
#         raise ValueError("value {0} should have format key:value".format(value))
#     return value
# 
# def list_or_int_or_float_or_str(value):
#     """
#     Parses the value as an int, else a float, else a string. If the value
#     contains commas, treats it as a list of ints or floats or strings. Also
#     handles None, True, and False.
#     """
#     if "," in value:
#         return [list_or_int_or_float_or_str(item) for item in value.split(",")]
# 
#     special_vals = {
#         "None": None,
#         "True": True,
#         "False": False
#     }
#     if value in special_vals:
#         return special_vals[value]
# 
#     try:
#         return int(value)
#     except ValueError:
#         try:
#             return float(value)
#         except ValueError:
#             return str(value)


# Path: quantrocket/cli/subcommands/moonshot.py
import argparse
from quantrocket.cli.utils.parse import dict_str, list_or_int_or_float_or_str

        "--param2",
        metavar="PARAM",
        type=str,
        help="name of a second parameter to test (for 2-D parameter scans)")
    backtest_options.add_argument(
        "--vals2",
        type=list_or_int_or_float_or_str,
        metavar="VALUE",
        nargs="*",
        help="values to test for parameter 2 (values can be integers, floats, strings, "
        "'True', 'False', 'None', or 'default' (to test current param value); for "
        "lists/tuples, use comma-separated values)")
    backtest_options.add_argument(
        "-l", "--allocations",
        type=dict_str,
        metavar="CODE:FLOAT",
        nargs="*",
        help="the allocation for each strategy, passed as 'code:allocation' (default "
        "allocation is 1.0 / number of strategies)")
    backtest_options.add_argument(
        "-n", "--nlv",
        nargs="*",
        type=dict_str,
        metavar="CURRENCY:NLV",
        help="the NLV (net liquidation value, i.e. account balance) to assume for "
        "the backtests, expressed in each currency represented in the backtest (pass "
        "as 'currency:nlv')")
    backtest_options.add_argument(
        "--params",
        nargs="*",

        type=dict_str,