Skip to content

Commit

Permalink
Fix:(#381) Remove redundant typing. Adding support for Python < 3.10 …
Browse files Browse the repository at this point in the history
…and >3.8 (#387)

fix:(#381)去除不必要的类型提示,增强版本兼容性 (#387)
  • Loading branch information
sz134055 authored Nov 13, 2024
1 parent a642503 commit 33d9a25
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/answer.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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

Expand Down

0 comments on commit 33d9a25

Please sign in to comment.