-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-3366 Support mypy 0.971 and test with latest version #1021
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
@@ -1308,7 +1308,7 @@ def encode( | |||
""" | |||
return cls(encode(document, check_keys, codec_options)) | |||
|
|||
def decode(self, codec_options: CodecOptions = DEFAULT_CODEC_OPTIONS) -> _DocumentType: # type: ignore[override] | |||
def decode(self, codec_options: "CodecOptions[_DocumentType]" = DEFAULT_CODEC_OPTIONS) -> _DocumentType: # type: ignore[override,assignment] |
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.
The "assignment" ignore is required to silence this error:
bson/__init__.py: note: In member "decode" of class "BSON":
bson/__init__.py:1311: error: Incompatible default for argument "codec_options" (default has type "CodecOptions[MutableMapping[str, Any]]", argument
has type "CodecOptions[_DocumentType]") [assignment]
def decode(self, codec_options: "CodecOptions[_DocumentType]" = DEFAULT_CODEC_OPTIONS) -> _DocumentType: # type: ignore[override]
pymongo/pyopenssl_context.py
Outdated
@@ -192,7 +192,7 @@ def __init__(self, protocol): | |||
# side configuration and wrap_socket tries to support both client and | |||
# server side sockets. | |||
self._callback_data.check_ocsp_endpoint = True | |||
self._ctx.set_ocsp_client_callback(callback=_ocsp_callback, data=self._callback_data) | |||
self._ctx.set_ocsp_client_callback(callback=_ocsp_callback, data=self._callback_data) # type: ignore[arg-type] |
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.
This ignore is required until python/typeshed#8371 is fixed and released.
The remaining errors are in the tests and look like:
Looks like a mypy bug. I'm not sure why it considers these types are incompatible. Perhaps "_DocumentType" is incompatible with "object"? I believe this is a typeshed bug that will be fixed by: python/typeshed#8373 |
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.
LGTM!
https://jira.mongodb.org/browse/PYTHON-3366
Changes: