sync
This commit is contained in:
@@ -26,5 +26,5 @@ def cfg_data_factory(src_paths: SrcPaths) -> CfgData:
|
|||||||
src_paths.cfg_dir.name,
|
src_paths.cfg_dir.name,
|
||||||
frozenset(src_path_get_services(src_paths, data)),
|
frozenset(src_path_get_services(src_paths, data)),
|
||||||
vols if vols else None,
|
vols if vols else None,
|
||||||
frozenset(cfg_get_orgs(data, src_paths.cfg_file)),
|
frozenset(cfg_get_orgs(data)),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
from pathlib import Path
|
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
from compose.cfg.entity import CfgData, CfgDataYaml, OrgData
|
from compose.cfg.entity import CfgData, CfgDataYaml, OrgData
|
||||||
@@ -9,29 +8,12 @@ from compose.service.factory import services_yaml_factory
|
|||||||
from compose.util import read_yml
|
from compose.util import read_yml
|
||||||
|
|
||||||
|
|
||||||
def cfg_get_orgs(data: CfgDataYaml, path: Path) -> Iterator[OrgData]:
|
def cfg_get_orgs(data: CfgDataYaml) -> Iterator[OrgData]:
|
||||||
# orgs = data.get("orgs")
|
for org_data in data["orgs"]:
|
||||||
# if orgs is None:
|
yield OrgData(
|
||||||
# yield OrgData(
|
org_data["org"],
|
||||||
# org_data.get("org"),
|
org_data.get("url"),
|
||||||
# org_data.get("url"),
|
)
|
||||||
# )
|
|
||||||
orgs = "orgs"
|
|
||||||
try:
|
|
||||||
orgs = data[orgs]
|
|
||||||
except KeyError as e:
|
|
||||||
print(f'key "{orgs}" not in "{path!s}"')
|
|
||||||
raise KeyError(e)
|
|
||||||
org = "org"
|
|
||||||
for org_data in orgs:
|
|
||||||
try:
|
|
||||||
yield OrgData(
|
|
||||||
org_data[org],
|
|
||||||
org_data.get("url"),
|
|
||||||
)
|
|
||||||
except KeyError as e:
|
|
||||||
print(f'key "{orgs}.{org}" not in "{path!s}"')
|
|
||||||
raise KeyError(e)
|
|
||||||
|
|
||||||
|
|
||||||
def cfg_get_services(cfg_data: CfgData) -> Iterator[tuple[str, Service]]:
|
def cfg_get_services(cfg_data: CfgData) -> Iterator[tuple[str, Service]]:
|
||||||
|
|||||||
@@ -7,6 +7,5 @@ from compose.util import read_yml, validate_typed_dict
|
|||||||
|
|
||||||
def services_yaml_factory(path: Path):
|
def services_yaml_factory(path: Path):
|
||||||
data = cast(ServiceYaml, read_yml(path))
|
data = cast(ServiceYaml, read_yml(path))
|
||||||
# data = read_yml(path)
|
validate_typed_dict(ServiceYaml, data, path)
|
||||||
validate_typed_dict(ServiceYaml, data)
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
from collections.abc import Mapping
|
from collections.abc import KeysView, Mapping
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, ClassVar, KeysView, Protocol, cast, override
|
from typing import Any, ClassVar, Protocol, cast, override
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user