Skip to content

Commit b8213f2

Browse files
authored
PYTHON-4698 Rename the async ClientEncryption to AsyncClientEncryption (#1816)
1 parent f439204 commit b8213f2

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

pymongo/asynchronous/encryption.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ async def close(self) -> None:
304304

305305

306306
class RewrapManyDataKeyResult:
307-
"""Result object returned by a :meth:`~ClientEncryption.rewrap_many_data_key` operation.
307+
"""Result object returned by a :meth:`~AsyncClientEncryption.rewrap_many_data_key` operation.
308308
309309
.. versionadded:: 4.2
310310
"""
@@ -316,7 +316,7 @@ def __init__(self, bulk_write_result: Optional[BulkWriteResult] = None) -> None:
316316
def bulk_write_result(self) -> Optional[BulkWriteResult]:
317317
"""The result of the bulk write operation used to update the key vault
318318
collection with one or more rewrapped data keys. If
319-
:meth:`~ClientEncryption.rewrap_many_data_key` does not find any matching keys to rewrap,
319+
:meth:`~AsyncClientEncryption.rewrap_many_data_key` does not find any matching keys to rewrap,
320320
no bulk write operation will be executed and this field will be
321321
``None``.
322322
"""
@@ -506,7 +506,7 @@ def _create_mongocrypt_options(**kwargs: Any) -> MongoCryptOptions:
506506
return opts
507507

508508

509-
class ClientEncryption(Generic[_DocumentType]):
509+
class AsyncClientEncryption(Generic[_DocumentType]):
510510
"""Explicit client-side field level encryption."""
511511

512512
def __init__(
@@ -519,7 +519,7 @@ def __init__(
519519
) -> None:
520520
"""Explicit client-side field level encryption.
521521
522-
The ClientEncryption class encapsulates explicit operations on a key
522+
The AsyncClientEncryption class encapsulates explicit operations on a key
523523
vault collection that cannot be done directly on an AsyncMongoClient. Similar
524524
to configuring auto encryption on an AsyncMongoClient, it is constructed with
525525
an AsyncMongoClient (to a MongoDB cluster containing the key vault
@@ -1126,23 +1126,23 @@ async def rewrap_many_data_key(
11261126
result = await self._key_vault_coll.bulk_write(replacements)
11271127
return RewrapManyDataKeyResult(result)
11281128

1129-
async def __aenter__(self) -> ClientEncryption[_DocumentType]:
1129+
async def __aenter__(self) -> AsyncClientEncryption[_DocumentType]:
11301130
return self
11311131

11321132
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
11331133
await self.close()
11341134

11351135
def _check_closed(self) -> None:
11361136
if self._encryption is None:
1137-
raise InvalidOperation("Cannot use closed ClientEncryption")
1137+
raise InvalidOperation("Cannot use closed AsyncClientEncryption")
11381138

11391139
async def close(self) -> None:
11401140
"""Release resources.
11411141
11421142
Note that using this class in a with-statement will automatically call
11431143
:meth:`close`::
11441144
1145-
with ClientEncryption(...) as client_encryption:
1145+
with AsyncClientEncryption(...) as client_encryption:
11461146
encrypted = client_encryption.encrypt(value, ...)
11471147
decrypted = client_encryption.decrypt(encrypted)
11481148

pymongo/encryption_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def __init__(
7070
users. To configure automatic *decryption* without automatic
7171
*encryption* set ``bypass_auto_encryption=True``. Explicit
7272
encryption and explicit decryption is also supported for all users
73-
with the :class:`~pymongo.encryption.ClientEncryption` class.
73+
with the :class:`~pymongo.asynchronous.encryption.AsyncClientEncryption` and :class:`~pymongo.encryption.ClientEncryption` classes.
7474
7575
See :ref:`automatic-client-side-encryption` for an example.
7676

tools/synchro.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"_AsyncGridOutChunkIterator": "GridOutChunkIterator",
5959
"_a_grid_in_property": "_grid_in_property",
6060
"_a_grid_out_property": "_grid_out_property",
61+
"AsyncClientEncryption": "ClientEncryption",
6162
"AsyncMongoCryptCallback": "MongoCryptCallback",
6263
"AsyncExplicitEncrypter": "ExplicitEncrypter",
6364
"AsyncAutoEncrypter": "AutoEncrypter",

0 commit comments

Comments
 (0)