(value: Any)
| 133 | def _parse_iso_date(value: Any) -> Optional[date]: |
| 134 | text = str(value or "").strip() |
| 135 | if not text: |
| 136 | return None |
| 137 | for fmt, width in (("%Y-%m-%d", 10), ("%Y%m%d", 8)): |
| 138 | try: |
| 139 | return datetime.strptime(text[:width], fmt).date() |
| 140 | except ValueError: |
| 141 | pass |
| 142 | return None |
| 143 | |
| 144 | |
| 145 | def _paper_date_in_window(paper: Dict[str, Any], start_date: date, end_date: date) -> bool: |
| 146 | paper_date = _parse_iso_date((paper or {}).get("publish_date") or (paper or {}).get("published")) |
| 147 | if paper_date is None: |
no outgoing calls
no test coverage detected