feat(typing): Start adding python types for the configuration
This commit is contained in:
+5
-4
@@ -2,6 +2,7 @@ from typing import Any, cast
|
||||
import yaml
|
||||
|
||||
from config import validator
|
||||
from config.dtype import ArchMgrConfig
|
||||
from config.merger import merge_configs
|
||||
|
||||
|
||||
@@ -11,7 +12,7 @@ def _load_config_file(file: str):
|
||||
return parsed
|
||||
|
||||
|
||||
def load_config(file: str):
|
||||
def load_config(file: str) -> ArchMgrConfig:
|
||||
# Load and validate initial config
|
||||
try:
|
||||
loaded_conf = _load_config_file(file)
|
||||
@@ -20,9 +21,9 @@ def load_config(file: str):
|
||||
if not validator.validate(loaded_conf):
|
||||
return {}
|
||||
|
||||
conf = cast(dict[str, Any], loaded_conf)
|
||||
requires = cast(list[str], conf["requires"])
|
||||
conf.pop("requires")
|
||||
configuration = cast(dict[str, Any], loaded_conf)
|
||||
requires = cast(list[str], configuration.pop("requires"))
|
||||
conf = cast(ArchMgrConfig, configuration)
|
||||
|
||||
# Recursively load files
|
||||
for conf_file in requires:
|
||||
|
||||
Reference in New Issue
Block a user