Coverage for python / lsst / images / fits / formatters.py: 59%

27 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-16 00:52 -0700

1# This file is part of lsst-images. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11 

12"""Deprecated re-exports of the unified ``lsst.images.formatters`` module. 

13 

14These names are kept so that deployed butler configs in 

15``daf_butler/configs/datastores/formatters.yaml`` continue to work. 

16Each class is a one-line subclass of the corresponding unified 

17formatter that emits a `DeprecationWarning` on first instantiation. 

18""" 

19 

20from __future__ import annotations 

21 

22__all__ = ( 

23 "CellCoaddFormatter", 

24 "GenericFormatter", 

25 "ImageFormatter", 

26 "MaskedImageFormatter", 

27 "VisitImageFormatter", 

28) 

29 

30import warnings 

31from typing import Any 

32 

33from .. import formatters as _unified 

34 

35 

36def _warn(name: str) -> None: 

37 warnings.warn( 

38 f"lsst.images.fits.formatters.{name} is deprecated; " 

39 f"use lsst.images.formatters.{name} instead. The fits-only " 

40 f"formatter forwards to the unified one and will be removed " 

41 f"in a future release.", 

42 DeprecationWarning, 

43 stacklevel=3, 

44 ) 

45 

46 

47class GenericFormatter(_unified.GenericFormatter): 

48 """Deprecated alias for `lsst.images.formatters.GenericFormatter`.""" 

49 

50 def __init__(self, *args: Any, **kwargs: Any) -> None: 

51 _warn("GenericFormatter") 

52 super().__init__(*args, **kwargs) 

53 

54 

55class ImageFormatter(_unified.ImageFormatter): 

56 """Deprecated alias for `lsst.images.formatters.ImageFormatter`.""" 

57 

58 def __init__(self, *args: Any, **kwargs: Any) -> None: 

59 _warn("ImageFormatter") 

60 super().__init__(*args, **kwargs) 

61 

62 

63class MaskedImageFormatter(_unified.MaskedImageFormatter): 

64 """Deprecated alias for `lsst.images.formatters.MaskedImageFormatter`.""" 

65 

66 def __init__(self, *args: Any, **kwargs: Any) -> None: 

67 _warn("MaskedImageFormatter") 

68 super().__init__(*args, **kwargs) 

69 

70 

71class VisitImageFormatter(_unified.VisitImageFormatter): 

72 """Deprecated alias for `lsst.images.formatters.VisitImageFormatter`.""" 

73 

74 def __init__(self, *args: Any, **kwargs: Any) -> None: 

75 _warn("VisitImageFormatter") 

76 super().__init__(*args, **kwargs) 

77 

78 

79class CellCoaddFormatter(_unified.CellCoaddFormatter): 

80 """Deprecated alias for `lsst.images.formatters.CellCoaddFormatter`.""" 

81 

82 def __init__(self, *args: Any, **kwargs: Any) -> None: 

83 _warn("CellCoaddFormatter") 

84 super().__init__(*args, **kwargs)