(self, f)
return wrapper
Returns a wrapper for the one-dimensional function that can handle
        multidimensional arguments.
Returns a wrapper for the one-dimensional function that can handle
        multidimensional arguments.
Returns a wrapper for the one - dimensional function that can handle multidimensional arguments .
def __call__(self, f):
        """
        Returns a wrapper for the one-dimensional function that can handle
        multidimensional arguments.
        """
        @wraps(f)
        def wrapper(*args, **kwargs):
            # Get arguments that should be treated multidimensional
            if self.mdargs:
                mdargs = self.mdargs
            else:
                mdargs = range(len(args)) + kwargs.keys()

            arglength = len(args)

            for n in mdargs:
                if isinstance(n, int):
                    if n >= arglength:
                        continue
                    entry = args[n]
                    is_arg = True
                elif isinstance(n, str):
                    try:
                        entry = kwargs[n]
                    except KeyError:
                        continue
                    is_arg = False
                if hasattr(entry, "__iter__"):
                    # Create now a copy of the given array and manipulate then
                    # the entries directly.
                    if is_arg:
                        args = list(args)
                        args[n] = structure_copy(entry)
                    else:
                        kwargs[n] = structure_copy(entry)
                    result = apply_on_element(wrapper, args, kwargs, n)
                    return result
            return f(*args, **kwargs)
        return wrapper
def __call__ ( self , f ) : @ wraps ( f ) def wrapper ( * args , * * kwargs ) : # Get arguments that should be treated multidimensional if self . mdargs : mdargs = self . mdargs else : mdargs = range ( len ( args ) ) + kwargs . keys ( ) arglength = len ( args ) for n in mdargs : if isinstance ( n , int ) : if n >= arglength : continue entry = args [ n ] is_arg = True elif isinstance ( n , str ) : try : entry = kwargs [ n ] except KeyError : continue is_arg = False if hasattr ( entry , "__iter__" ) : # Create now a copy of the given array and manipulate then # the entries directly. if is_arg : args = list ( args ) args [ n ] = structure_copy ( entry ) else : kwargs [ n ] = structure_copy ( entry ) result = apply_on_element ( wrapper , args , kwargs , n ) return result return f ( * args , * * kwargs ) return wrapper