LightRAG/lightrag/namespace.py
clssck 69358d830d test(lightrag,examples,api): comprehensive ruff formatting and type hints
Format entire codebase with ruff and add type hints across all modules:
- Apply ruff formatting to all Python files (121 files, 17K insertions)
- Add type hints to function signatures throughout lightrag core and API
- Update test suite with improved type annotations and docstrings
- Add pyrightconfig.json for static type checking configuration
- Create prompt_optimized.py and test_extraction_prompt_ab.py test files
- Update ruff.toml and .gitignore for improved linting configuration
- Standardize code style across examples, reproduce scripts, and utilities
2025-12-05 15:17:06 +01:00

28 lines
901 B
Python

from __future__ import annotations
from collections.abc import Iterable
# All namespace should not be changed
class NameSpace:
KV_STORE_FULL_DOCS = 'full_docs'
KV_STORE_TEXT_CHUNKS = 'text_chunks'
KV_STORE_LLM_RESPONSE_CACHE = 'llm_response_cache'
KV_STORE_FULL_ENTITIES = 'full_entities'
KV_STORE_FULL_RELATIONS = 'full_relations'
KV_STORE_ENTITY_CHUNKS = 'entity_chunks'
KV_STORE_RELATION_CHUNKS = 'relation_chunks'
VECTOR_STORE_ENTITIES = 'entities'
VECTOR_STORE_RELATIONSHIPS = 'relationships'
VECTOR_STORE_CHUNKS = 'chunks'
GRAPH_STORE_CHUNK_ENTITY_RELATION = 'chunk_entity_relation'
DOC_STATUS = 'doc_status'
def is_namespace(namespace: str, base_namespace: str | Iterable[str]):
if isinstance(base_namespace, str):
return namespace.endswith(base_namespace)
return any(is_namespace(namespace, ns) for ns in base_namespace)