compare.pyi 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. from collections.abc import Callable
  2. from typing import Literal, overload
  3. from numpy.typing import NDArray
  4. __all__ = ["calculate_rms", "comparable_formats", "compare_images"]
  5. def make_test_filename(fname: str, purpose: str) -> str: ...
  6. def get_cache_dir() -> str: ...
  7. def get_file_hash(path: str, block_size: int = ...) -> str: ...
  8. converter: dict[str, Callable[[str, str], None]] = {}
  9. def comparable_formats() -> list[str]: ...
  10. def convert(filename: str, cache: bool) -> str: ...
  11. def crop_to_same(
  12. actual_path: str, actual_image: NDArray, expected_path: str, expected_image: NDArray
  13. ) -> tuple[NDArray, NDArray]: ...
  14. def calculate_rms(expected_image: NDArray, actual_image: NDArray) -> float: ...
  15. @overload
  16. def compare_images(
  17. expected: str, actual: str, tol: float, in_decorator: Literal[True]
  18. ) -> None | dict[str, float | str]: ...
  19. @overload
  20. def compare_images(
  21. expected: str, actual: str, tol: float, in_decorator: Literal[False]
  22. ) -> None | str: ...
  23. @overload
  24. def compare_images(
  25. expected: str, actual: str, tol: float, in_decorator: bool = ...
  26. ) -> None | str | dict[str, float | str]: ...
  27. def save_diff_image(expected: str, actual: str, output: str) -> None: ...