Skip to content

Commit 37f5a62

Browse files
committed
⚰️ remove utils.deprecated decorator implementation
1 parent 34269f4 commit 37f5a62

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

discord/utils.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import asyncio
3030
import collections.abc
3131
import datetime
32-
import functools
3332
import itertools
3433
import json
3534
import re
@@ -359,57 +358,6 @@ def warn_deprecated(
359358
warnings.simplefilter("default", DeprecationWarning) # reset filter
360359

361360

362-
def deprecated(
363-
instead: str | None = None,
364-
since: str | None = None,
365-
removed: str | None = None,
366-
reference: str | None = None,
367-
stacklevel: int = 3,
368-
*,
369-
use_qualname: bool = True,
370-
) -> Callable[[Callable[[P], T]], Callable[[P], T]]:
371-
"""A decorator implementation of :func:`warn_deprecated`. This will automatically call :func:`warn_deprecated` when
372-
the decorated function is called.
373-
374-
Parameters
375-
----------
376-
instead: Optional[:class:`str`]
377-
A recommended alternative to the function.
378-
since: Optional[:class:`str`]
379-
The version in which the function was deprecated. This should be in the format ``major.minor(.patch)``, where
380-
the patch version is optional.
381-
removed: Optional[:class:`str`]
382-
The version in which the function is planned to be removed. This should be in the format
383-
``major.minor(.patch)``, where the patch version is optional.
384-
reference: Optional[:class:`str`]
385-
A reference that explains the deprecation, typically a URL to a page such as a changelog entry or a GitHub
386-
issue/PR.
387-
stacklevel: :class:`int`
388-
The stacklevel kwarg passed to :func:`warnings.warn`. Defaults to 3.
389-
use_qualname: :class:`bool`
390-
Whether to use the qualified name of the function in the deprecation warning. If ``False``, the short name of
391-
the function will be used instead. For example, __qualname__ will display as ``Client.login`` while __name__
392-
will display as ``login``. Defaults to ``True``.
393-
"""
394-
395-
def actual_decorator(func: Callable[[P], T]) -> Callable[[P], T]:
396-
@functools.wraps(func)
397-
def decorated(*args: P.args, **kwargs: P.kwargs) -> T:
398-
warn_deprecated(
399-
name=func.__qualname__ if use_qualname else func.__name__,
400-
instead=instead,
401-
since=since,
402-
removed=removed,
403-
reference=reference,
404-
stacklevel=stacklevel,
405-
)
406-
return func(*args, **kwargs)
407-
408-
return decorated
409-
410-
return actual_decorator
411-
412-
413361
def oauth_url(
414362
client_id: int | str,
415363
*,

0 commit comments

Comments
 (0)