Skip to content

Commit

Permalink
MOTOR-946 Deprecated APIs will not be Removed in Motor 3.0 (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Apr 26, 2022
1 parent c564a02 commit 2f75a40
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doc/developer-guide.rst
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions motor/core.py
Expand Up @@ -1324,8 +1324,8 @@ def fetch_next(self):
.. _`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,
Expand All @@ -1348,16 +1348,16 @@ def next_object(self):
"""**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,
Expand Down
2 changes: 1 addition & 1 deletion motor/frameworks/asyncio/__init__.py
Expand Up @@ -147,7 +147,7 @@ async def _wrapper(self, *args, **kwargs):

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,
)
Expand Down
2 changes: 1 addition & 1 deletion motor/frameworks/tornado/__init__.py
Expand Up @@ -129,7 +129,7 @@ async def _wrapper(self, *args, **kwargs):

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,
)
Expand Down
1 change: 1 addition & 0 deletions motor/motor_gridfs.py
Expand Up @@ -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(
Expand Down

0 comments on commit 2f75a40

Please sign in to comment.