Use shared item axis context in role routes

This commit is contained in:
2026-06-27 18:18:47 +02:00
parent 867916ee51
commit 6a65f7d35c
11 changed files with 100 additions and 52 deletions
+9 -3
View File
@@ -4,6 +4,11 @@ from dataclasses import dataclass
import re
from typing import Any, Callable
try:
from . import item_axis_policy
except ImportError: # Allows local smoke tests with top-level imports.
import item_axis_policy
WOMAN_LOWER_ACCESS_TERMS = (
"penetrat",
@@ -237,7 +242,7 @@ def character_hardcore_clothing_entries(
def hardcore_row_access_flags(row: dict[str, Any]) -> dict[str, bool]:
axis_values = row.get("item_axis_values")
axis_text = " ".join(str(value) for value in axis_values.values()) if isinstance(axis_values, dict) else ""
axis_text = item_axis_policy.context_text(axis_values=axis_values)
role_text = " ".join(
str(part or "")
for part in (
@@ -255,10 +260,11 @@ def hardcore_row_access_flags(row: dict[str, Any]) -> dict[str, bool]:
)
).lower()
full_text = f"{role_text} {detail_text}"
lower_access_text = f"{role_text} {axis_text}"
return {
"woman_lower": any(term in role_text for term in WOMAN_LOWER_ACCESS_TERMS),
"woman_lower": any(term in lower_access_text for term in WOMAN_LOWER_ACCESS_TERMS),
"woman_upper": any(term in full_text for term in WOMAN_UPPER_ACCESS_TERMS),
"man_lower": any(term in role_text for term in MAN_LOWER_ACCESS_TERMS),
"man_lower": any(term in lower_access_text for term in MAN_LOWER_ACCESS_TERMS),
}