from pathlib import Path
from typing import List


def get_files(
    d: Path,
    pattern: str,
    sort_lexicographical: bool = False,
    sort_numerical: bool = False,
) -> List[Path]:
    """Return a list of files in a given directory.

    Args:
        d: The path to the directory.
        pattern: The wildcard to filter files with.
        sort_lexicographical: Lexicographical sort.
        sort_numerical: Numerical sort.
    """
    files = d.glob(pattern)
    if sort_lexicographical:
        return sorted(files, key=lambda x: x.stem)
    if sort_numerical:
        return sorted(files, key=lambda x: int(x.stem))
    return list(files)