-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add search classes to strict type checking #1841
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1841 +/- ##
==========================================
- Coverage 90.12% 90.12% -0.01%
==========================================
Files 300 300
Lines 39563 39569 +6
Branches 8595 8595
==========================================
+ Hits 35657 35662 +5
Misses 2585 2585
- Partials 1321 1322 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍🏽
One small comment.
src/palace/manager/search/service.py
Outdated
for name in result.keys(): | ||
if name.startswith(f"{self.base_revision_name}-"): | ||
return name | ||
return name # type: ignore[no-any-return] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. It looks like name
should be a str
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could see client is untyped so self._client.indices.get_alias
ends up giving us an Any
type, which means name
ends up being Any
. I type hinted the returned dict, so we get a better type then Any
.
7c352bc
to
e76cfec
Compare
e76cfec
to
7a8d100
Compare
* Add type hints to search classes * Set future annotations * Update to string annotations * Don't use recursive type references, due to ugly syntax and incompatibility with union operator * update type hint a bit
Description
Our search document classes were already typed, they were just missing a few hints necessary to add them to the list of classes that opt into strict type checking.
Motivation and Context
Since I'm working on these classes in PP-1225 I added the missing hints here.
How Has This Been Tested?
Checklist