Skip to content

types.py

Complex types, annotations, validators.

path_is_absolute(value)

Require absolute paths in an argument.

Source code in copier/types.py
46
47
48
49
50
51
52
def path_is_absolute(value: Path) -> Path:
    """Require absolute paths in an argument."""
    if not value.is_absolute():
        from .errors import PathNotAbsoluteError

        raise PathNotAbsoluteError(path=value)
    return value

path_is_relative(value)

Require relative paths in an argument.

Source code in copier/types.py
55
56
57
58
59
60
61
def path_is_relative(value: Path) -> Path:
    """Require relative paths in an argument."""
    if value.is_absolute():
        from .errors import PathNotRelativeError

        raise PathNotRelativeError(path=value)
    return value