def decorator(func): func.__doc__ = substituted appendix = "" if refer_to: appendix += _refer_to_note.format(refer_to) if one_column_method: appendix += _one_column_warning if appendix: func = append_to_docstring(appendix)(func) return func
def add_refer_to(method): """ Build decorator which appends link to the high-level equivalent method to the function's docstring. Parameters ---------- method : str Method name in ``modin.pandas`` module to refer to. Returns ------- callable """ # FIXME: this would break numpydoc if there already is a `Notes` section note = _refer_to_note.format(method) return append_to_docstring(note)
def add_deprecation_warning(replacement_method): """ Build decorator which appends deprecation warning to the function's docstring. Appended warning indicates that the current method duplicates functionality of some other method and so is slated to be removed in the future. Parameters ---------- replacement_method : str Name of the method to use instead of deprecated. Returns ------- callable """ message = _deprecation_warning.format(replacement_method) return append_to_docstring(message)
This method is supported only by one-column query compilers. """ _deprecation_warning = """ .. warning:: This method duplicates logic of ``{0}`` and will be removed soon. """ _refer_to_note = """ Notes ----- Please refer to ``modin.pandas.{0}`` for more information about parameters and output format. """ add_one_column_warning = append_to_docstring(_one_column_warning) def add_deprecation_warning(replacement_method): """ Build decorator which appends deprecation warning to the function's docstring. Appended warning indicates that the current method duplicates functionality of some other method and so is slated to be removed in the future. Parameters ---------- replacement_method : str Name of the method to use instead of deprecated. Returns