# limitations under the License.
#
# ============LICENSE_END============================================
-#
-# ECOMP is a trademark and service mark of AT&T Intellectual Property.
-#
-'''
-test_env_files_provided
-'''
+import os
+
+import yaml
+
+YAML_CACHE = {}
+resolver = yaml.resolver
+YAMLError = yaml.YAMLError
+constructor = yaml.constructor
+
-VERSION = '1.0.0'
+def add_constructor(tag, constructor):
+ yaml.add_constructor(
+ tag,
+ constructor,
+ )
-def test_env_files_provided(env_files):
- '''
- Make sure environment files have been provided
- '''
- assert len(env_files) > 0, '"*.env" not found'
+def load(fp):
+ """Provides cached loading of yaml files"""
+ abs_path = os.path.abspath(fp.name)
+ if abs_path not in YAML_CACHE:
+ YAML_CACHE[abs_path] = yaml.safe_load(fp)
+ return YAML_CACHE[abs_path]