summaryrefslogtreecommitdiff
path: root/kvmd/yamlconf
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-07 23:54:05 +0200
committerMaxim Devaev <[email protected]>2023-03-07 23:54:05 +0200
commitf652eca9c213dd783cf2ffd02109b2353ccb86c1 (patch)
tree3c2a5c68e0b03536ec5c482b9b5be708795e8292 /kvmd/yamlconf
parent002031baf15d328dad764a620e1c83c01e7a55a6 (diff)
refactoring
Diffstat (limited to 'kvmd/yamlconf')
-rw-r--r--kvmd/yamlconf/loader.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/kvmd/yamlconf/loader.py b/kvmd/yamlconf/loader.py
index 2dedc017..0d2933da 100644
--- a/kvmd/yamlconf/loader.py
+++ b/kvmd/yamlconf/loader.py
@@ -35,9 +35,9 @@ from .. import tools
# =====
def load_yaml_file(path: str) -> Any:
- with open(path) as yaml_file:
+ with open(path) as file:
try:
- return yaml.load(yaml_file, _YamlLoader)
+ return yaml.load(file, _YamlLoader)
except Exception as err:
# Reraise internal exception as standard ValueError and show the incorrect file
raise ValueError(f"Invalid YAML in the file {path!r}:\n{tools.efmt(err)}") from None
@@ -45,9 +45,9 @@ def load_yaml_file(path: str) -> Any:
# =====
class _YamlLoader(yaml.SafeLoader):
- def __init__(self, yaml_file: IO) -> None:
- super().__init__(yaml_file)
- self.__root = os.path.dirname(yaml_file.name)
+ def __init__(self, file: IO) -> None:
+ super().__init__(file)
+ self.__root = os.path.dirname(file.name)
def include(self, node: yaml.nodes.Node) -> Any:
incs: list[str]