mirror of
https://github.com/Paillat-dev/pycord-rest.git
synced 2026-01-02 00:56:19 +00:00
✨ Enhance not_supported decorator to issue a SyntaxWarning for unsupported functions (#10)
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import functools
|
import functools
|
||||||
import logging
|
import logging
|
||||||
|
import warnings
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Callable, Coroutine
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from typing import Any, Never, override
|
from typing import Any, Never, override
|
||||||
@@ -47,6 +48,11 @@ def not_supported[T, U](func: Callable[[T], U]) -> Callable[[T], U]:
|
|||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def inner(*args: T, **kwargs: T) -> U:
|
def inner(*args: T, **kwargs: T) -> U:
|
||||||
logger.warning(f"{func.__qualname__} is not supported by REST apps.")
|
logger.warning(f"{func.__qualname__} is not supported by REST apps.")
|
||||||
|
warnings.warn(
|
||||||
|
f"{func.__qualname__} is not supported by REST apps.",
|
||||||
|
SyntaxWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return func(*args, **kwargs)
|
return func(*args, **kwargs)
|
||||||
|
|
||||||
return inner
|
return inner
|
||||||
|
|||||||
Reference in New Issue
Block a user