Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/components/tomo/detectors_resource.py: 75%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3import logging 

4 

5from daiquiri.core import marshal 

6from daiquiri.core.components import ComponentResource 

7from daiquiri.core.schema.metadata import paginated 

8from daiquiri.core.schema.components.tomo import TomoDetectorsSchema 

9 

10 

11logger = logging.getLogger(__name__) 

12 

13 

14class TomoDetectorsResource(ComponentResource): 

15 @marshal( 

16 out=[[200, paginated(TomoDetectorsSchema), "List of tomo detectors info"]], 

17 paged=True, 

18 ) 

19 def get(self, **kwargs): 

20 """Get a list of all available detectors and their info""" 

21 detectors = self._parent.get_detectors() 

22 results = [d.to_rest() for d in detectors] 

23 return {"rows": results, "total": len(results)}, 200