Build a normalized profile-update payload.
(
action: str,
direction: str,
topic: str,
*,
strip_domain_suffix: bool = False,
weight_target: Optional[float] = None,
)
| 1361 | |
| 1362 | |
| 1363 | def build_profile_update_result( |
| 1364 | action: str, |
| 1365 | direction: str, |
| 1366 | topic: str, |
| 1367 | *, |
| 1368 | strip_domain_suffix: bool = False, |
| 1369 | weight_target: Optional[float] = None, |
| 1370 | ) -> Optional[Dict[str, Any]]: |
| 1371 | """Build a normalized profile-update payload.""" |
| 1372 | cleaned_topic = clean_profile_topic_text(topic, strip_domain_suffix=strip_domain_suffix) |
| 1373 | if not cleaned_topic: |
| 1374 | return None |
| 1375 | result = { |
| 1376 | "action": action, |
| 1377 | "direction": direction, |
| 1378 | "topic": cleaned_topic, |
| 1379 | } |
| 1380 | if weight_target is not None: |
| 1381 | result["weight_target"] = weight_target |
| 1382 | return result |
| 1383 | |
| 1384 | |
| 1385 | def parse_profile_update_request(text: str, profile: Optional[Dict[str, Any]] = None) -> Optional[Dict[str, Any]]: |
no test coverage detected