mirror of
https://github.com/ComposioHQ/composio.git
synced 2026-09-22 11:46:35 +08:00
a1cf6c589c
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: rahul@composio.dev <rahultarak12345@gmail.com>
33 lines
837 B
Python
33 lines
837 B
Python
from .uuid import generate_short_id, generate_uuid
|
|
|
|
|
|
class DeprecationError(Exception):
|
|
"""Raised when deprecating some older functions. This is strictly for use
|
|
while developing and will be removed from the codebase later."""
|
|
|
|
pass
|
|
|
|
|
|
def deprecate(reason: str = "This function is deprecated"):
|
|
"""Deprecation decorator. Provide `reason` to show why you're deprecating something.
|
|
NOTE: Decorating something with this will ensure that the function _will not run._
|
|
"""
|
|
import functools
|
|
|
|
def decorator(func):
|
|
@functools.wraps(func)
|
|
def wrapper(*args, **kwargs):
|
|
raise DeprecationError(f"{func.__name__} is deprecated: `{reason}`")
|
|
|
|
return wrapper
|
|
|
|
return decorator
|
|
|
|
|
|
__all__ = [
|
|
"DeprecationError",
|
|
"deprecate",
|
|
"generate_short_id",
|
|
"generate_uuid",
|
|
]
|