Coverage for src/arraybridge/framework_config.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-25 11:15 +0000

1"""Deprecated compatibility view of declaration-owned array operations. 

2 

3Runtime code consumes :class:`arraybridge.types.MemoryType` directly. This 

4read-only mapping exists only for callers that still import the historical 

5private name. 

6""" 

7 

8from types import MappingProxyType 

9 

10from arraybridge.types import MemoryType 

11 

12 

13def _operation_view(memory_type: MemoryType): 

14 return MappingProxyType( 

15 { 

16 "to_numpy": memory_type.to_numpy, 

17 "from_numpy": memory_type.from_numpy, 

18 "stack_arrays": memory_type.stack_arrays, 

19 "scale_dtype": memory_type.scale_dtype, 

20 } 

21 ) 

22 

23 

24_FRAMEWORK_CONFIG = MappingProxyType( 

25 {memory_type: _operation_view(memory_type) for memory_type in MemoryType} 

26)