Files
devin-ai-integration[bot] a1cf6c589c fix: correct typo in deprecate decorator error message (#2257)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: rahul@composio.dev <rahultarak12345@gmail.com>
2025-12-13 13:01:15 +05:30

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",
]