Coverage for python / lsst / images / _concrete_bounds.py: 45%

9 statements  

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

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 

12from __future__ import annotations 

13 

14__all__ = ("SerializableBounds", "deserialize_bounds") 

15 

16 

17from ._geom import Bounds, Box 

18 

19# This is expected to become a union of concrete Bounds types that we can 

20# serialize via pydantic. Right now that's only Box. 

21type SerializableBounds = Box 

22 

23 

24def deserialize_bounds(serialized: SerializableBounds) -> Bounds: 

25 """Convert a serialized bounds object into its in-memory form.""" 

26 match serialized: 

27 case Box(): 

28 return serialized # type: ignore[return-value] 

29 raise RuntimeError(f"Cannot deserialize {serialized!r}.")