Create a helper function handle recursion
185759
function initClientRendered(widgetDefs, document) {
    // Ensure that event handlers to handle delegating events are
    // always attached before initializing any widgets
    eventDelegation.init();

    document = document || window.document;
    for (var i=0,len=widgetDefs.length; i<len; i++) {
        var widgetDef = widgetDefs[i];

        if (widgetDef.children.length) {
            initClientRendered(widgetDef.children, document);
        }

        var widget = initWidget(
            widgetDef.type,
            widgetDef.id,
            widgetDef.config,
            widgetDef.state,
            widgetDef.scope,
            widgetDef.domEvents,
            widgetDef.customEvents,
            widgetDef.extend,
            widgetDef.bodyElId,
            widgetDef.existingWidget,
            null,
            document);

        widgetDef.widget = widget;
    }
}
1140820
function makeCountNCallback(n, cb) {
        var count = 0,
            results = [],
            error;
        return function(index, err, result) {
            results[index] = result;
            if (!error && err) {
                error = err;
                return cb(err);
            }
            if (!error && ++count == n) {
                cb(null, results);
            }
        };
    }
491687
function recursive (node, depth, index) {
    let hashLeft
    let hashRight
    let summingBuffer

    // case with single node in tree
    if (depth === 0 && node.val !== undefined) {
      return getHash(node.val, depth, index * 2)
    }

    if (node.left === undefined) {
      throw new Error('Left node is missed.')
    }
    if (typeof node.left === 'string') {
      if (!validateHexadecimal(node.left)) {
        throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
      }
      hashLeft = node.left
    } else {
      if (!isObject(node.left)) {
        throw new TypeError('Invalid type of left node.')
      }
      if (node.left.val !== undefined) {
        hashLeft = getHash(node.left.val, depth, index * 2)
      } else {
        hashLeft = recursive(node.left, depth + 1, index * 2)
      }
    }

    if (depth === 0) {
      rootBranch = 'right'
    }

    if (node.right !== undefined) {
      if (typeof node.right === 'string') {
        if (!validateHexadecimal(node.right)) {
          throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
        }
        hashRight = node.right
      } else {
        if (!isObject(node.right)) {
          throw new TypeError('Invalid type of right node.')
        }

        if (node.right.val !== undefined) {
          hashRight = getHash(node.right.val, depth, index * 2 + 1)
        } else {
          hashRight = recursive(node.right, depth + 1, index * 2 + 1)
        }
      }

      summingBuffer = new Uint8Array(64)
      summingBuffer.set(hexadecimalToUint8Array(hashLeft))
      summingBuffer.set(hexadecimalToUint8Array(hashRight), 32)
      return hash(summingBuffer)
    }

    if (depth === 0 || rootBranch === 'left') {
      throw new Error('Right leaf is missed in left branch of tree.')
    }
    summingBuffer = hexadecimalToUint8Array(hashLeft)
    return hash(summingBuffer)
  }
918850
function(recursive, callback) {
		var i, l, node,
			dict = {},
			self = this;

		$.each(NODE_ATTRS, function(i, a){
			if(self[a] || self[a] === false){
				dict[a] = self[a];
			}
		});
		if(!$.isEmptyObject(this.data)){
			dict.data = $.extend({}, this.data);
			if($.isEmptyObject(dict.data)){
				delete dict.data;
			}
		}
		if( callback ){
			callback(dict);
		}
		if( recursive ) {
			if(this.hasChildren()){
				dict.children = [];
				for(i=0, l=this.children.length; i<l; i++ ){
					node = this.children[i];
					if( !node.isStatusNode() ){
						dict.children.push(node.toDict(true, callback));
					}
				}
			}else{
//                dict.children = null;
			}
		}
		return dict;
	}
833892
function recurse( out, arr, depth ) {
	var len = arr.length,
		val,
		i;

	for ( i = 0; i < len; i++ ) {
		val = arr[ i ];
		if ( depth && isArray( val ) ) {
			recurse( out, val, depth-1 );
		} else {
			out.push( val );
		}
	}
	return out;
}
477658
function( obj, type, stack ) {
                    stack = stack || [];
                    var inStack, res,
                        parser = this.parsers[ type || this.typeOf( obj ) ];

                    type = typeof parser;
                    inStack = inArray( obj, stack );

                    if ( inStack !== -1 ) {
                        return "recursion(" + ( inStack - stack.length ) + ")";
                    }
                    if ( type === "function" ) {
                        stack.push( obj );
                        res = parser.call( this, obj, stack );
                        stack.pop();
                        return res;
                    }
                    return ( type === "string" ) ? parser : this.parsers.error;
                }
1200549
def do_help(self, args: argparse.Namespace) -> None:
        """"""
        if not args.command or args.verbose:
            self._help_menu(args.verbose)

        else:
            # Getting help for a specific command
            func = self.cmd_func(args.command)
            help_func = getattr(self, HELP_FUNC_PREFIX + args.command, None)

            # If the command function uses argparse, then use argparse's help
            if func and hasattr(func, 'argparser'):
                completer = AutoCompleter(getattr(func, 'argparser'), self)
                tokens = [args.command] + args.subcommand
                self.poutput(completer.format_help(tokens))

            # If there is no help information then print an error
            elif help_func is None and (func is None or not func.__doc__):
                err_msg = self.help_error.format(args.command)
                self.decolorized_write(sys.stderr, "{}\n".format(err_msg))

            # Otherwise delegate to cmd base class do_help()
            else:
                super().do_help(args.command)
811885
function step(inst, raw, argv, event, fin) {
    if (!_isPresent(raw)) return fin(_wrapError(_badInput(inst), inst, raw), null);
    var flat = _denestList(raw);
    preproc(inst, flat, argv, event, function postPreproc(err, data) {
        if (err) return fin(err);
        var list = _safeObject(data);
        return branch(inst, list, argv, event, fin);
    });
}
282777
function (generatorFunc) {
            return function () {
                var generator = generatorFunc.apply(this, arguments);
                function doAction(action, arg) {
                    var result;    // in case error on first
                    // in case error on first
                    try {
                        result = generator[action](arg);
                    } catch (e) {
                        return new Reject(e);
                    }
                    if (result.done) {
                        return result.value;
                    }
                    return when(result.value, next, throwEx);
                }
                function next(v) {
                    return doAction('next', v);
                }
                function throwEx(e) {
                    return doAction('throw', e);
                }
                return next();
            };
        }
673995
function recursive($arg,$func,$stack=NULL) {
		if ($stack) {
			foreach ($stack as $node)
				if ($arg===$node)
					return $arg;
		}
		else
			$stack=array();
		switch (gettype($arg)) {
			case 'object':
				if (method_exists('ReflectionClass','iscloneable')) {
					$ref=new ReflectionClass($arg);
					if ($ref->iscloneable()) {
						$arg=clone($arg);
						$cast=is_a($arg,'IteratorAggregate')?
							iterator_to_array($arg):get_object_vars($arg);
						foreach ($cast as $key=>$val)
							$arg->$key=$this->recursive(
								$val,$func,array_merge($stack,array($arg)));
					}
				}
				return $arg;
			case 'array':
				$copy=array();
				foreach ($arg as $key=>$val)
					$copy[$key]=$this->recursive($val,$func,
						array_merge($stack,array($arg)));
				return $copy;
		}
		return $func($arg);
	}
5361
function depthFirstSearch(obj, handler) {
  var childrenKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
  var reverse = arguments[3];

  var rootChildren = hp.isArray(obj) ? obj : [obj];
  //
  var StopException = function StopException() {};
  var func = function func(children, parent) {
    if (reverse) {
      children = children.slice();
      children.reverse();
    }
    var len = children.length;
    for (var i = 0; i < len; i++) {
      var item = children[i];
      var r = handler(item, i, parent);
      if (r === false) {
        // stop
        throw new StopException();
      } else if (r === 'skip children') {
        continue;
      } else if (r === 'skip siblings') {
        break;
      }
      if (item[childrenKey] != null) {
        func(item[childrenKey], item);
      }
    }
  };
  try {
    func(rootChildren);
  } catch (e) {
    if (e instanceof StopException) {
      // stop
    } else {
      throw e;
    }
  }
}
354086
function helperWrapper (fn, args) {
    var _this = this
    var options = args[args.length - 1]
    var hash = options.hash

    // "fn" and "inverse" return strings. They must be able to handle promises
    // just as the compiled template and partials
    options.fn = options.fn && wrap(options.fn, prepareAndResolveMarkers)
    options.inverse = options.inverse && wrap(options.inverse, prepareAndResolveMarkers)

    // If there are any promises in the helper args or in the hash,
    // the evaluation of the helper cannot start before these promises are resolved.
    var promisesInArgs = anyApplies(args, isPromiseAlike)
    var promisesInHash = anyApplies(values(hash), isPromiseAlike)

    if (!promisesInArgs && !promisesInHash) {
      // No promises in hash or args. Act a normal as possible.
      var result = fn.apply(_this, args)
      return isPromiseAlike(result) ? markers.asMarker(result) : result
    }

    var promise = deep(args).then(function (resolvedArgs) {
      // We need "markers", because we are in a new event-loop-cycle now.
      return prepareAndResolveMarkers(function () {
        return fn.apply(_this, resolvedArgs)
      })
    })
    return markers.asMarker(promise)
  }
608019
def make_handler(f, remote, with_response=True):
    
    if isinstance(f, six.string_types):
        f = import_string(f)

    @wraps(f)
    def inner(*args, **kwargs):
        if with_response:
            return f(args[0], remote, *args[1:], **kwargs)
        else:
            return f(remote, *args, **kwargs)
    return inner
775005
function(func, context, argCount) {
                if (context === void 0) return func;
                switch (argCount == null ? 3 : argCount) {
                  case 1: return function(value) {
                    return func.call(context, value);
                  };
                  case 2: return function(value, other) {
                    return func.call(context, value, other);
                  };
                  case 3: return function(value, index, collection) {
                    return func.call(context, value, index, collection);
                  };
                  case 4: return function(accumulator, value, index, collection) {
                    return func.call(context, accumulator, value, index, collection);
                  };
                }
                return function() {
                  return func.apply(context, arguments);
                };
              }
446637
def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
	
	attempts = count() if retries == float('inf') else range(retries)
	for attempt in attempts:
		try:
			return func()
		except trap:
			cleanup()

	return func()
762700
function callbackHandler(callback) {
        return function(error, data) {
            if (data === 'OK') {
                callback();
                return;
            }

            callback(error, deserializeResponse(data));
        };
    }
175899
def _walk(recursion):
    """"""
    try:
        from scandir import walk as walk_function
    except ImportError:
        from os import walk as walk_function

    if recursion:
        walk = partial(walk_function)
    else:
        def walk(path):  # pylint: disable=C0111
            try:
                yield next(walk_function(path))
            except NameError:
                yield walk_function(path)
    return walk