Coverage for python / lsst / pipe / tasks / sspAuxiliaryFile.py: 0%

15 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-17 09:21 +0000

1from lsst.daf.butler import FormatterV2 

2from lsst.resources import ResourcePath 

3from io import BytesIO 

4from typing import Any 

5 

6__all__ = ["SSPAuxiliaryFile", "SSPAuxiliaryFileFormatter"] 

7 

8 

9class SSPAuxiliaryFile(): 

10 """Class to hold information about auxiliary files needed for 

11 solar system object ephemeris calculations. 

12 """ 

13 fileContents = None 

14 

15 def __init__(self, fileContents): 

16 self.fileContents = fileContents 

17 

18 

19class SSPAuxiliaryFileFormatter(FormatterV2): 

20 """Formatter for SSP Auxiliary Files. 

21 """ 

22 can_read_from_uri = True 

23 

24 def read_from_uri(self, uri: ResourcePath, component: str | None = None, expected_size: int = -1) -> Any: 

25 """Read a dataset. 

26 

27 Parameters 

28 ---------- 

29 uri : `lsst.ResourcePath` 

30 Location of the file to read. 

31 component : `str` or `None`, optional 

32 Component to read from the file. 

33 expected_size : `int`, optional 

34 Expected size of the file. 

35 

36 Returns 

37 ------- 

38 payload : `SSPAuxiliaryFile` 

39 The requested data as a Python object. 

40 """ 

41 return SSPAuxiliaryFile(BytesIO(uri.read())) 

42 

43 def to_bytes(self, in_memory_dataset: Any) -> bytes: 

44 return in_memory_dataset.fileContents