Fix linting

This commit is contained in:
yangdx
2025-02-01 15:22:40 +08:00
parent a0710e9d65
commit 95edf8a51e
2 changed files with 15 additions and 14 deletions

View File

@@ -13,18 +13,6 @@ from fastapi import (
from typing import Dict from typing import Dict
import threading import threading
# Global progress tracker
scan_progress: Dict = {
"is_scanning": False,
"current_file": "",
"indexed_count": 0,
"total_files": 0,
"progress": 0,
}
# Lock for thread-safe operations
progress_lock = threading.Lock()
import json import json
import os import os
@@ -34,7 +22,7 @@ import logging
import argparse import argparse
import time import time
import re import re
from typing import List, Dict, Any, Optional, Union from typing import List, Any, Optional, Union
from lightrag import LightRAG, QueryParam from lightrag import LightRAG, QueryParam
from lightrag.api import __api_version__ from lightrag.api import __api_version__
@@ -57,8 +45,21 @@ import pipmaster as pm
from dotenv import load_dotenv from dotenv import load_dotenv
# Load environment variables
load_dotenv() load_dotenv()
# Global progress tracker
scan_progress: Dict = {
"is_scanning": False,
"current_file": "",
"indexed_count": 0,
"total_files": 0,
"progress": 0,
}
# Lock for thread-safe operations
progress_lock = threading.Lock()
def estimate_tokens(text: str) -> int: def estimate_tokens(text: str) -> int:
"""Estimate the number of tokens in text """Estimate the number of tokens in text

View File

@@ -463,7 +463,7 @@ def quantize_embedding(embedding: Union[np.ndarray, list], bits=8) -> tuple:
# Convert list to numpy array if needed # Convert list to numpy array if needed
if isinstance(embedding, list): if isinstance(embedding, list):
embedding = np.array(embedding) embedding = np.array(embedding)
# Calculate min/max values for reconstruction # Calculate min/max values for reconstruction
min_val = embedding.min() min_val = embedding.min()
max_val = embedding.max() max_val = embedding.max()