-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-3860 add types to read_preferences.py #1320
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
Conversation
pymongo/read_preferences.py
Outdated
"""Restore from pickling.""" | ||
self.__mode = value["mode"] | ||
self.__mongos_mode = _MONGOS_MODES[self.__mode] | ||
self.__tag_sets = _validate_tag_sets(value["tag_sets"]) | ||
self.__max_staleness = _validate_max_staleness(value["max_staleness"]) | ||
self.__hedge = _validate_hedge(value["hedge"]) | ||
|
||
@abstractmethod | ||
def __call__(self, selection: Any) -> Any: |
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.
Could these types be more specific?
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.
yes!
test/test_read_preferences.py
Outdated
@@ -504,7 +504,7 @@ def test_read_preference_document_hedge(self): | |||
with self.assertRaises(TypeError): | |||
cls(hedge=[]) # type: ignore | |||
|
|||
pref = cls(hedge={}) | |||
pref = cls(hedge={}) # type: ignore[abstract] |
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.
What's the error 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.
was there because _ServerMode's __call__
was abstract. After talking irl, its now not abstract and these type ignore's have been removed
https://jira.mongodb.org/browse/PYTHON-3860