def _is_data_file()

in src/sagemaker_xgboost_container/data_utils.py [0:0]


def _is_data_file(file_path, file_name):
    """Return true if file name is a valid data file name.

    A file is valid if:
    * File name does not start with '.' or '_'.
    * File is not a XGBoost cache file.

    :param file_path:
    :param file_name:
    :return: bool
    """
    if not os.path.isfile(os.path.join(file_path, file_name)):
        return False
    if file_name.startswith(".") or file_name.startswith("_"):
        return False
    # avoid XGB cache file
    if ".cache" in file_name:
        if "dtrain" in file_name or "dval" in file_name:
            return False
    return True