### ===================================================================================================================
### Strengthening measures collection from GMC
### ===================================================================================================================
# Copyright ©VIIA 2024
### ===================================================================================================================
### 1. Import
### ===================================================================================================================
# General imports
import yaml
from typing import Dict, Optional
### ===================================================================================================================
### 2. Class GMCMeasures to cache the information on the strengthening measures
### ===================================================================================================================
[docs]class GMCMeasures:
""" Class of GMC strengthening measures."""
def __init__(self):
""" No inputs required."""
self.strengthening_measures_cache = None
def _load_strengthening_measures(self, project: 'ViiaProject') -> Optional[Dict]:
with open(project.viia_settings.project_specific_package_location / 'strengthening' /
'gmc_strengthening_measures.yaml') as f:
return yaml.load(f, Loader=yaml.FullLoader)
def get_strengthening_measures(self, project: 'ViiaProject') -> Optional[Dict]:
if self.strengthening_measures_cache is None:
self.strengthening_measures_cache = self._load_strengthening_measures(project)
return self.strengthening_measures_cache
### ===================================================================================================================
### 3. End of Script
### ===================================================================================================================