MCPcopy Create free account
hub / github.com/Nativu5/Gemini-FastAPI / _parse_duration

Function _parse_duration

scripts/rotate_lmdb.py:10–16  ·  view source on GitHub ↗

Parse duration in the format '14d' or '24h'.

(value: str)

Source from the content-addressed store, hash-verified

8
9
10def _parse_duration(value: str) -> timedelta:
11 """Parse duration in the format '14d' or '24h'."""
12 if value.endswith("d"):
13 return timedelta(days=int(value[:-1]))
14 if value.endswith("h"):
15 return timedelta(hours=int(value[:-1]))
16 raise ValueError("Invalid duration format. Use Nd or Nh")
17
18
19def _should_delete(record: dict[str, Any], threshold: datetime) -> bool:

Callers 1

rotate_lmdbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected