mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-04 02:26:11 +08:00
♻️ 精简assert
This commit is contained in:
parent
4fd87a46b8
commit
efe792ec66
@ -46,9 +46,9 @@ def update_time_feed_1():
|
|||||||
root = ET.fromstring(file)
|
root = ET.fromstring(file)
|
||||||
item = root.find("channel/item")
|
item = root.find("channel/item")
|
||||||
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
||||||
assert item is not None
|
assert item
|
||||||
pubdate_elem = item.find("pubDate")
|
pubdate_elem = item.find("pubDate")
|
||||||
assert pubdate_elem is not None
|
assert pubdate_elem
|
||||||
pubdate_elem.text = current_time
|
pubdate_elem.text = current_time
|
||||||
return ET.tostring(root, encoding="unicode")
|
return ET.tostring(root, encoding="unicode")
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ def update_time_feed_2():
|
|||||||
root = ET.fromstring(file)
|
root = ET.fromstring(file)
|
||||||
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
|
||||||
published_element = root.find(".//{*}published")
|
published_element = root.find(".//{*}published")
|
||||||
assert published_element is not None
|
assert published_element
|
||||||
published_element.text = current_time
|
published_element.text = current_time
|
||||||
return ET.tostring(root, encoding="unicode")
|
return ET.tostring(root, encoding="unicode")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user