Skip to content

Fixed ruff lint issues for src/contextual_retrieval#370

Open
nuwangeek wants to merge 48 commits intobuerokratt:wipfrom
rootcodelabs:llm-369
Open

Fixed ruff lint issues for src/contextual_retrieval#370
nuwangeek wants to merge 48 commits intobuerokratt:wipfrom
rootcodelabs:llm-369

Conversation

@nuwangeek
Copy link
Collaborator

This pull request introduces several improvements focused on type hinting, resource management, and code clarity across the contextual retrieval modules. The main themes are stricter type annotations, improved resource cleanup, and enhanced code maintainability.

Type hinting and interface clarity:

  • Added explicit return type annotations (-> None, -> "HTTPClientManager", etc.) to constructors and key methods in classes such as SmartBM25Search, DynamicProviderDetection, QdrantContextualSearch, DynamicRankFusion, and ContextualRetriever for improved code clarity and static analysis. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Introduced TYPE_CHECKING imports and forward references for HTTPClientManager in relevant files to avoid circular dependencies and clarify interface boundaries. [1] [2] [3] [4] [5] [6]

Resource management and cleanup:

  • Updated close methods in multiple classes to use explicit return types (-> None) and ensure proper cleanup of HTTP client resources. [1] [2] [3] [4]

Code clarity and robustness:

  • Improved exception handling in get_client by chaining exceptions with from e for better error traceability.
  • Updated batch query search logic in ContextualRetriever to use zip(..., strict=True) for stricter input validation and safer parallel processing.
  • Refined comments and variable naming for readability, such as clarifying timeout units and loop variable usage. [1] [2]

Configuration and linting:

  • Added per-file ignore rules in pyproject.toml for Ruff linter to accommodate legitimate special cases (e.g., missing type annotations, camelCase fields for API contracts, print statements in scripts).

nuwangeek and others added 30 commits February 20, 2026 16:06
Get update from wip into llm-316
get update from wip into llm-304
Service layer validation in tool classifier (buerokratt#321)
Pulling changes from BYK wip to LLM-Module WIP
Get update from wip into optimization/data-enrichment
Get update from optimization/data-enrichment into optimization/vector-indexer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants