Move pair descriptor policy
This commit is contained in:
+32
-4
@@ -4,15 +4,16 @@ from typing import Any, Callable
|
||||
|
||||
try:
|
||||
from . import cast_context as cast_context_policy
|
||||
from . import character_profile as character_profile_policy
|
||||
from . import pair_clothing
|
||||
from . import pair_options
|
||||
except ImportError: # Allows local smoke tests with top-level imports.
|
||||
import cast_context as cast_context_policy
|
||||
import character_profile as character_profile_policy
|
||||
import pair_clothing
|
||||
import pair_options
|
||||
|
||||
|
||||
DescriptorFromRow = Callable[[dict[str, Any]], str]
|
||||
CastDescriptors = Callable[..., list[str]]
|
||||
AxisRng = Callable[[dict[str, int], str, int, int], Any]
|
||||
Choose = Callable[[Any, list[str]], str]
|
||||
@@ -23,6 +24,35 @@ def cast_summary_phrase(women_count: int, men_count: int) -> str:
|
||||
return cast_context_policy.cast_summary_phrase(women_count, men_count)
|
||||
|
||||
|
||||
def insta_descriptor_from_row(row: dict[str, Any]) -> str:
|
||||
return character_profile_policy.descriptor_from_parts(
|
||||
"woman",
|
||||
row.get("age_band") or row.get("age"),
|
||||
row.get("body_phrase"),
|
||||
row.get("skin"),
|
||||
row.get("hair"),
|
||||
row.get("eyes"),
|
||||
row.get("descriptor_detail"),
|
||||
)
|
||||
|
||||
|
||||
def insta_descriptor_from_context(context: dict[str, Any]) -> str:
|
||||
subject = str(context.get("subject") or context.get("subject_type") or "person").strip()
|
||||
return character_profile_policy.descriptor_from_parts(
|
||||
subject,
|
||||
context.get("age"),
|
||||
context.get("body_phrase"),
|
||||
context.get("skin"),
|
||||
context.get("hair"),
|
||||
context.get("eyes"),
|
||||
context.get("descriptor_detail"),
|
||||
)
|
||||
|
||||
|
||||
def prompt_cast_descriptors(text: str) -> str:
|
||||
return str(text or "").replace("Woman A / primary creator:", "Woman A:")
|
||||
|
||||
|
||||
def softcore_partner_styling(
|
||||
*,
|
||||
seed_config: dict[str, int],
|
||||
@@ -87,14 +117,12 @@ def resolve_insta_pair_cast_context(
|
||||
platform_styles: dict[str, str],
|
||||
soft_levels: dict[str, str],
|
||||
hardcore_levels: dict[str, str],
|
||||
descriptor_from_row: DescriptorFromRow,
|
||||
build_cast_descriptors: CastDescriptors,
|
||||
prompt_cast_descriptors: Callable[[str], str],
|
||||
axis_rng: AxisRng,
|
||||
choose: Choose,
|
||||
slot_softcore_outfit: SlotSoftcoreOutfit,
|
||||
) -> dict[str, Any]:
|
||||
descriptor = descriptor_from_row(soft_row)
|
||||
descriptor = insta_descriptor_from_row(soft_row)
|
||||
cast_descriptors = build_cast_descriptors(
|
||||
descriptor,
|
||||
parsed_seed_config,
|
||||
|
||||
Reference in New Issue
Block a user