Skip to content

Commit

Permalink
fixed decor to show messages only when the wrapped object is called.
Browse files Browse the repository at this point in the history
Signed-off-by: Xuesong Yang <1646669+XuesongYang@users.noreply.github.com>
  • Loading branch information
XuesongYang committed Jun 2, 2023
1 parent 5428a97 commit a0d153f
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions nemo/utils/decorators/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@

__all__ = ['experimental']

from nemo.utils import logging


def experimental(cls):
""" Decorator which indicates that module is experimental.
Use it to mark experimental or research modules.
"""

def wrapped(cls):
logging.warning(
f'Module {cls} is experimental, not ready for production and is not fully supported. Use at your own risk.'
)
from nemo.utils import logging
import wrapt

return cls

return wrapped(cls=cls)
@wrapt.decorator
def experimental(wrapped, instance, args, kwargs):
logging.warning(f"`{wrapped}` is experimental and not ready for production yet. Use at your own risk.")
return wrapped(*args, **kwargs)

0 comments on commit a0d153f

Please sign in to comment.