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

Function initialize_hidden_anchor

scripts/drift_engine.py:234–256  ·  view source on GitHub ↗
(
    profile: Dict[str, Any],
    *,
    strategy_mode: str = STRATEGY_SIMULATION,
    drift_probability: float = 0.5,
)

Source from the content-addressed store, hash-verified

232
233def initialize_hidden_anchor(
234 profile: Dict[str, Any],
235 *,
236 strategy_mode: str = STRATEGY_SIMULATION,
237 drift_probability: float = 0.5,
238) -> Dict[str, Any]:
239 updated = copy.deepcopy(profile)
240 drift_state = _ensure_anchor_state(updated)
241 settings = _strategy_settings(strategy_mode)
242 drift_state["strategy_mode"] = settings["mode"]
243
244 if settings["mode"] == STRATEGY_REAL_USER and not drift_state.get("hidden_anchor"):
245 shift_topics = _candidate_shift_topics(updated)
246 drift_state["drift_enabled"] = bool(shift_topics)
247 if shift_topics:
248 drift_state["hidden_anchor"] = random.choice(shift_topics)
249 drift_state["hidden_anchor_source"] = "drift_plan_once"
250 else:
251 drift_state["hidden_anchor"] = None
252 drift_state["hidden_anchor_source"] = None
253
254 updated["drift_state"] = drift_state
255 return updated
256
257
258def load_default_checkfiles() -> List[Dict[str, Any]]:
259 return load_checkfiles(str(DEFAULT_CHECKFILES_DIR))

Callers 1

advance_anchor_driftFunction · 0.85

Calls 4

_ensure_anchor_stateFunction · 0.85
_strategy_settingsFunction · 0.85
_candidate_shift_topicsFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected