Skip to content

Use module-qualified imports for storage.memory.propindex - #302

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

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

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

propindex (memory variant) exports a mix of an enum, several
functions, and a class. Per AGENTS.md's import style guidelines,
low-frequency symbols default to module-qualified:

- query.py: lookup_property_in_property_index
- secindex.py: build_property_index
- storage/memory/provider.py: PropertyIndex
- storage/sqlite/propindex.py: make_property_term_text,
  split_property_term_text (cross-imported from the memory variant)

PropertyNames is left as a direct-symbol import everywhere (query.py,
searchlang.py, searchlib.py): it's used 20+ times across those files,
squarely matching the "avoiding severe repetitive visual clutter"
exception in AGENTS.md.

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

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

Phase 2 (2/3) of the import-consistency cleanup tracked in microsoft#298.
Copilot AI review requested due to automatic review settings August 1, 2026 15:56

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

Aligns storage.memory.propindex usage with the repository’s module-qualified import style by switching low-frequency function/class imports to propindex.<symbol> while keeping PropertyNames as a direct import where it’s used heavily.

Changes:

  • Switched call sites to from ...storage.memory import propindex and updated calls to be module-qualified (propindex.*).
  • Updated in-memory provider to construct and type-annotate the property index via propindex.PropertyIndex.
  • Updated sqlite property index to call make_property_term_text / split_property_term_text via the module import.

Reviewed changes

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

File Description
src/typeagent/storage/sqlite/propindex.py Replaces direct function imports from memory propindex with a module import and qualified calls.
src/typeagent/storage/memory/provider.py Uses module-qualified propindex.PropertyIndex for instantiation and type annotation.
src/typeagent/knowpro/secindex.py Uses propindex.build_property_index(...) instead of importing the function directly.
src/typeagent/knowpro/query.py Uses propindex.lookup_property_in_property_index(...) while keeping PropertyNames as a direct import.

@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