from pathlib import Path


def available_regions(rex_dir: str | Path) -> list[str]:
    """Get a list of available regions from a TRExFitter result directory.

    Parameters
    ----------
    rex_dir : str or pathlib.Path
        Path of the TRExFitter result directory

    Returns
    -------
    list(str)
        Regions discovered in the TRExFitter result directory.

    """
    root_files = (Path(rex_dir) / "Histograms").glob("*_preFit.root")
    return [rf.name[:-12] for rf in root_files if "asimov" not in rf.name]