def _validate_files()

in src/python/tensorflow_cloud/core/validate.py [0:0]


def _validate_files(entry_point, requirements_txt):
    """Validates all the file path params."""
    cwd = os.getcwd()
    if entry_point is not None and (
        not os.path.isfile(os.path.join(cwd, entry_point))):
        raise ValueError(
            "Invalid `entry_point`. "
            "Expected a relative path in the current directory tree. "
            "Received: {}".format(entry_point)
        )

    if requirements_txt is not None and (
        not os.path.isfile(os.path.join(cwd, requirements_txt))
    ):
        raise ValueError(
            "Invalid `requirements_txt`. "
            "Expected a relative path in the current directory tree. "
            "Received: {}".format(requirements_txt)
        )

    if entry_point is not None and (
        not (entry_point.endswith("py") or entry_point.endswith("ipynb"))
    ):
        raise ValueError(
            "Invalid `entry_point`. "
            "Expected a python file or an iPython notebook. "
            "Received: {}".format(entry_point)
        )