Fix linting

This commit is contained in:
yangdx
2025-03-26 23:53:41 +08:00
parent e7f68f7b77
commit dfa63e863c
2 changed files with 12 additions and 4 deletions

View File

@@ -8,7 +8,6 @@ from typing import Optional, List, Tuple
import sys import sys
from ascii_colors import ASCIIColors from ascii_colors import ASCIIColors
import logging import logging
from ascii_colors import ASCIIColors
from lightrag.api import __api_version__ from lightrag.api import __api_version__
from fastapi import HTTPException, Security, Request, status from fastapi import HTTPException, Security, Request, status
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -17,13 +16,16 @@ from starlette.status import HTTP_403_FORBIDDEN
from .auth import auth_handler from .auth import auth_handler
from ..prompt import PROMPTS from ..prompt import PROMPTS
def check_env_file(): def check_env_file():
""" """
Check if .env file exists and handle user confirmation if needed. Check if .env file exists and handle user confirmation if needed.
Returns True if should continue, False if should exit. Returns True if should continue, False if should exit.
""" """
if not os.path.exists(".env"): if not os.path.exists(".env"):
warning_msg = "Warning: .env file not found. Some features may not work properly." warning_msg = (
"Warning: .env file not found. Some features may not work properly."
)
ASCIIColors.yellow(warning_msg) ASCIIColors.yellow(warning_msg)
# Check if running in interactive terminal # Check if running in interactive terminal
@@ -34,6 +36,7 @@ def check_env_file():
return False return False
return True return True
# Load environment variables # Load environment variables
load_dotenv() load_dotenv()

View File

@@ -75,7 +75,12 @@ class LightragPathFilter(logging.Filter):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
# Define paths to be filtered # Define paths to be filtered
self.filtered_paths = ["/documents", "/health", "/webui/", "/documents/pipeline_status"] self.filtered_paths = [
"/documents",
"/health",
"/webui/",
"/documents/pipeline_status",
]
# self.filtered_paths = ["/health", "/webui/"] # self.filtered_paths = ["/health", "/webui/"]
def filter(self, record): def filter(self, record):