Heuristic filter for direct PDF-style URLs used for reading reports.
(url: Any)
| 1066 | |
| 1067 | |
| 1068 | def looks_like_pdf_http_url(url: Any) -> bool: |
| 1069 | """Heuristic filter for direct PDF-style URLs used for reading reports.""" |
| 1070 | candidate = str(url or "").strip() |
| 1071 | if not candidate: |
| 1072 | return False |
| 1073 | if "://" not in candidate: |
| 1074 | candidate = f"https://{candidate.lstrip('/')}" |
| 1075 | lowered = candidate.casefold() |
| 1076 | return ( |
| 1077 | lowered.startswith(("http://", "https://")) |
| 1078 | and ( |
| 1079 | ".pdf" in lowered |
| 1080 | or "/pdf?" in lowered |
| 1081 | or "/pdf/" in lowered |
| 1082 | or "arxiv.org/pdf/" in lowered |
| 1083 | or "openreview.net/pdf" in lowered |
| 1084 | ) |
| 1085 | ) |
| 1086 | |
| 1087 | |
| 1088 | def extract_pdf_url(text: Any) -> Optional[str]: |
no outgoing calls
no test coverage detected