diff --git a/src/python/jw/util/load_yaml.py b/src/python/jw/util/load_yaml.py index 6f9426b..ed808db 100644 --- a/src/python/jw/util/load_yaml.py +++ b/src/python/jw/util/load_yaml.py @@ -8,9 +8,14 @@ from typing import Any, TypeAlias, cast import yaml # type: ignore[import-untyped] +# -- Constants ------------------------------------------------------------------ + IncludeSpec: TypeAlias = tuple[bool, Path, tuple[str, ...]] Includes: TypeAlias = list[IncludeSpec] +_LINK_NAME_RE = re.compile(r'^([a-zA-Z0-9_-]+)\|') +_INCLUDE_PATH_RE = re.compile(r'^([a-zA-Z0-9_.|-]+)\|') + # -- Low-level helpers (call graph leaves) -------------------------------------- def _deep_merge(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]: @@ -22,8 +27,6 @@ def _deep_merge(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any ret[key] = deepcopy(val) return ret -_LINK_NAME_RE = re.compile(r'^([a-zA-Z0-9_-]+)\|') - def _parse_link(value: str) -> tuple[bool, str | None, str]: """Parse a link value into (is_named, name_or_None, path_string). @@ -100,8 +103,6 @@ def _resolve_path( # -- Include helpers ------------------------------------------------------------ -_INCLUDE_PATH_RE = re.compile(r'^([a-zA-Z0-9_.|-]+)\|') - def _parse_include_spec(spec: str, parent: Path) -> IncludeSpec: if not spec: raise ValueError('Empty include spec')