refactor: rename module conv_to_ics to generate_ics
This commit is contained in:
parent
95b34564ec
commit
2cd76c2dd6
|
|
@ -50,7 +50,7 @@ def ranger(lst):
|
||||||
yield fr, to
|
yield fr, to
|
||||||
|
|
||||||
|
|
||||||
def conv_json_to_ics(data, filename):
|
def generate_ics(data, filename):
|
||||||
"""
|
"""
|
||||||
将爬取的节假日JSON数据转换为ICS
|
将爬取的节假日JSON数据转换为ICS
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ from zipfile import ZipFile
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from fetch_holidays import CustomJSONEncoder, fetch_holiday
|
from fetch_holidays import CustomJSONEncoder, fetch_holiday
|
||||||
from conv_to_ics import conv_json_to_ics
|
from generate_ics import generate_ics
|
||||||
|
|
||||||
|
|
||||||
class ChinaTimezone(tzinfo):
|
class ChinaTimezone(tzinfo):
|
||||||
|
|
@ -71,7 +71,7 @@ def update_data(year: int) -> str:
|
||||||
cls=CustomJSONEncoder,
|
cls=CustomJSONEncoder,
|
||||||
)
|
)
|
||||||
|
|
||||||
conv_json_to_ics(data, filename=f"{year}")
|
generate_ics(data, filename=f"{year}")
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ def update_holiday_ics(fr_year, to_year):
|
||||||
data = json.loads(inf.read())
|
data = json.loads(inf.read())
|
||||||
big_days.extend(data.get("days"))
|
big_days.extend(data.get("days"))
|
||||||
|
|
||||||
conv_json_to_ics(
|
generate_ics(
|
||||||
{"days": sorted(big_days, key=lambda x: x["date"])}, filename="holiday-cn"
|
{"days": sorted(big_days, key=lambda x: x["date"])}, filename="holiday-cn"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user