MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _extract_seed_directions_from_role

Function _extract_seed_directions_from_role

scripts/clear_database.py:121–135  ·  view source on GitHub ↗

Prefer the explicit seed_directions authored in roles.json.

(role_data: Dict[str, Any])

Source from the content-addressed store, hash-verified

119
120
121def _extract_seed_directions_from_role(role_data: Dict[str, Any]) -> Dict[str, float]:
122 """Prefer the explicit seed_directions authored in roles.json."""
123 selected: Dict[str, float] = {}
124 for item in role_data.get("seed_directions", []) or []:
125 if not isinstance(item, dict):
126 continue
127 direction_key = str(item.get("canonical_name") or item.get("bootstrap_phrase") or "").strip()
128 if not direction_key:
129 continue
130 try:
131 weight = round(float(item.get("weight", 0.5) or 0.5), 4)
132 except (TypeError, ValueError):
133 weight = 0.5
134 selected[direction_key] = weight
135 return selected
136
137
138def build_seed_profile(role_name: str, role_data: Dict[str, Any]) -> Dict[str, Any]:

Callers 1

build_seed_profileFunction · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected