feat: raise error when paper not found for past years

This commit is contained in:
NateScarlet 2021-09-24 20:18:40 +08:00
parent 2540e46507
commit a3cfca7a4d
No known key found for this signature in database
GPG Key ID: 5C242793B070309C

View File

@ -4,7 +4,7 @@
import argparse import argparse
import json import json
import re import re
from datetime import date, timedelta from datetime import date, datetime, timedelta
from itertools import chain from itertools import chain
from typing import Iterator, List, Optional, Tuple from typing import Iterator, List, Optional, Tuple
@ -73,6 +73,8 @@ def get_paper_urls(year: int) -> List[str]:
ret = [i for i in ret if i not in PAPER_EXCLUDE] ret = [i for i in ret if i not in PAPER_EXCLUDE]
ret += PAPER_INCLUDE.get(year, []) ret += PAPER_INCLUDE.get(year, [])
ret.sort() ret.sort()
if not ret and datetime.today().year >= year:
raise RuntimeError("could not found papers for %d" % year)
return ret return ret