查了脚本执行次数也没有超,不知道为何不显示
脚本如下:
import datetime
national_day = “国庆节”
mid_autumn_festival = “中秋”
anti_fascist_70th_day = “中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日”
节假日列表和周末工作日列表(同上)
holidays = {
datetime.date(year=2023, month=1, day=1): Holiday.new_years_day.value,
datetime.date(year=2023, month=1, day=2): Holiday.new_years_day.value,
datetime.date(year=2023, month=1, day=21): Holiday.spring_festival.value,
datetime.date(year=2023, month=1, day=22): Holiday.spring_festival.value,
datetime.date(year=2023, month=1, day=23): Holiday.spring_festival.value,
datetime.date(year=2023, month=1, day=24): Holiday.spring_festival.value,
datetime.date(year=2023, month=1, day=25): Holiday.spring_festival.value,
datetime.date(year=2023, month=1, day=26): Holiday.spring_festival.value,
datetime.date(year=2023, month=4, day=5): Holiday.tomb_sweeping_day.value,
datetime.date(year=2023, month=5, day=1): Holiday.labour_day.value,
datetime.date(year=2023, month=6, day=22): Holiday.dragon_boat_festival.value,
datetime.date(year=2023, month=9, day=29): Holiday.mid_autumn_festival.value,
datetime.date(year=2023, month=10, day=1): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=2): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=3): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=4): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=5): Holiday.national_day.value,
datetime.date(year=2023, month=10, day=6): Holiday.national_day.value,
datetime.date(year=2024, month=1, day=1): Holiday.new_years_day.value,
datetime.date(year=2024, month=2, day=9): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=10): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=10): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=11): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=12): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=13): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=14): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=15): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=16): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=17): Holiday.spring_festival,
datetime.date(year=2024, month=4, day=4): Holiday.tomb_sweeping_day,
datetime.date(year=2024, month=4, day=5): Holiday.tomb_sweeping_day,
datetime.date(year=2024, month=4, day=6): Holiday.tomb_sweeping_day,
datetime.date(year=2024, month=5, day=1): Holiday.labour_day,
datetime.date(year=2024, month=5, day=2): Holiday.labour_day,
datetime.date(year=2024, month=5, day=3): Holiday.labour_day,
datetime.date(year=2024, month=5, day=4): Holiday.labour_day,
datetime.date(year=2024, month=5, day=5): Holiday.labour_day,
datetime.date(year=2024, month=6, day=8): Holiday.dragon_boat_festival,
datetime.date(year=2024, month=6, day=9): Holiday.dragon_boat_festival,
datetime.date(year=2024, month=6, day=10): Holiday.dragon_boat_festival,
datetime.date(year=2024, month=9, day=15): Holiday.mid_autumn_festival,
datetime.date(year=2024, month=9, day=16): Holiday.mid_autumn_festival,
datetime.date(year=2024, month=9, day=17): Holiday.mid_autumn_festival,
datetime.date(year=2024, month=10, day=1): Holiday.national_day,
datetime.date(year=2024, month=10, day=2): Holiday.national_day,
datetime.date(year=2024, month=10, day=3): Holiday.national_day,
datetime.date(year=2024, month=10, day=4): Holiday.national_day,
datetime.date(year=2024, month=10, day=5): Holiday.national_day,
datetime.date(year=2024, month=10, day=6): Holiday.national_day,
datetime.date(year=2024, month=10, day=7): Holiday.national_day,
# … 剩余节假日
}
workdays = {
datetime.date(year=2024, month=1, day=4): Holiday.spring_festival.value,
datetime.date(year=2024, month=2, day=4): Holiday.spring_festival,
datetime.date(year=2024, month=2, day=18): Holiday.spring_festival,
datetime.date(year=2024, month=4, day=7): Holiday.tomb_sweeping_day,
datetime.date(year=2024, month=4, day=28): Holiday.national_day,
datetime.date(year=2024, month=5, day=11): Holiday.labour_day,
datetime.date(year=2024, month=9, day=14): Holiday.mid_autumn_festival,
datetime.date(year=2024, month=9, day=29): Holiday.national_day,
datetime.date(year=2024, month=10, day=12): Holiday.national_day,
# … 剩余周末工作日
}
辅助函数(同上)
def _wrap_date(date):
if isinstance(date, datetime.datetime):
date = date.date()
return date
def _validate_date(*dates):
if len(dates) != 1:
return list(map(_validate_date, dates))
date = _wrap_date(dates[0])
if not isinstance(date, datetime.date):
raise NotImplementedError(“unsupported type {}, expected type is datetime.date”.format(type(date)))
min_year, max_year = min(holidays.keys()).year, max(holidays.keys()).year
if not (min_year <= date.year <= max_year):
raise NotImplementedError(
“no available data for year {}, only year between [{}, {}] supported”.format(date.year, min_year, max_year)
)
return date
def is_workday(date):
“”"