INNER CODE UNIT · Python
parse_commit_date
LiuMengxuan04/shushu-internship-tool · skills/shushu-internship-tool/scripts/shushu_internship_tool/candidate_score.py:38
def parse_commit_date(raw: Any) -> date | None:
if not raw:
return None
text = str(raw).strip()
for fmt in ("%Y-%m-%d", "%Y/%m/%d", "%Y-%m", "%Y"):
try:
parsed = datetime.strptime(text, fmt)
return parsed.date()
except ValueError:
continue
return None
def _clamped_explicit_score(
candidate: dict[str, Any],
keys: tuple[str, ...],
*,
default: int,