From 2729a3ca971e46227065622d8ef5f2e2bf3e6c80 Mon Sep 17 00:00:00 2001 From: Samuel Chen <454867105@qq.com> Date: Wed, 20 Nov 2024 15:27:29 +0800 Subject: [PATCH] Fix: Repull code from sz134055 #387 https://github.com/Samueli924/chaoxing/pull/387 --- api/answer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/answer.py b/api/answer.py index 19482921..82736471 100644 --- a/api/answer.py +++ b/api/answer.py @@ -1,7 +1,6 @@ import configparser import requests from pathlib import Path -from typing import Optional import json from api.logger import logger import random @@ -20,7 +19,7 @@ def __init__(self, file: str = "cache.json"): self.cacheFile.open("w").write("{}") self.fp = self.cacheFile.open("r+", encoding="utf8") - def getCache(self, question: str) -> Optional[str]: + def getCache(self, question: str): self.fp.seek(0) data = json.load(self.fp) if isinstance(data, dict): @@ -83,7 +82,7 @@ def _init_tiku(self): # 仅用于题库初始化,例如配置token,交由自定义题库完成 pass - def config_set(self,config:configparser.ConfigParser|None): + def config_set(self,config): self._conf = config def _get_conf(self): @@ -99,7 +98,7 @@ def _get_conf(self): self.DISABLE = True return None - def query(self,q_info:dict) -> str|None: + def query(self,q_info:dict): if self.DISABLE: return None