Extract location config policy

This commit is contained in:
2026-06-27 00:12:21 +02:00
parent 6abcccbae1
commit fef2bf6d81
6 changed files with 716 additions and 8 deletions
+112
View File
@@ -25,6 +25,7 @@ try:
)
from . import camera_config as camera_policy
from . import generate_prompt_batches as g
from . import location_config as location_policy
from . import pair_clothing
from . import pair_camera
from . import pair_cast
@@ -62,6 +63,7 @@ except ImportError: # Allows local smoke tests with `python -c`.
)
import camera_config as camera_policy
import generate_prompt_batches as g
import location_config as location_policy
import pair_clothing
import pair_camera
import pair_cast
@@ -1798,6 +1800,116 @@ def build_thematic_location_json(
return resolved_location_config, resolved_composition_config, summary
LOCATION_POOL_PRESETS = location_policy.LOCATION_POOL_PRESETS
COMPOSITION_POOL_PRESETS = location_policy.COMPOSITION_POOL_PRESETS
COMPOSITION_INLINE_PRESETS = location_policy.COMPOSITION_INLINE_PRESETS
THEMATIC_LOCATION_PRESETS = location_policy.THEMATIC_LOCATION_PRESETS
def location_pool_preset_choices() -> list[str]:
return location_policy.location_pool_preset_choices()
def composition_pool_preset_choices() -> list[str]:
return location_policy.composition_pool_preset_choices()
def location_theme_choices() -> list[str]:
return location_policy.location_theme_choices()
def _location_pool_names_for_preset(preset: str) -> list[str]:
return location_policy.location_pool_names_for_preset(preset)
def _custom_location_entries(custom_locations: str) -> list[dict[str, str]]:
return location_policy.custom_location_entries(custom_locations)
def _scene_entries_for_pool_names(pool_names: list[str]) -> list[Any]:
return location_policy.scene_entries_for_pool_names(pool_names)
def build_location_pool_json(
enabled: bool = True,
combine_mode: str = "replace",
preset: str = "custom_only",
custom_locations: str = "",
location_config: str | dict[str, Any] | None = "",
) -> str:
return location_policy.build_location_pool_json(
enabled=enabled,
combine_mode=combine_mode,
preset=preset,
custom_locations=custom_locations,
location_config=location_config,
)
def _parse_location_config(location_config: str | dict[str, Any] | None) -> dict[str, Any]:
return location_policy.parse_location_config(location_config)
def _location_config_active(location_config: dict[str, Any]) -> bool:
return location_policy.location_config_active(location_config)
def _composition_pool_names_for_preset(preset: str) -> list[str]:
return location_policy.composition_pool_names_for_preset(preset)
def _custom_composition_entries(custom_compositions: str) -> list[str]:
return location_policy.custom_composition_entries(custom_compositions)
def _composition_entries_for_pool_names(pool_names: list[str]) -> list[Any]:
return location_policy.composition_entries_for_pool_names(pool_names)
def build_composition_pool_json(
enabled: bool = True,
combine_mode: str = "replace",
preset: str = "custom_only",
custom_compositions: str = "",
composition_config: str | dict[str, Any] | None = "",
) -> str:
return location_policy.build_composition_pool_json(
enabled=enabled,
combine_mode=combine_mode,
preset=preset,
custom_compositions=custom_compositions,
composition_config=composition_config,
)
def _parse_composition_config(composition_config: str | dict[str, Any] | None) -> dict[str, Any]:
return location_policy.parse_composition_config(composition_config)
def _composition_config_active(composition_config: dict[str, Any]) -> bool:
return location_policy.composition_config_active(composition_config)
def build_thematic_location_json(
enabled: bool = True,
combine_mode: str = "replace",
theme: str = "semi_public_affair",
custom_locations: str = "",
custom_compositions: str = "",
location_config: str | dict[str, Any] | None = "",
composition_config: str | dict[str, Any] | None = "",
) -> tuple[str, str, str]:
return location_policy.build_thematic_location_json(
enabled=enabled,
combine_mode=combine_mode,
theme=theme,
custom_locations=custom_locations,
custom_compositions=custom_compositions,
location_config=location_config,
composition_config=composition_config,
)
def _ethnicity_text_from_value(value: Any) -> str:
if isinstance(value, dict):
return str(value.get("ethnicity") or "").strip()