from pathlib import Path
from typing import Optional
from typing import List


def ignore_file(path: Path, patterns: Optional[List[str]]) -> bool:
    """Check if path matches ignore patterns.

    :param path: path to compar with ignore pattern
    :param patterns: list of glob patterns specifying which paths to ignore
    :return True if path is to be ignored
    """
    return any(path.match(p) for p in patterns) if patterns else False