Coverage for src/io_collection/quilt/save_quilt_item.py: 100%

7 statements  

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

1import io 

2 

3import quilt3 

4 

5from io_collection.save.save_buffer import save_buffer 

6 

7 

8def save_quilt_item(location: str, key: str, package: quilt3.Package, item: str) -> None: 

9 """ 

10 Save item from Quilt package to key at specified location. 

11 

12 Parameters 

13 ---------- 

14 location 

15 Object location (local path or S3 bucket). 

16 key 

17 Object key. 

18 package 

19 Quilt package. 

20 item 

21 Name of the item in the package. 

22 """ 

23 

24 contents = package[item].get_bytes() 

25 buffer = io.BytesIO(contents) 

26 save_buffer(location, key, buffer)