Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | from .uuid import generate_short_id, generate_uuid |
| 2 | |
| 3 | |
| 4 | class DeprecationError(Exception): |
| 5 | """Raised when deprecating some older functions. This is strictly for use |
| 6 | while developing and will be removed from the codebase later.""" |
| 7 | |
| 8 | pass |
| 9 | |
| 10 | |
| 11 | def deprecate(reason: str = "This function is deprecated"): |
| 12 | """Deprecation decorator. Provide `reason` to show why you're deprecating something. |
| 13 | NOTE: Decorating something with this will ensure that the function _will not run._ |
| 14 | """ |
| 15 | import functools |
| 16 | |
| 17 | def decorator(func): |
| 18 | @functools.wraps(func) |
| 19 | def wrapper(*args, **kwargs): |
| 20 | raise DeprecationError(f"{func.__name__} is deprecated: `{reason}`") |
| 21 | |
| 22 | return wrapper |
| 23 | |
| 24 | return decorator |
| 25 | |
| 26 | |
| 27 | __all__ = [ |
| 28 | "DeprecationError", |
| 29 | "deprecate", |
| 30 | "generate_short_id", |
| 31 | "generate_uuid", |
| 32 | ] |