From b43b56ed04a94c4157262160d4f8b1bb18a7d0c3 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 24 Jul 2026 03:32:27 +0800 Subject: [PATCH] chore: trim non-essential comments --- pageindex/__init__.py | 4 ---- pageindex/page_index.py | 6 +----- pageindex/page_index_md.py | 9 +-------- pageindex/tokens.py | 5 +---- pageindex/utils.py | 5 +---- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/pageindex/__init__.py b/pageindex/__init__.py index ab4350d..1b64ea9 100644 --- a/pageindex/__init__.py +++ b/pageindex/__init__.py @@ -9,8 +9,6 @@ _chatgpt_key = _os.getenv("CHATGPT_API_KEY") if not _os.getenv("OPENAI_API_KEY") and _chatgpt_key: _os.environ["OPENAI_API_KEY"] = _chatgpt_key -# Legacy (pre-SDK) exports. Cheap to import eagerly: litellm/PyPDF2 load -# inside the functions that use them, not at module import. from .index.page_index import * # noqa: E402 from .index.page_index_md import md_to_tree from .retrieve import get_document, get_document_structure, get_page_content @@ -71,8 +69,6 @@ __all__ = [ def __getattr__(name): - # `pageindex.utils` / `pageindex.page_index_md` attribute access without an - # explicit submodule import. if name in ("utils", "page_index_md"): import importlib return importlib.import_module(f".{name}", __name__) diff --git a/pageindex/page_index.py b/pageindex/page_index.py index 8cace07..b42f98a 100644 --- a/pageindex/page_index.py +++ b/pageindex/page_index.py @@ -1,8 +1,4 @@ -# pageindex/page_index.py -# Compatibility shim. The PDF indexing pipeline now lives in -# pageindex/index/page_index.py (the single source of truth). This module -# re-exports it so legacy imports (`from pageindex.page_index import ...`, -# `from pageindex import page_index`) keep working. +# pageindex/page_index.py — re-exports from index/page_index.py import sys import types from .index.page_index import * # noqa: F401,F403,E402 diff --git a/pageindex/page_index_md.py b/pageindex/page_index_md.py index d570b06..44713f3 100644 --- a/pageindex/page_index_md.py +++ b/pageindex/page_index_md.py @@ -1,9 +1,2 @@ -# pageindex/page_index_md.py -# Compatibility shim. The Markdown indexing pipeline now lives in -# pageindex/index/page_index_md.py (the single source of truth). This module -# re-exports it so legacy imports keep working. -# -# The canonical md_to_tree coerces legacy 'yes'/'no' string flags itself (a -# bare 'no' would otherwise be truthy) — this shim used to duplicate that -# coercion in its own wrapper; now it just re-exports the canonical function. +# pageindex/page_index_md.py — re-exports from index/page_index_md.py from .index.page_index_md import * # noqa: F401,F403,E402 diff --git a/pageindex/tokens.py b/pageindex/tokens.py index ab4386c..a47648c 100644 --- a/pageindex/tokens.py +++ b/pageindex/tokens.py @@ -1,8 +1,5 @@ # pageindex/tokens.py -# Leaf utility so both the parser and index layers can count tokens without -# the parser reaching back into pageindex.index (a reverse/horizontal -# dependency). Depends only on litellm (imported lazily — it's several -# seconds and a network fetch, and cloud-only paths never need it). +# Shared by parser and index layers (avoids a reverse dependency). def count_tokens(text, model=None): diff --git a/pageindex/utils.py b/pageindex/utils.py index ef5e793..c8d1773 100644 --- a/pageindex/utils.py +++ b/pageindex/utils.py @@ -1,7 +1,4 @@ -# pageindex/utils.py -# Compatibility shim. The indexing utilities now live in pageindex/index/utils.py, -# which is the single source of truth. This module re-exports them so legacy -# imports (`from pageindex.utils import ...`) keep working. +# pageindex/utils.py — re-exports from index/utils.py from .index.utils import * # noqa: F401,F403,E402 # Legacy 0.2.x alias. index.utils keeps it private (_config) so its star-export # can't shadow the pageindex.config submodule; re-expose it only in this shim.