Coverage for mpcforces_extractor\api\config.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-06 21:34 +0100

1import os 

2from pathlib import Path 

3import importlib.resources 

4 

5# Constants 

6ITEMS_PER_PAGE = 100 

7 

8# Webserver Folders 

9# Use importlib.resources.files() to get paths 

10STATIC_DIR = importlib.resources.files("mpcforces_extractor.frontend").joinpath( 

11 "static" 

12) 

13TEMPLATES_DIR = importlib.resources.files("mpcforces_extractor.frontend").joinpath( 

14 "templates" 

15) 

16 

17# Data Folders 

18CWD = os.getcwd() 

19DATA_DIR = Path(CWD) / "data" 

20 

21# Create data directory if it does not exist 

22DATA_DIR.mkdir(exist_ok=True) 

23 

24# Define and create upload and output folders 

25UPLOAD_FOLDER = DATA_DIR / "uploads" 

26UPLOAD_FOLDER.mkdir(exist_ok=True) 

27 

28OUTPUT_FOLDER = DATA_DIR / "output" 

29OUTPUT_FOLDER.mkdir(exist_ok=True)