Transforms data into different form
        :param func: lambda expression on how to perform transformation
        :return: new Enumerable object containing transformed data
514829
def select(self, func=lambda x: x):
        
        return Enumerable(itertools.imap(func, self))
424342
def each(self, func):
        
        if self._clean.isTuple() or self._clean.isList():
            for index, value in enumerate(self.obj):
                r = func(value, index, self.obj)
                if r is "breaker":
                    break
        else:
            for index, key in enumerate(self.obj):
                r = func(self.obj[key], key, self.obj, index)
                if r is "breaker":
                    break
        return self._wrap(self)
745074
def data_structure_builder(func):
    
    @wraps(func)
    def ds_builder_wrapper(function, *args, **kwargs):
        try:
            function = DSBuilder(function)
        except NoBuilder:
            pass
        return func(function, *args, **kwargs)

    return ds_builder_wrapper
419529
def map(self, func):
        
        ns = self.Namespace()
        ns.results = []

        def by(value, index, list, *args):
            ns.results.append(func(value, index, list))

        _(self.obj).each(by)
        return self._wrap(ns.results)
12207
def _convert_errors(func):
    
    cast_Invalid = lambda e: Invalid(
        u"{message}, expected {expected}".format(
            message=e.message,
            expected=e.expected)
        if e.expected != u'-none-' else e.message,
        e.path,
        six.text_type(e))

    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except good.SchemaError as e:
            raise SchemaError(six.text_type(e))
        except good.MultipleInvalid as ee:
            raise MultipleInvalid([cast_Invalid(e) for e in ee])
        except good.Invalid as e:
            # Since voluptuous throws MultipleInvalid almost always -- we follow the same pattern...
            raise MultipleInvalid([cast_Invalid(e)])
    return wrapper
1288012
def can_use_enum(func):
    

    @wraps(func)
    def inner(self, value):
        if isinstance(value, Enum):
            return self.check_value(value.value) or func(self, value.value)

        return func(self, value)

    return inner
1366117
def reduce(self, func):
        

        # avoid RDD.reduce() which does not return an RDD
        return self.transform(
            lambda rdd: (
                rdd
                .map(lambda i: (None, i))
                .reduceByKey(func)
                .map(lambda none_i: none_i[1])
            )
        )
1169653
function transformData(methodRegExp) {
    var transform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (data) {
        return data;
    };

    var re = new RegExp(methodRegExp || '.*');

    // The middleware function
    return function transformDataMiddleware(next) {
        // Checks if the call should be transformed. If yes, it applies the transform function
        function checkAndTransform(method) {
            return re.test(method) ? function (req) {
                return next[method](req).then(function (res) {
                    return Object.assign(res, { data: transform(res.data) });
                });
            } : function (req) {
                return next[method](req);
            };
        }

        // The middleware connector:
        return {
            create: checkAndTransform('create'),
            read: checkAndTransform('read'),
            update: checkAndTransform('update'),
            delete: checkAndTransform('delete')
        };
    };
}
964512
def _apply_to_data(data, func, unpack_dict=False):
    
    apply_ = partial(_apply_to_data, func=func, unpack_dict=unpack_dict)

    if isinstance(data, dict):
        if unpack_dict:
            return [apply_(v) for v in data.values()]
        return {k: apply_(v) for k, v in data.items()}

    if isinstance(data, (list, tuple)):
        try:
            # e.g.list/tuple of arrays
            return [apply_(x) for x in data]
        except TypeError:
            return func(data)

    return func(data)
266354
def serialize_query(func):
        
        @functools.wraps(func)
        def wrapper(self, query, *args, **kwargs):
            if hasattr(query, 'serialize'):
                query = query.serialize()

            assert isinstance(query, basestring), 'Expected query to be string'
            if self.debug:
                print('SQL:', query)

            return func(self, query, *args, **kwargs)
        return wrapper
1135823
def _reduce_method(cls, func):
        
        def wrapped_func(self, **kwargs):
            from .dataarray import DataArray

            reduced = self.obj.variable.coarsen(
                self.windows, func, self.boundary, self.side)
            coords = {}
            for c, v in self.obj.coords.items():
                if c == self.obj.name:
                    coords[c] = reduced
                else:
                    if any(d in self.windows for d in v.dims):
                        coords[c] = v.variable.coarsen(
                            self.windows, self.coord_func[c],
                            self.boundary, self.side)
                    else:
                        coords[c] = v
            return DataArray(reduced, dims=self.obj.dims, coords=coords)

        return wrapped_func
291312
def apply(self, func, axis, *args, **kwargs):
        
        if callable(func):
            return self._callable_func(func, axis, *args, **kwargs)
        elif isinstance(func, dict):
            return self._dict_func(func, axis, *args, **kwargs)
        elif is_list_like(func):
            return self._list_like_func(func, axis, *args, **kwargs)
        else:
            pass
428720
def order_by_t(func):
    
    return Transformation(
        'order_by({0})'.format(name(func)),
        lambda sequence: sorted(sequence, key=func),
        None
    )
551718
def map(self, func):
        
        for row in self.table:
            for i, cell in enumerate(row):
                row[i] = func(cell)
1295597
def transform(self, data):
        
        out = {}
        for key, val in data.items():
            if key in self._transform_map:
                target = self._transform_map[key]
                key, val = target(key, val) if type(target) == types.FunctionType else (key, target)

            out[key] = val


        return out
1200793
def _callable_func(self, func, axis, *args, **kwargs):
        

        def callable_apply_builder(df, axis=0):
            if not axis:
                df.index = index
                df.columns = pandas.RangeIndex(len(df.columns))
            else:
                df.columns = index
                df.index = pandas.RangeIndex(len(df.index))
            result = df.apply(func, axis=axis, *args, **kwargs)
            return result

        index = self.index if not axis else self.columns
        func_prepared = self._build_mapreduce_func(callable_apply_builder, axis=axis)
        result_data = self._map_across_full_axis(axis, func_prepared)
        return self._post_process_apply(result_data, axis)
111526
def _wrap(cls, func):
        

        if isinstance(func, cls):
            return func
        return functools.update_wrapper(cls(func), func)