fix linting errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import networkx as nx
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("pyvis"):
|
||||
pm.install("pyvis")
|
||||
|
||||
|
@@ -256,7 +256,7 @@ const handlers = {
|
||||
const queryInput = document.getElementById('queryInput');
|
||||
const queryMode = document.getElementById('queryMode');
|
||||
const queryResult = document.getElementById('queryResult');
|
||||
|
||||
|
||||
let apiKey = localStorage.getItem('apiKey') || '';
|
||||
|
||||
queryBtn.addEventListener('click', async () => {
|
||||
@@ -372,4 +372,4 @@ window.removeFile = (fileName) => {
|
||||
</button>
|
||||
</div>
|
||||
`).join('');
|
||||
};
|
||||
};
|
||||
|
@@ -48,7 +48,6 @@ Usage:
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
@@ -133,5 +132,3 @@ class JsonKVStorage(BaseKVStorage):
|
||||
del self._data[id]
|
||||
await self.index_done_callback()
|
||||
logger.info(f"Successfully deleted {len(ids)} items from {self.namespace}")
|
||||
|
||||
|
||||
|
@@ -7,6 +7,7 @@ from lightrag.utils import logger
|
||||
from ..base import BaseVectorStorage
|
||||
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("pymilvus"):
|
||||
pm.install("pymilvus")
|
||||
from pymilvus import MilvusClient
|
||||
|
@@ -2,6 +2,7 @@ import os
|
||||
from tqdm.asyncio import tqdm as tqdm_async
|
||||
from dataclasses import dataclass
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("pymongo"):
|
||||
pm.install("pymongo")
|
||||
|
||||
|
@@ -47,6 +47,7 @@ Usage:
|
||||
from lightrag.storage.networkx_storage import NetworkXStorage
|
||||
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
from tqdm.asyncio import tqdm as tqdm_async
|
||||
|
@@ -4,6 +4,7 @@ import os
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Union, Tuple, List, Dict
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("neo4j"):
|
||||
pm.install("neo4j")
|
||||
|
||||
|
@@ -47,6 +47,7 @@ Usage:
|
||||
from lightrag.storage.networkx_storage import NetworkXStorage
|
||||
|
||||
"""
|
||||
|
||||
import html
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
|
@@ -8,6 +8,7 @@ from typing import Union, List, Dict, Set, Any, Tuple
|
||||
import numpy as np
|
||||
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("asyncpg"):
|
||||
pm.install("asyncpg")
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import os
|
||||
from tqdm.asyncio import tqdm as tqdm_async
|
||||
from dataclasses import dataclass
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("redis"):
|
||||
pm.install("redis")
|
||||
|
||||
|
@@ -5,17 +5,19 @@ from typing import Union
|
||||
|
||||
import numpy as np
|
||||
import pipmaster as pm
|
||||
|
||||
if not pm.is_installed("pymysql"):
|
||||
pm.install("pymysql")
|
||||
if not pm.is_installed("sqlalchemy"):
|
||||
pm.install("sqlalchemy")
|
||||
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
from tqdm import tqdm
|
||||
|
||||
from lightrag.base import BaseVectorStorage, BaseKVStorage, BaseGraphStorage
|
||||
from lightrag.utils import logger
|
||||
|
||||
|
||||
class TiDB(object):
|
||||
def __init__(self, config, **kwargs):
|
||||
self.host = config.get("host", None)
|
||||
|
@@ -16,9 +16,7 @@ import numpy as np
|
||||
import tiktoken
|
||||
|
||||
from lightrag.prompt import PROMPTS
|
||||
from typing import List
|
||||
import csv
|
||||
import io
|
||||
|
||||
|
||||
class UnlimitedSemaphore:
|
||||
"""A context manager that allows unlimited access."""
|
||||
@@ -237,16 +235,14 @@ def truncate_list_by_token_size(list_data: list, key: callable, max_token_size:
|
||||
return list_data
|
||||
|
||||
|
||||
|
||||
|
||||
def list_of_list_to_csv(data: List[List[str]]) -> str:
|
||||
output = io.StringIO()
|
||||
writer = csv.writer(
|
||||
output,
|
||||
quoting=csv.QUOTE_ALL, # Quote all fields
|
||||
escapechar='\\', # Use backslash as escape character
|
||||
quotechar='"', # Use double quotes
|
||||
lineterminator='\n' # Explicit line terminator
|
||||
quoting=csv.QUOTE_ALL, # Quote all fields
|
||||
escapechar="\\", # Use backslash as escape character
|
||||
quotechar='"', # Use double quotes
|
||||
lineterminator="\n", # Explicit line terminator
|
||||
)
|
||||
writer.writerows(data)
|
||||
return output.getvalue()
|
||||
@@ -254,16 +250,16 @@ def list_of_list_to_csv(data: List[List[str]]) -> str:
|
||||
|
||||
def csv_string_to_list(csv_string: str) -> List[List[str]]:
|
||||
# Clean the string by removing NUL characters
|
||||
cleaned_string = csv_string.replace('\0', '')
|
||||
|
||||
cleaned_string = csv_string.replace("\0", "")
|
||||
|
||||
output = io.StringIO(cleaned_string)
|
||||
reader = csv.reader(
|
||||
output,
|
||||
quoting=csv.QUOTE_ALL, # Match the writer configuration
|
||||
escapechar='\\', # Use backslash as escape character
|
||||
quotechar='"', # Use double quotes
|
||||
quoting=csv.QUOTE_ALL, # Match the writer configuration
|
||||
escapechar="\\", # Use backslash as escape character
|
||||
quotechar='"', # Use double quotes
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
return [row for row in reader]
|
||||
except csv.Error as e:
|
||||
|
@@ -2,10 +2,10 @@ accelerate
|
||||
aiofiles
|
||||
aiohttp
|
||||
configparser
|
||||
graspologic
|
||||
|
||||
# database packages
|
||||
networkx
|
||||
graspologic
|
||||
|
||||
# Basic modules
|
||||
numpy
|
||||
|
Reference in New Issue
Block a user