Fokko commented on code in PR #962: URL: https://github.com/apache/iceberg-python/pull/962#discussion_r1708979503
########## pyiceberg/utils/deprecated.py: ########## @@ -30,16 +30,33 @@ def deprecated(deprecated_in: str, removed_in: str, help_message: Optional[str] def decorator(func: Callable): # type: ignore @functools.wraps(func) def new_func(*args: Any, **kwargs: Any) -> Any: - warnings.simplefilter("always", DeprecationWarning) # turn off filter - - warnings.warn( - f"Call to {func.__name__}, deprecated in {deprecated_in}, will be removed in {removed_in}.{help_message}", - category=DeprecationWarning, - stacklevel=2, - ) - warnings.simplefilter("default", DeprecationWarning) # reset filter + message = f"Call to {func.__name__}, deprecated in {deprecated_in}, will be removed in {removed_in}.{help_message}" + + _deprecation_warning(message) + return func(*args, **kwargs) return new_func return decorator + + +def deprecation_message(deprecated_in: str, removed_in: str, help_message: Optional[str]) -> None: Review Comment: Nice addition, I like it a lot 👍 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org