universal_attention/utils.py
def register_path_validator(flag_name: str, is_dir: bool = False) -> None:
    """
    Register a validator ensuring that `flag_name` is an existing file.

    Parameters
    ----------
    flag_name: str
        Name of the flag to register a validator for.
    is_dir: bool (default: False)
        Whether the file must also be a directory.
    """
    if is_dir:
        flags.register_validator(
            flag_name,
            _dir_validator,
            f"--{flag_name} must be an existing directory.",
        )
    else:
        flags.register_validator(
            flag_name,
            _path_validator,
            f"--{flag_name} must be an existing file.",
        )

    Register a validator ensuring that `flag_name` is an existing file.

    Parameters
    ----------
    flag_name: str
        Name of the flag to register a validator for.
    is_dir: bool (default: False)
        Whether the file must also be a directory.
    
Register a validator ensuring that `flag_name` is an existing file.
Parameters

str
Name of the flag to register a validator for.
is_dir: bool (default: False)
Whether the file must also be a directory.
Register a validator ensuring that ` flag_name ` is an existing file . Parameters str Name of the flag to register a validator for . is_dir : bool ( default : False ) Whether the file must also be a directory .
def register_path_validator(flag_name: str, is_dir: bool = False) -> None:
    if is_dir:
        flags.register_validator(
            flag_name,
            _dir_validator,
            f"--{flag_name} must be an existing directory.",
        )
    else:
        flags.register_validator(
            flag_name,
            _path_validator,
            f"--{flag_name} must be an existing file.",
        )
def register_path_validator ( flag_name : str , is_dir : bool = False ) -> None : if is_dir : flags . register_validator ( flag_name , _dir_validator , f"--{flag_name} must be an existing directory." , ) else : flags . register_validator ( flag_name , _path_validator , f"--{flag_name} must be an existing file." , )
Register a validator ensuring that `flag_name` is an existing file.
Register a validator ensuring that ` flag_name ` is an existing file .
"""
    Register a validator ensuring that `flag_name` is an existing file.

    Parameters
    ----------
    flag_name: str
        Name of the flag to register a validator for.
    is_dir: bool (default: False)
        Whether the file must also be a directory.
    """
flag_name
str
is_dir
bool