🐛 修复一些类型错误

This commit is contained in:
Azide 2023-09-12 15:50:07 +08:00 committed by felinae98
parent ffa180e8a6
commit 77e9fc3b50
3 changed files with 5 additions and 2 deletions

View File

@ -52,7 +52,7 @@ def init_fastapi():
app.mount("/bison", nonebot_app, "nonebot-bison")
driver = get_driver()
register_router_fastapi(driver, socket_app)
register_router_fastapi(driver, socket_app) # type: ignore
host = str(driver.config.host)
port = driver.config.port
if host in ["0.0.0.0", "127.0.0.1"]:

View File

@ -11,7 +11,7 @@ from .abstract_post import BasePost, AbstractPost
@dataclass
class _CustomPost(BasePost):
ms_factories: list[MessageSegmentFactory] = field(default_factory=list)
css_path: str | None = None # 模板文件所用css路径
css_path: str = "" # 模板文件所用css路径
async def generate_text_messages(self) -> list[MessageSegmentFactory]:
return self.ms_factories

View File

@ -46,7 +46,9 @@ def update_time_feed_1():
root = ET.fromstring(file)
item = root.find("channel/item")
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
assert item is not None
pubdate_elem = item.find("pubDate")
assert pubdate_elem is not None
pubdate_elem.text = current_time
return ET.tostring(root, encoding="unicode")
@ -57,6 +59,7 @@ def update_time_feed_2():
root = ET.fromstring(file)
current_time = datetime.now(pytz.timezone("GMT")).strftime("%a, %d %b %Y %H:%M:%S %Z")
published_element = root.find(".//{*}published")
assert published_element is not None
published_element.text = current_time
return ET.tostring(root, encoding="unicode")