Transformation for Sequence.order_by
    :param func: order_by function
    :return: transformation
428720
def order_by_t(func):
    
    return Transformation(
        'order_by({0})'.format(name(func)),
        lambda sequence: sorted(sequence, key=func),
        None
    )
1172902
def _transform_coordinates(
            self,
            func: Callable[[Union[int, float], Union[int, float]],
                           Tuple[Union[int, float], Union[int, float]]]
    ) -> None:
        """"""

        def func_x(x: Union[int, float]) -> Union[int, float]:
            return func(x, 0)[0]

        def func_y(y: Union[int, float]) -> Union[int, float]:
            return func(0, y)[1]

        self.entries = {
            cast(Tuple[int, int], func(int(x), int(y))): v
            for (x, y), v in self.entries.items()
        }
        self.vertical_lines = [
            _VerticalLine(func_x(x), func_y(y1), func_y(y2), emph)
            for x, y1, y2, emph in self.vertical_lines]
        self.horizontal_lines = [
            _HorizontalLine(func_y(y), func_x(x1), func_x(x2), emph)
            for y, x1, x2, emph in self.horizontal_lines]
        self.horizontal_padding = {
            int(func_x(int(x))): padding
            for x, padding in self.horizontal_padding.items()
        }
        self.vertical_padding = {
            int(func_y(int(y))): padding
            for y, padding in self.vertical_padding.items()
        }
554144
def tails_t(wrap):
    
    return Transformation(
        'tails',
        lambda sequence: [wrap(sequence[i:]) for i in range(len(sequence) + 1)],
        {ExecutionStrategies.PRE_COMPUTE}
    )
1298782
def distinct_by_t(func):
    
    def distinct_by(sequence):
        distinct_lookup = {}
        for element in sequence:
            key = func(element)
            if key not in distinct_lookup:
                distinct_lookup[key] = element
        return distinct_lookup.values()
    return Transformation('distinct_by({0})'.format(name(func)), distinct_by, None)
357702
def creation_ordered(class_to_decorate):
    

    next_index = functools.partial(next, itertools.count())

    __init__orig = class_to_decorate.__init__

    @functools.wraps(__init__orig, assigned=['__doc__'])
    def __init__(self, *args, **kwargs):
        object.__setattr__(self, '_index', next_index())
        __init__orig(self, *args, **kwargs)

    setattr(class_to_decorate, '__init__', __init__)

    # noinspection PyProtectedMember
    def __lt__(self, other):
        return self._index < other._index  # pragma: no mutate

    setattr(class_to_decorate, '__lt__', __lt__)

    class_to_decorate = functools.total_ordering(class_to_decorate)

    return class_to_decorate
3177
def copy_func(func: Callable) -> Callable:
    
    copied = types.FunctionType(
        func.__code__, func.__globals__, name=func.__name__,
        argdefs=func.__defaults__, closure=func.__closure__)
    copied = functools.update_wrapper(copied, func)
    copied.__kwdefaults__ = func.__kwdefaults__
    return copied
503564
def walk_json(d, func):
    
    if isinstance(d, Mapping):
        return OrderedDict((k, walk_json(v, func)) for k, v in d.items())
    elif isinstance(d, list):
        return [walk_json(v, func) for v in d]
    else:
        return func(d)
306680
def order_results_by(*fields):
    
    def decorator(f):
        @functools.wraps(f)
        def wrapper(*args, **kw):
            result = f(*args, **kw)
            return result.order_by(*fields)
        return wrapper
    return decorator
1026561
def transform(function):
        
        def transform_fn(_, result):
            if isinstance(result, Nothing):
                return result

            lgr.debug("Transforming %r with %r", result, function)
            try:
                return function(result)
            except:
                exctype, value, tb = sys.exc_info()
                try:
                    new_exc = StyleFunctionError(function, exctype, value)
                    # Remove the "During handling ..." since we're
                    # reraising with the traceback.
                    new_exc.__cause__ = None
                    six.reraise(StyleFunctionError, new_exc, tb)
                finally:
                    # Remove circular reference.
                    # https://docs.python.org/2/library/sys.html#sys.exc_info
                    del tb
        return transform_fn
1102214
def map(self, func, *columns):
        
        if not columns:
            return map(func, self.rows)
        else:
            values = (self.values(column) for column in columns)
            result = [map(func, v) for v in values]
            if len(columns) == 1:
                return result[0]
            else:
                return result
411572
def filter(self, func):
        # type: (Callable[[BaseCollection], bool]) -> _CollectionGroupBy
        
        results = OrderedDict()  # type: OrderedDict
        for name, group in self:
            if func(group):
                results[name] = group

        return self.__class__(results)
551718
def map(self, func):
        
        for row in self.table:
            for i, cell in enumerate(row):
                row[i] = func(cell)
1024030
def reduce_by(fn: Callable[[T1, T1], T1]) -> Callable[[ActualIterable[T1]], T1]:
    
    return lambda collection: functools.reduce(fn, collection)
638040
def dict2orderedlist(dic, order_list, default='', **kwargs):
    
    result = []
    for key_order in order_list:
        value = get_element(dic, key_order, **kwargs)
        result.append(value if value is not None else default)
    return result
132778
def map(self, func: Callable[[Tuple[Any, Log]], Tuple[Any, Log]]) -> 'Writer':
        
        a, w = self.run()
        b, _w = func((a, w))
        return Writer(b, _w)
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)
49455
function sequence() {
    var funcs = arguments;
    var funcCount = funcs.length;
    return function() {
      var args = arguments;
      for (var i = 0; i < funcCount; i++) {
        args[0] = funcs[i].apply(this, args);
      }
      return args[0];
    };
  }