def _with_element(method):
    'Wrap function and pass a NewElement proto to be filled.\n\n    This is a function decorator.\n\n    Converts a method of the with arguments (self, element, ...) into a method\n    with arguments (self, ...). Thus, the instantiation of the element proto\n    object and creation of the element are handled automatically.\n\n    Parameters\n    ----------\n    method : callable\n        A DeltaGenerator method with arguments (self, element, ...)\n\n    Returns\n    -------\n    callable\n        A new DeltaGenerator method with arguments (self, ...)\n\n    '

    @_wraps_with_cleaned_sig(method, 1)
    def wrapped_method(dg, *args, **kwargs):
        caching.maybe_show_cached_st_function_warning(dg, method.__name__)
        delta_type = method.__name__
        last_index = None
        if ((delta_type in DELTAS_TYPES_THAT_MELT_DATAFRAMES) and (len(args) > 0)):
            data = args[0]
            if type_util.is_dataframe_compatible(data):
                data = type_util.convert_anything_to_df(data)
                if (data.index.size > 0):
                    last_index = data.index[(- 1)]
                else:
                    last_index = None

        def marshall_element(element):
            return method(dg, element, *args, **kwargs)
        return dg._enqueue_new_element_delta(marshall_element, delta_type, last_index)
    return wrapped_method
Wrap function and pass a NewElement proto to be filled.

This is a function decorator.

Converts a method of the with arguments (self, element, ...) into a method
with arguments (self, ...). Thus, the instantiation of the element proto
object and creation of the element are handled automatically.

Parameters
----------
method : callable
    A DeltaGenerator method with arguments (self, element, ...)

Returns
-------
callable
    A new DeltaGenerator method with arguments (self, ...)
def _with_element(method):
    'Wrap function and pass a NewElement proto to be filled.\n\n    This is a function decorator.\n\n    Converts a method of the with arguments (self, element, ...) into a method\n    with arguments (self, ...). Thus, the instantiation of the element proto\n    object and creation of the element are handled automatically.\n\n    Parameters\n    ----------\n    method : callable\n        A DeltaGenerator method with arguments (self, element, ...)\n\n    Returns\n    -------\n    callable\n        A new DeltaGenerator method with arguments (self, ...)\n\n    '

    @_wraps_with_cleaned_sig(method, 1)
    def wrapped_method(dg, *args, **kwargs):
        caching.maybe_show_cached_st_function_warning(dg, method.__name__)
        delta_type = method.__name__
        last_index = None
        if ((delta_type in DELTAS_TYPES_THAT_MELT_DATAFRAMES) and (len(args) > 0)):
            data = args[0]
            if type_util.is_dataframe_compatible(data):
                data = type_util.convert_anything_to_df(data)
                if (data.index.size > 0):
                    last_index = data.index[(- 1)]
                else:
                    last_index = None

        def marshall_element(element):
            return method(dg, element, *args, **kwargs)
        return dg._enqueue_new_element_delta(marshall_element, delta_type, last_index)
    return wrapped_method