Skip to content

Use module-qualified imports for storage.memory.semrefindex - #303

Open
Bernhard Merkle (bmerkle) wants to merge 1 commit into
microsoft:mainfrom
bmerkle:fix-import-style-semrefindex
Open

Use module-qualified imports for storage.memory.semrefindex#303
Bernhard Merkle (bmerkle) wants to merge 1 commit into
microsoft:mainfrom
bmerkle:fix-import-style-semrefindex

Conversation

@bmerkle

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • make (format, check on 3.12/3.14, test, build) — 0 pyright errors, 737 passed / 12 skipped, wheel builds

semrefindex (memory variant) is overwhelmingly function-oriented (18
functions + 1 class), so per AGENTS.md's import style guidelines it
defaults to module-qualified. Converts the remaining low-frequency
direct-symbol call sites:

- knowpro/add_messages.py: collect_action_terms, collect_entity_terms
- mcp/server.py: TermToSemanticRefIndex
- storage/memory/provider.py: TermToSemanticRefIndex

conversation_base.py already used `from ..storage.memory import
semrefindex` + qualified calls, so no change needed there.

The sqlite variant's own class (SqliteTermToSemanticRefIndex) exports
a single class and is left as direct-symbol import, already
compliant.

Scope: src/typeagent only, per microsoft#298.

Phase 2 (3/3) of the import-consistency cleanup tracked in microsoft#298.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes Phase 2 of the import-style standardization effort (#298) by switching remaining low-frequency call sites of the in-memory storage.memory.semrefindex module from direct-symbol imports to module-qualified usage, aligning src/typeagent with the established pattern already used in knowpro/conversation_base.py.

Changes:

  • Replace direct function imports (collect_action_terms, collect_entity_terms) with semrefindex.<fn> calls in the add-messages pipeline.
  • Replace direct class import (TermToSemanticRefIndex) with semrefindex.TermToSemanticRefIndex in MCP server typing and in-memory storage provider.
  • Keep sqlite semrefindex direct-symbol imports unchanged (single-class export, already consistent).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/typeagent/storage/memory/provider.py Imports semrefindex as a module and qualifies the TermToSemanticRefIndex type/constructor usage.
src/typeagent/mcp/server.py Switches to module import (semrefindex) and updates the QueryEvalContext type parameter accordingly.
src/typeagent/knowpro/add_messages.py Switches to module import (semrefindex) and qualifies calls to term-collection helpers.

@bmerkle

Copy link
Copy Markdown
Collaborator Author

robgruen would you mind taking a look at this one when you get a chance? Thanks!

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