from pathlib import Path


def _read_tax_file(tax_file: None | Path, /) -> set[str]:
    """To create a set with all item names, which should not be taxed.

    The file should contain one name per line.

    Args:
        tax_file: The file containing item names, which should not be taxed.

    Returns:
        All items, which should be not taxed, in a set.
        The set can be empty.
    """
    if tax_file is None:
        return set()
    try:
        with tax_file.open("r") as fh_r:
            return {line.rstrip() for line in fh_r}
    except IOError as ex_n:
        print(str(ex_n))
    return set()