added special deprecation warning error

This commit is contained in:
Jakub Trllo 2022-06-28 10:42:48 +02:00
parent 46bfa3122f
commit 843d92484d

View file

@ -1,7 +1,16 @@
"""Code related to editorial utility functions was moved
to 'openpype.pipeline.editorial' please change your imports as soon as
possible. File will be probably removed in OpenPype 3.14.*
"""
import warnings
import functools
class EditorialDeprecatedWarning(DeprecationWarning):
pass
def editorial_deprecated(func):
"""Mark functions as deprecated.
@ -10,12 +19,13 @@ def editorial_deprecated(func):
@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter("always", EditorialDeprecatedWarning)
warnings.warn(
(
"Call to deprecated function '{}'."
" Function was moved to 'openpype.pipeline.editorial'."
).format(func.__name__),
category=DeprecationWarning,
category=EditorialDeprecatedWarning,
stacklevel=2
)
return func(*args, **kwargs)