File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ # -------------------------------------------------------------------------
2+ # Copyright (c) PTC Inc. and/or all its affiliates. All rights reserved.
3+ # See License.txt in the project root for
4+ # license information.
5+ # --------------------------------------------------------------------------
6+
7+ # Note: The code within this file was created in total or in part
8+ # with the use of AI tools.
9+
10+ import warnings
11+ import functools
12+
13+ def _deprecated (reason ):
14+ """
15+ A decorator to mark functions as deprecated.
16+
17+ Args:
18+ reason (str): The reason why the function is deprecated.
19+
20+ Returns:
21+ function: The decorated function that emits a DeprecationWarning when called.
22+ """
23+ def decorator (func ):
24+ @functools .wraps (func )
25+ def wrapper (* args , ** kwargs ):
26+ warnings .warn (
27+ f"{ func .__name__ } is deprecated: { reason } " ,
28+ category = DeprecationWarning ,
29+ stacklevel = 2
30+ )
31+ return func (* args , ** kwargs )
32+ return wrapper
33+ return decorator
You can’t perform that action at this time.
0 commit comments