Coverage for src\zapy\requests\file_loader.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.3.4, created at 2023-12-20 14:17 -0500

1from pathlib import Path 

2from dataclasses import dataclass 

3 

4 

5@dataclass 

6class ZapyFileInfo: 

7 """Class for keeping track of an item in inventory.""" 

8 file_location: Path 

9 mime_type: str 

10 file_name: str 

11 

12 

13def load_file(relative_path: str, mime_type, context_path=None): 

14 base_path_str = context_path or '.' 

15 file_location = Path(base_path_str) / relative_path 

16 name = file_location.name 

17 

18 return ZapyFileInfo(file_location, mime_type, name)