Skip to content

PYTHON-3803 add types to encryption.py #1296

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 4 commits into from
Jul 11, 2023

Conversation

sleepyStick
Copy link
Contributor

@sleepyStick sleepyStick marked this pull request as ready for review July 10, 2023 15:57
@@ -1025,9 +1025,21 @@ def encode(
return _dict_to_bson(document, check_keys, codec_options)


@overload
def decode(data: "_ReadableBuffer", codec_options: None = None) -> Dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

Nice! This is great! I think we want to apply this same overload pattern throughout the codebase but I think that's too much for this PR. Could you open a new ticket for it? Eg decode_all, decode_iter, and anywhere else we use _DocumentType.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, made the ticket

bson/raw_bson.py Outdated
@@ -62,7 +62,7 @@

def _inflate_bson(
bson_bytes: bytes, codec_options: CodecOptions, raw_array: bool = False
) -> Mapping[Any, Any]:
) -> MutableMapping[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.

Can we use dict 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.

yes!

@sleepyStick sleepyStick merged commit f813f56 into mongodb:master Jul 11, 2023
@sleepyStick sleepyStick deleted the PYTHON-3803 branch July 11, 2023 15:24
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