Coverage for python / lsst / images / serialization / _common.py: 87%
15 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-02 07:17 -0800
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-02 07:17 -0800
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.
12from __future__ import annotations
14__all__ = (
15 "ArchiveReadError",
16 "ArchiveTree",
17 "OpaqueArchiveMetadata",
18 "no_header_updates",
19)
21from typing import TYPE_CHECKING, Protocol, Self
23import astropy.table
24import astropy.units
25import pydantic
27from .._geom import Box
29if TYPE_CHECKING:
30 import astropy.io.fits
33class ArchiveTree(
34 pydantic.BaseModel, ser_json_inf_nan="constants", ser_json_bytes="base64", val_json_bytes="base64"
35):
36 """An intermediate base class of `pydantic.BaseModel` that should be used
37 for all objects that may be used as the top-level tree models written to
38 archives.
39 """
42class ArchiveReadError(RuntimeError):
43 """Exception raised when the contents of an archive cannot be read."""
46class OpaqueArchiveMetadata(Protocol):
47 """Interface for opaque archive metadata.
49 In addition to implementing the methods defined here, all implementations
50 must be pickleable.
51 """
53 def copy(self) -> Self | None:
54 """Copy, reference, or discard metadata when its holding object is
55 copied.
56 """
57 ...
59 def subset(self, bbox: Box) -> Self | None:
60 """Copy, reference, or discard metadata when a subset of its its
61 holding object is extracted.
62 """
63 ...
66def no_header_updates(header: astropy.io.fits.Header) -> None:
67 """Do not make any modifications to the given FITS header."""