def METHOD_NAME(
    path: str | Path,
) -> tuple[list[models.Directory], list[models.File]]:
    directories = []
    files = []
    with os.scandir(path) as entries:
        for entry in entries:
            entry_path = Path(entry.path)
            if (
                entry.name == "__pycache__"
                or entry.name.startswith(".")
                or any(entry_path.match(pattern) for pattern in ignore_patterns)
            ):
                continue
            relative_path = entry_path.relative_to(settings.project_path)
            if entry.is_dir(follow_symlinks=False):
                _directories, _files = METHOD_NAME(entry.path)
                directories.append(
                    models.Directory(
                        name=entry.name,
                        path=str(relative_path),
                        directories=_directories,
                        files=_files,
                    )
                )
            elif entry.is_file(follow_symlinks=False):
                file_type = None
                if is_relative_to(relative_path, macro_directory_path):
                    file_type = models.FileType.macros
                elif is_relative_to(relative_path, test_directory_path):
                    file_type = models.FileType.tests
                else:
                    file_type = path_mapping.get(relative_path)
                files.append(
                    models.File(
                        name=entry.name,
                        path=str(relative_path),
                        type=file_type,
                    )
                )
    return sorted(directories, key=lambda x: x.name), sorted(files, key=lambda x: x.name)