Coverage for collectra/tasks/object_detection/__init__.py: 41.67%

12 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-16 09:56 +0000

1"""Object-detection task implementations.""" 

2 

3from __future__ import annotations 

4 

5from importlib import import_module 

6 

7_EXPORTS = { 

8 "ObjectDetectionYOLO": "collectra.tasks.object_detection.yolo", 

9 "ObjectDetectionDETR": "collectra.tasks.object_detection.detr", 

10 "DetectionTrainResult": "collectra.tasks.object_detection.detr", 

11 "ObjectDetectionRFDETR": "collectra.tasks.object_detection.rfdetr", 

12} 

13 

14__all__ = sorted(_EXPORTS) 

15 

16 

17def __getattr__(name: str): 

18 try: 

19 module_name = _EXPORTS[name] 

20 except KeyError as error: 

21 raise AttributeError( 

22 f"module {__name__!r} has no attribute {name!r}" 

23 ) from error 

24 value = getattr(import_module(module_name), name) 

25 globals()[name] = value 

26 return value