def _software_params_to_argparse(parameters):
    """
    Converts a SoftwareParameterCollection into an ArgumentParser object.

    Parameters
    ----------
    parameters: SoftwareParameterCollection
        The software parameters
    Returns
    -------
    argparse: ArgumentParser
        An initialized argument parser
    """
    # Check software parameters
    argparse = ArgumentParser()
    boolean_defaults = {}
    for parameter in parameters:
        arg_desc = {"dest": parameter.name, "required": parameter.required, "help": ""}  # TODO add help
        if parameter.type == "Boolean":
            default = _to_bool(parameter.defaultParamValue)
            arg_desc["action"] = "store_true" if not default else "store_false"
            boolean_defaults[parameter.name] = default
        else:
            python_type = _convert_type(parameter.type)
            arg_desc["type"] = python_type
            arg_desc["default"] = None if parameter.defaultParamValue is None else python_type(parameter.defaultParamValue)
        argparse.add_argument(*_cytomine_parameter_name_synonyms(parameter.name), **arg_desc)
    argparse.set_defaults(**boolean_defaults)
    return argparse
def _software_params_to_argparse ( parameters ) : argparse = ArgumentParser ( ) boolean_defaults = { } for parameter in parameters : arg_desc = { "dest" : parameter . name , "required" : parameter . required , "help" : "" } if parameter . type == "Boolean" : default = _to_bool ( parameter . defaultParamValue ) arg_desc [ "action" ] = "store_true" if not default else "store_false" boolean_defaults [ parameter . name ] = default else : python_type = _convert_type ( parameter . type ) arg_desc [ "type" ] = python_type arg_desc [ "default" ] = None if parameter . defaultParamValue is None else python_type ( parameter . defaultParamValue ) argparse . add_argument ( * _cytomine_parameter_name_synonyms ( parameter . name ) , ** arg_desc ) argparse . set_defaults ( ** boolean_defaults ) return argparse
Converts a SoftwareParameterCollection into an ArgumentParser object.

    Parameters
    ----------
    parameters: SoftwareParameterCollection
        The software parameters
    Returns
    -------
    argparse: ArgumentParser
        An initialized argument parser