# 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
        metavar="YYYY-MM-DD",
        help="the backtest end date (default is to use all available history)")
    backtest_options.add_argument(
        "-g", "--segment",
        metavar="FREQ",
        help="backtest in date segments of this size, to reduce memory usage "
        "(use Pandas frequency string, e.g. 'A' for annual segments or 'Q' "
        "for quarterly segments)")
    backtest_options.add_argument(
        "-p", "--param1",
        metavar="PARAM",
        type=str,
        required=True,
        help="the name of the parameter to test (a class attribute on the strategy)")
    backtest_options.add_argument(
        "-v", "--vals1",
        type=list_or_int_or_float_or_str,
        metavar="VALUE",
        nargs="+",
        required=True,
        help="parameter values to test (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(
        "--param2",
        metavar="PARAM",
        type=str,
        help="name of a second parameter to test (for 2-D parameter scans)")
    backtest_options.add_argument(
        "--vals2",

# 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

        metavar="YYYY-MM-DD",
        help="the backtest end date (default is to use all available history)")
    backtest_options.add_argument(
        "-g", "--segment",
        metavar="FREQ",
        help="backtest in date segments of this size, to reduce memory usage "
        "(use Pandas frequency string, e.g. 'A' for annual segments or 'Q' "
        "for quarterly segments)")
    backtest_options.add_argument(
        "-p", "--param1",
        metavar="PARAM",
        type=str,
        required=True,
        help="the name of the parameter to test (a class attribute on the strategy)")
    backtest_options.add_argument(
        "-v", "--vals1",
        type=list_or_int_or_float_or_str,
        metavar="VALUE",
        nargs="+",
        required=True,
        help="parameter values to test (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(
        "--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,