MOTOR-946 Deprecated APIs will not be Removed in Motor 3.0 (#168)

This commit is contained in:
Steven Silvester 2022-04-26 07:54:00 -05:00 committed by GitHub
parent c564a02cc4
commit 2f75a4030c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View File

@ -45,7 +45,7 @@ See the ``frameworks/tornado`` and ``frameworks/asyncio`` modules.
list above are not used internally in Motor. Instead of being removed
from the codebase, they have been left in a deprecated state to avoid
breaking any libraries built on top of Motor. These deprecated functions
will be removed in Motor 3.0.
may be removed in a future major release.
A framework-specific class, like ``MotorClient`` for Tornado or
``AsyncIOMotorClient`` for asyncio, is created by the

View File

@ -1324,8 +1324,8 @@ class AgnosticBaseCursor(AgnosticBase):
.. _`gen.coroutine`: http://tornadoweb.org/en/stable/gen.html
"""
warnings.warn(
"The fetch_next property is deprecated and will be "
"removed in Motor 3.0. Use `async for` to iterate "
"The fetch_next property is deprecated and may be "
"removed in a future major release. Use `async for` to iterate "
"over Cursor objects instead.",
DeprecationWarning,
stacklevel=2,
@ -1348,16 +1348,16 @@ class AgnosticBaseCursor(AgnosticBase):
"""**DEPRECATED** - Get a document from the most recently fetched
batch, or ``None``. See :attr:`fetch_next`.
The :meth:`next_object` method is deprecated and will be removed
in Motor 3.0. Use `async for` to elegantly iterate over
The :meth:`next_object` method is deprecated and may be removed
in a future major release. Use `async for` to elegantly iterate over
:class:`MotorCursor` objects instead.
.. versionchanged:: 2.2
Deprecated.
"""
warnings.warn(
"The next_object method is deprecated and will be "
"removed in Motor 3.0. Use Use `async for` to iterate "
"The next_object method is deprecated and may be "
"removed in a future major release. Use `async for` to iterate "
"over Cursor objects instead.",
DeprecationWarning,
stacklevel=2,

View File

@ -147,7 +147,7 @@ def pymongo_class_wrapper(f, pymongo_class):
def yieldable(future):
warnings.warn(
"The yieldable function is deprecated and will be removed in Motor 3.0",
"The yieldable function is deprecated and may be removed in a future major release",
DeprecationWarning,
stacklevel=2,
)

View File

@ -129,7 +129,7 @@ def pymongo_class_wrapper(f, pymongo_class):
def yieldable(future):
warnings.warn(
"The yieldable function is deprecated and will be removed in Motor 3.0",
"The yieldable function is deprecated and may be removed in a future major release.",
DeprecationWarning,
stacklevel=2,
)

View File

@ -43,6 +43,7 @@ class AgnosticGridOutCursor(AgnosticCursor):
def next_object(self):
"""**DEPRECATED** - Get next GridOut object from cursor."""
# Note: the super() call will raise a warning for the deprecation.
grid_out = super().next_object()
if grid_out:
grid_out_class = create_class_with_framework(