Coverage for src/arcade_collection/output/get_location_voxels.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2024-12-09 19:07 +0000

1from __future__ import annotations 

2 

3 

4def get_location_voxels(location: dict, region: str | None = None) -> list[tuple[int, int, int]]: 

5 """ 

6 Get list of voxels from location for specified region. 

7 

8 If region is not given, all voxels in the location are returned, even if 

9 those voxels are divided into separate regions. If region is given, only 

10 voxels in that region are returned. 

11 

12 Parameters 

13 ---------- 

14 location 

15 Location object. 

16 region 

17 Location region. 

18 

19 Returns 

20 ------- 

21 : 

22 List of x, y, z voxels. 

23 """ 

24 

25 return [ 

26 (x, y, z) 

27 for loc in location["location"] 

28 for x, y, z in loc["voxels"] 

29 if not region or loc["region"] == region 

30 ]