From 3319db0dba5b6efebeab34ea2c6a7d1b328e328a Mon Sep 17 00:00:00 2001 From: Yannick Stephan Date: Sat, 15 Feb 2025 22:37:32 +0100 Subject: [PATCH] cleaned code --- lightrag/base.py | 10 +++------- lightrag/types.py | 1 - lightrag/utils.py | 2 +- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lightrag/base.py b/lightrag/base.py index 1d7a0a98..3d4fc022 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -163,17 +163,13 @@ class BaseGraphStorage(StorageNameSpace): """Get an edge by its source and target node ids.""" async def get_edge( - self, - source_node_id: str, - target_node_id: str - ) -> dict[str, str] | None : + self, source_node_id: str, target_node_id: str + ) -> dict[str, str] | None: raise NotImplementedError """Get all edges connected to a node.""" - async def get_node_edges( - self, source_node_id: str - ) -> list[tuple[str, str]] | None: + async def get_node_edges(self, source_node_id: str) -> list[tuple[str, str]] | None: raise NotImplementedError """Upsert a node into the graph.""" diff --git a/lightrag/types.py b/lightrag/types.py index 2510bed3..40e61bc4 100644 --- a/lightrag/types.py +++ b/lightrag/types.py @@ -1,4 +1,3 @@ - from __future__ import annotations from pydantic import BaseModel diff --git a/lightrag/utils.py b/lightrag/utils.py index 5b86ee78..c8786e7b 100644 --- a/lightrag/utils.py +++ b/lightrag/utils.py @@ -488,7 +488,7 @@ def cosine_similarity(v1, v2): return dot_product / (norm1 * norm2) -def quantize_embedding(embedding: np.ndarray | list[float], bits: int=8) -> tuple: +def quantize_embedding(embedding: np.ndarray | list[float], bits: int = 8) -> tuple: """Quantize embedding to specified bits""" # Convert list to numpy array if needed if isinstance(embedding, list):