1818
1919DATE_RE = re .compile (r"^\d{4}-\d{2}-\d{2}$" )
2020IMAGE_EXT_RE = re .compile (r"\.(png|jpe?g|webp)$" , re .IGNORECASE )
21- TEMP_BOT_BRANCH_RE = re .compile (r"/paper-images/pr-\d+(/|$)" )
2221ALLOWED_DOCS_URL_RE = re .compile (
2322 r"^https?://raw\.githubusercontent\.com/MilesCranmer/PySR_Docs/(?:"
24- r"master|main|refs/heads/master|refs/heads/main| [0-9a-f]{40}"
23+ r"master|main|[0-9a-f]{40}|refs/heads/[^\s]+|paper-images/pr-\d+ "
2524 r")/images/[^\s]+$" ,
2625 re .IGNORECASE ,
2726)
@@ -40,6 +39,7 @@ def main() -> None:
4039 if not PAPERS_PATH .exists ():
4140 fail (f"Missing { PAPERS_PATH } " )
4241
42+
4343 raw = PAPERS_PATH .read_text (encoding = "utf-8" )
4444
4545 try :
@@ -102,13 +102,9 @@ def main() -> None:
102102 # We expect authors to upload an image with the PR. URLs are typically
103103 # only used after a maintainer moves images to PySR_Docs.
104104 # Allow only the stable raw.githubusercontent.com location in PySR_Docs.
105- if TEMP_BOT_BRANCH_RE .search (image_s ):
106- errors .append (
107- f"{ prefix } .image: points to temporary bot branch URL; use a local uploaded image path (preferred)"
108- )
109- elif not ALLOWED_DOCS_URL_RE .match (image_s ):
105+ if not ALLOWED_DOCS_URL_RE .match (image_s ):
110106 errors .append (
111- f"{ prefix } .image: URL must be the stable PySR_Docs raw URL (or upload an image in this PR)"
107+ f"{ prefix } .image: URL must be a raw.githubusercontent.com URL into MilesCranmer/ PySR_Docs under /images/ (or upload an image in this PR)"
112108 )
113109 else :
114110 # Must be a basename only (no paths)
0 commit comments