Skip to content

eds_scikit.resources.utils

versionize

versionize(algo: str) -> Optional[str]

Extract, if found, the version substring of an algorithm name.

PARAMETER DESCRIPTION
algo

Of the form "" or "."

TYPE: str

RETURNS DESCRIPTION
Optional[str]

The algo version suffix

Source code in eds_scikit/resources/utils.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
def versionize(algo: str) -> Optional[str]:
    """
    Extract, if found,  the version substring of an algorithm name.

    Parameters
    ----------
    algo : str
        Of the form "<algo_name>" or "<algo_name>.<version>"

    Returns
    -------
    Optional[str]
        The algo version suffix
    """
    splited = algo.split(".")
    if len(splited) == 1:
        return None
    return splited[-1]
Back to top