Skip to content

chore: annotate bag of words query inputs - #145

Open
RoboX2020 wants to merge 3 commits into
petercorke:mainfrom
RoboX2020:typing/bag-of-words-inputs
Open

RoboX2020 wants to merge 3 commits into
petercorke:mainfrom
RoboX2020:typing/bag-of-words-inputs

Conversation

@RoboX2020

Copy link
Copy Markdown

Incremental contribution to #60, limited to BagOfWords inputs.

Annotate constructor image iterables/features, similarity and retrieve queries, and word-id vectors. A private structural protocol describes queries that have len() and yield Images, so lazy FileCollection inputs remain accepted without claiming they are Sequence instances. Postponed annotations avoid evaluating the new unions at import time. No clustering or retrieval algorithm changes.

Added a static fixture covering Image, image lists/iterators, BaseFeature2D, FileCollection, None construction, and ndarray queries.

Validation on Python 3.11:

  • Pyright on tests/typing/bag_of_words.py with the project virtual environment: 0 errors.
  • A separate local negative fixture rejects integer queries, string queries, and string word IDs (3 errors as expected).
  • Pyright on BagOfWords.py reports the same 15 existing diagnostics before and after, with no new diagnostic messages. This PR does not claim the module is type-clean.
  • Existing bag test passes on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full OpenCV 5 suite: 959 passed, 97 skipped, 5 subtests passed.
  • Both changed files pass black; static fixture passes ruff. Two existing source long-line lint findings remain.

The exemplars inputs and its return annotation remain for a later pass. Full suite on OpenCV 4 was not run.

Add annotations for constructor image iterables, finite queries, and word-id vectors. No runtime algorithm changes.
Exercise feature, image, iterable, finite file collection and NumPy query annotations with Pyright.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
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.

1 participant