# SPDX-FileCopyrightText: 2026 Dennis Fink # # SPDX-License-Identifier: BSD-3-Clause """Types used throughout the duplicate-file finder.""" from collections import defaultdict from dataclasses import dataclass from pathlib import Path type FileIdentity = tuple[int, int] type FileSize = int type FileHash = str type FileExtension = str @dataclass(frozen=True, slots=True) class FileInfo: """Store filesystem metadata collected while discovering a file. :param path: Path through which the file was discovered. :param size: File size in bytes. :param identity: Filesystem identity as ``(device, inode)``. """ path: Path size: FileSize identity: FileIdentity type FileSet = set[FileInfo] type FilesByIdentity = defaultdict[FileIdentity, FileSet] type CandidateGroupKey = FileSize | tuple[FileSize, FileExtension] type FilesByCandidateGroup = dict[CandidateGroupKey, FilesByIdentity] type FilesByHash = dict[FileHash, FileSet]