MCPcopy Create free account
hub / github.com/MAC-VO/MAC-VO / YAMLFileProxy

Class YAMLFileProxy

Utility/Sandbox.py:15–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class YAMLFileProxy:
16 def __init__(self, file_name: Path):
17 self.file_path = file_name
18
19 # Transparent Config Cache
20 if not self.file_path.exists():
21 self.__file_cache = SimpleNamespace()
22 else:
23 self.__file_cache, _ = load_config(self.file_path)
24
25 @property
26 def data(self) -> SimpleNamespace:
27 return self.__file_cache
28
29 @data.setter
30 def data(self, value):
31 self.__file_cache = value
32 with open(self.file_path, "w") as file:
33 yaml.safe_dump(self.__file_cache, file)
34
35
36class SandboxFile:

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected