MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / _match_admin_file_health

Method _match_admin_file_health

apps/admin/services.py:1372–1400  ·  view source on GitHub ↗
(self, item: dict[str, Any], health: str)

Source from the content-addressed store, hash-verified

1370 return any(keyword in str(value).lower() for value in search_values if value)
1371
1372 def _match_admin_file_health(self, item: dict[str, Any], health: str) -> bool:
1373 if not health or health == "all":
1374 return True
1375
1376 status_insights = item.get("statusInsights") or {}
1377 severity = status_insights.get("severity")
1378 state = status_insights.get("state")
1379 reasons = set(status_insights.get("reasons") or [])
1380
1381 if health == "attention":
1382 return severity in {"danger", "warning"}
1383 if health == "danger":
1384 return severity == "danger"
1385 if health == "warning":
1386 return severity == "warning"
1387 if health == "expired":
1388 return state == "expired" or item.get("isExpired") is True
1389 if health == "expiring_soon":
1390 return "expires_soon" in reasons
1391 if health == "storage_issue":
1392 return state == "storage_incomplete" or "storage_metadata_incomplete" in reasons
1393 if health == "never_retrieved":
1394 return "never_retrieved" in reasons
1395 if health == "healthy":
1396 return severity == "success"
1397 if health == "permanent":
1398 return state == "permanent"
1399
1400 return True
1401
1402 def _normalize_sort_by(self, sort_by: str) -> str:
1403 normalized = sort_by.replace("-", "_").strip().lower()

Callers 1

_match_admin_fileMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected