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

Method apply_drift

scripts/drift_engine.py:1333–1375  ·  view source on GitHub ↗

瀵圭敤鎴风敾鍍忓簲鐢ㄦ紓绉? Args: profile: 鐢ㄦ埛鐢诲儚 checkfile: 婕傜Щ閰嶇疆鏂囦欢锛堝鏋滀笉浼犲垯闅忔満閫夋嫨锛? selected_papers: 鐢ㄦ埛閫変腑鐨勮鏂? date: 鏃ユ湡 Returns: (鏇存柊鍚庣殑 profile, drift_event 鍏冩暟鎹?

(
        self,
        profile: Dict[str, Any],
        checkfile: Optional[Dict[str, Any]] = None,
        selected_papers: Optional[List[Dict]] = None,
        date: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

1331
1332 def apply_drift(
1333 self,
1334 profile: Dict[str, Any],
1335 checkfile: Optional[Dict[str, Any]] = None,
1336 selected_papers: Optional[List[Dict]] = None,
1337 date: Optional[str] = None,
1338 ) -> Tuple[Dict[str, Any], Optional[Dict[str, Any]]]:
1339 """
1340 瀵圭敤鎴风敾鍍忓簲鐢ㄦ紓绉?
1341 Args:
1342 profile: 鐢ㄦ埛鐢诲儚
1343 checkfile: 婕傜Щ閰嶇疆鏂囦欢锛堝鏋滀笉浼犲垯闅忔満閫夋嫨锛? selected_papers: 鐢ㄦ埛閫変腑鐨勮鏂? date: 鏃ユ湡
1344
1345 Returns:
1346 (鏇存柊鍚庣殑 profile, drift_event 鍏冩暟鎹?
1347 """
1348 if checkfile is None:
1349 checkfile = self.select_random_checkfile()
1350
1351 if checkfile is None:
1352 return profile, None
1353
1354 method_name = checkfile.get("drift_method")
1355 if method_name not in self.DRIFT_METHODS:
1356 print(f"[Warning] Unknown drift method: {method_name}")
1357 return profile, None
1358
1359 if not _trigger_satisfied(checkfile, profile, selected_papers):
1360 return profile, None
1361
1362 drift_func = self.DRIFT_METHODS[method_name]
1363 params = checkfile.get("params", {})
1364
1365 updated_profile, drift_event = drift_func(profile, params, selected_papers, date)
1366
1367 # 娣诲姞鍏冩暟鎹?
1368 drift_event["date"] = date
1369 drift_event["checkfile_name"] = checkfile.get("name", "unknown")
1370 drift_event["checkfile"] = checkfile.get("_source_file", "")
1371
1372 self.drift_history.append(drift_event)
1373
1374 return updated_profile, drift_event
1375
1376
1377# ==================== 宸ュ叿鍑芥暟 ====================
1378

Calls 3

_trigger_satisfiedFunction · 0.85
getMethod · 0.80