lint(src): 规范导入语句及代码格式
This commit is contained in:
parent
4552cf800c
commit
e5e39d25ef
@ -3,8 +3,9 @@ from dotenv import load_dotenv
|
||||
load_dotenv("src/.env", override=True)
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor # noqa: E402
|
||||
from src.config import config # noqa: E402
|
||||
from src.knowledge import knowledge_base, graph_base # noqa: E402
|
||||
from src.config import config as config # noqa: E402
|
||||
from src.knowledge import knowledge_base as knowledge_base # noqa: E402
|
||||
from src.knowledge import graph_base as graph_base # noqa: E402
|
||||
|
||||
|
||||
executor = ThreadPoolExecutor()
|
||||
executor = ThreadPoolExecutor() # noqa: E402
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from src.models.chat_model import select_model, get_custom_model
|
||||
from src.models.embedding import select_embedding_model
|
||||
|
||||
__all__ = ['select_model', 'select_embedding_model', 'get_custom_model']
|
||||
__all__ = ["select_model", "select_embedding_model", "get_custom_model"]
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
def load_keywords(file_path: str) -> List[str]:
|
||||
|
||||
def load_keywords(file_path: str) -> list[str]:
|
||||
"""Loads keywords from a file, one per line."""
|
||||
if not os.path.exists(file_path):
|
||||
keywords = []
|
||||
with open(file_path, "r", encoding="utf-8") as f:
|
||||
with open(file_path, encoding="utf-8") as f:
|
||||
keywords = [line.strip() for line in f if line.strip() and not line.startswith("#")]
|
||||
|
||||
return keywords
|
||||
|
||||
|
||||
class ContentGuard:
|
||||
def __init__(self, keywords_file: str = "src/static/bad_keywords.txt"):
|
||||
self.keywords = load_keywords(keywords_file)
|
||||
@ -30,5 +31,6 @@ class ContentGuard:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
# Global instance
|
||||
content_guard = ContentGuard()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user