dtoolkit.util._decorator.warning#
- dtoolkit.util._decorator.warning(message: str, category: Exception = None, stacklevel: int = 2, **kwargs)[source]#
A warning decorator.
- Parameters:
- messagestr
The warning information to user.
- categoryException, optional
If given, must be a warning category class. it defaults to
UserWarning
.- stacklevelint
Default to find the first place in the stack that is not inside dtoolkit.
- **kwargs
See the documentation for
warnings.warn()
for complete details on the keyword arguments.
See also
Examples
>>> from dtoolkit.util._decorator import warning >>> @warning("This's a warning message.") ... def func(*args, **kwargs): ... ... >>> func()