src/estimagic/optimization/get_algorithm.py
def _process_user_algorithm(algorithm):
    """Process the user specfied algorithm.

    Args:
        algorithm (str or callable): The user specified algorithm.

    Returns:
        callable: The internal algorithm.
        str: The name of the algorithm.

    """
    if isinstance(algorithm, str):
        algo_name = algorithm
    else:
        algo_name = getattr(algorithm, "name", "your algorithm")

    if isinstance(algorithm, str):
        try:
            algorithm = AVAILABLE_ALGORITHMS[algorithm]
        except KeyError:
            proposed = propose_alternatives(algorithm, list(AVAILABLE_ALGORITHMS))
            raise ValueError(
                f"Invalid algorithm: {algorithm}. Did you mean {proposed}?"
            ) from None

    return algorithm, algo_name
Process the user specfied algorithm.

    Args:
        algorithm (str or callable): The user specified algorithm.

    Returns:
        callable: The internal algorithm.
        str: The name of the algorithm.

    
Process the user specfied algorithm.
Process the user specfied algorithm .
def _process_user_algorithm(algorithm):
    if isinstance(algorithm, str):
        algo_name = algorithm
    else:
        algo_name = getattr(algorithm, "name", "your algorithm")
    if isinstance(algorithm, str):
        try:
            algorithm = AVAILABLE_ALGORITHMS[algorithm]
        except KeyError:
            proposed = propose_alternatives(algorithm, list(AVAILABLE_ALGORITHMS))
            raise ValueError(
                f"Invalid algorithm: {algorithm}. Did you mean {proposed}?"
            ) from None
    return algorithm, algo_name
def _process_user_algorithm ( algorithm ) : if isinstance ( algorithm , str ) : algo_name = algorithm else : algo_name = getattr ( algorithm , "name" , "your algorithm" ) if isinstance ( algorithm , str ) : try : algorithm = AVAILABLE_ALGORITHMS [ algorithm ] except KeyError : proposed = propose_alternatives ( algorithm , list ( AVAILABLE_ALGORITHMS ) ) raise ValueError ( f"Invalid algorithm: {algorithm}. Did you mean {proposed}?" ) from None return algorithm , algo_name
Process the user specfied algorithm.
Process the user specfied algorithm .
"""Process the user specfied algorithm.

    Args:
        algorithm (str or callable): The user specified algorithm.

    Returns:
        callable: The internal algorithm.
        str: The name of the algorithm.

    """
The internal algorithm.
str: The name of the algorithm.
The internal algorithm . str : The name of the algorithm .
callable
algorithm
The user specified algorithm.
The user specified algorithm .