Skip to content

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

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick marked this pull request as ready for review July 24, 2023 21:32
@sleepyStick sleepyStick requested a review from ShaneHarvey July 24, 2023 21:32
"""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:
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes!

@@ -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]
Copy link
Member

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?

Copy link
Contributor Author

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

@sleepyStick sleepyStick requested a review from ShaneHarvey July 24, 2023 22:31
@sleepyStick sleepyStick merged commit c259dde into mongodb:master Jul 25, 2023
@sleepyStick sleepyStick deleted the PYTHON-3860 branch July 25, 2023 21:25
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