teoat commited on
Commit
ec220b3
·
verified ·
1 Parent(s): 64ffdd8

Upload app/routers/deprecation.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app/routers/deprecation.py +12 -4
app/routers/deprecation.py CHANGED
@@ -58,7 +58,9 @@ async def get_deprecation_warning_list():
58
  "success": True,
59
  "timestamp": datetime.utcnow().isoformat(),
60
  "warnings": warnings,
61
- "critical_warnings": len([w for w in warnings if w["severity"] == "critical"]),
 
 
62
  "high_warnings": len([w for w in warnings if w["severity"] == "high"]),
63
  "action_required": len(warnings) > 0,
64
  }
@@ -85,14 +87,18 @@ async def list_deprecated_endpoints():
85
  "removal_date": info["removal_date"],
86
  "replacement": info["replacement"],
87
  "status": "deprecated",
88
- "days_until_removal": (datetime.fromisoformat(info["removal_date"]) - datetime.utcnow()).days,
 
 
89
  }
90
  )
91
 
92
  return {
93
  "success": True,
94
  "timestamp": datetime.utcnow().isoformat(),
95
- "deprecated_endpoints": sorted(endpoints, key=lambda x: x["days_until_removal"]),
 
 
96
  "total_count": len(endpoints),
97
  }
98
  except Exception as e:
@@ -149,7 +155,9 @@ async def get_migration_guide():
149
  "support_contact": "See /docs for support information",
150
  }
151
  except Exception as e:
152
- raise HTTPException(status_code=500, detail=f"Failed to get migration guide: {e!s}")
 
 
153
 
154
 
155
  @router.get("/health")
 
58
  "success": True,
59
  "timestamp": datetime.utcnow().isoformat(),
60
  "warnings": warnings,
61
+ "critical_warnings": len(
62
+ [w for w in warnings if w["severity"] == "critical"]
63
+ ),
64
  "high_warnings": len([w for w in warnings if w["severity"] == "high"]),
65
  "action_required": len(warnings) > 0,
66
  }
 
87
  "removal_date": info["removal_date"],
88
  "replacement": info["replacement"],
89
  "status": "deprecated",
90
+ "days_until_removal": (
91
+ datetime.fromisoformat(info["removal_date"]) - datetime.utcnow()
92
+ ).days,
93
  }
94
  )
95
 
96
  return {
97
  "success": True,
98
  "timestamp": datetime.utcnow().isoformat(),
99
+ "deprecated_endpoints": sorted(
100
+ endpoints, key=lambda x: x["days_until_removal"]
101
+ ),
102
  "total_count": len(endpoints),
103
  }
104
  except Exception as e:
 
155
  "support_contact": "See /docs for support information",
156
  }
157
  except Exception as e:
158
+ raise HTTPException(
159
+ status_code=500, detail=f"Failed to get migration guide: {e!s}"
160
+ )
161
 
162
 
163
  @router.get("/health")