Add typed category route metadata

This commit is contained in:
2026-06-27 10:39:45 +02:00
parent 00139d0cd9
commit 2c978c7eab
5 changed files with 146 additions and 36 deletions
+39 -14
View File
@@ -833,6 +833,31 @@ def _select_category_item_route(
)
def _select_category_item_route_result(
*,
category_choice: str,
subcategory_choice: str,
seed_config: dict[str, int],
seed: int,
row_number: int,
women_count: int,
men_count: int,
hardcore_position_config: dict[str, Any] | None = None,
categories: list[dict[str, Any]] | None = None,
) -> row_category_route_policy.CategoryItemRoute:
return row_category_route_policy.select_category_item_route_result(
category_choice=category_choice,
subcategory_choice=subcategory_choice,
seed_config=seed_config,
seed=seed,
row_number=row_number,
women_count=women_count,
men_count=men_count,
hardcore_position_config=hardcore_position_config,
categories=categories,
)
def _format(template: str, context: dict[str, Any]) -> str:
return row_rendering_policy.format_template(template, context)
@@ -2255,7 +2280,7 @@ def _build_custom_row(
parsed_location_config = _parse_location_config(location_config)
parsed_composition_config = _parse_composition_config(composition_config)
category_route = _select_category_item_route(
category_route = _select_category_item_route_result(
category_choice=category_choice,
subcategory_choice=subcategory_choice,
seed_config=seed_config,
@@ -2265,19 +2290,19 @@ def _build_custom_row(
men_count=men_count,
hardcore_position_config=parsed_hardcore_position_config,
)
category = category_route["category"]
subcategory = category_route["subcategory"]
women_count = int(category_route["women_count"])
men_count = int(category_route["men_count"])
count_adjustment = dict(category_route.get("count_adjustment") or {})
content_axis = str(category_route.get("content_axis") or "content")
item = category_route["item"]
item_text = str(category_route.get("item_text") or "")
item_name = str(category_route.get("item_name") or "")
item_axis_values = dict(category_route.get("item_axis_values") or {})
item_template_metadata = dict(category_route.get("item_template_metadata") or {})
item_formatter_hints = dict(category_route.get("formatter_hints") or {})
is_pose_category = bool(category_route.get("is_pose_category"))
category = category_route.category
subcategory = category_route.subcategory
women_count = category_route.women_count
men_count = category_route.men_count
count_adjustment = dict(category_route.count_adjustment)
content_axis = category_route.content_axis
item = category_route.item
item_text = category_route.item_text
item_name = category_route.item_name
item_axis_values = dict(category_route.item_axis_values)
item_template_metadata = dict(category_route.item_template_metadata)
item_formatter_hints = dict(category_route.formatter_hints)
is_pose_category = category_route.is_pose_category
subject_type = str(_merged_field(category, subcategory, item, "subject_type", "single_any"))
subject_route = _subject_route(
subject_type=subject_type,