def since(version):
    """
    A decorator that annotates a function to append the version of Spark the function was added.
    """
    import re
    indent_p = re.compile(r'\n( +)')

    def deco(f):
        indents = indent_p.findall(f.__doc__)
        indent = ' ' * (min(len(m) for m in indents) if indents else 0)
        f.__doc__ = f.__doc__.rstrip() + "\n\n%s.. versionadded:: %s" % (indent, version)
        return f
    return deco
def since ( version ) : import re indent_p = re . compile ( r'\n( +)' ) def deco ( f ) : indents = indent_p . findall ( f . __doc__ ) indent = ' ' * ( min ( len ( m ) for m in indents ) if indents else 0 ) f . __doc__ = f . __doc__ . rstrip ( ) + "\n\n%s.. versionadded:: %s" % ( indent , version ) return f return deco
A decorator that annotates a function to append the version of Spark the function was added.