Collapses or expands the given list horizontally
555459
function(oList, bCollapse, oEvent, bSkipParentTraversal){
		if (oEvent) {
			oEvent.preventDefault();
			oEvent.stopPropagation();
		}
		if (oList._isTop()) {
			return;
		}
		if (oList._bCollapsed != bCollapse) {
			//Toggles the horizontal Collapse State
			var bFocus = !!oEvent;
			var cntntAnimParam = {};
			cntntAnimParam["margin-" + (oList._bRTL ? "right" : "left")] = (oList._bCollapsed ?
					(oList._iCurrentWidth + "px") : Parameters.get("sapUiUx3ExactLstCollapseWidth"));
			cntntAnimParam["border-top-width"] = (oList._bCollapsed ?
					Parameters.get("sapUiUx3ExactLstContentTop") : "0px");

			var $Ctnt = oList.$("cntnt");
			if (jQuery.fx.off) {
				for (var css in cntntAnimParam) {
					$Ctnt.css(css, cntntAnimParam[css]);
				}
			} else {
				$Ctnt.stop(true, true).animate(cntntAnimParam, 200, 'linear');
			}

			if (oList._bCollapsed) {
				//expand
				animate(oList.$("lst"), true, oList._iCurrentWidth + "px", function() {
					jQuery(oList.getDomRef()).removeClass("sapUiUx3ExactLstCollapsed");
					oList.$("head").css("overflow", "hidden");
				}, function($Ref) {
					oList.$("hide")
						.html(ExactListRenderer.getExpanderSymbol(true, true))
						.attr("title", oList._rb.getText("EXACT_LST_LIST_COLLAPSE"));
					if (bFocus) {
						oList.focus();
					}
					var $head = oList.$("head");
					oList.$("head-txt").removeAttr("style");
					$head.removeAttr("style");
					$Ref.removeAttr("style");
					refreshScrollBehaviour(oList);
					setWidth(oList, oList._iCurrentWidth);
					refreshCollapseHeaderTextWidth(oList);

					$head.removeAttr("role");
					$head.removeAttr("aria-label");
					$head.removeAttr("aria-expanded");

					var oAtt = oList._getAtt();
					if (oAtt && oAtt._scrollToAttributeId) {
						oAtt.scrollTo(sap.ui.getCore().byId(oAtt._scrollToAttributeId));
					}

				});

				oList._oCollapseStyles = undefined;
			} else {
				oList._oCollapseStyles = {};

				//collapse
				animate(oList.$("lst"), true, 0, null, function() {
					jQuery(oList.getDomRef()).addClass("sapUiUx3ExactLstCollapsed");
					oList.$("hide")
						.html(ExactListRenderer.getExpanderSymbol(false, true))
						.attr("title", oList._rb.getText("EXACT_LST_LIST_EXPAND"));
					if (bFocus) {
						oList.focus();
					}
					refreshCollapseHeaderTextWidth(oList);

					var $head = oList.$("head");
					$head.attr("role", "region");
					$head.attr("aria-label", oList._rb.getText("EXACT_LST_LIST_COLL_ARIA_LABEL", [oList._iLevel, oList._getAtt().getText()]));
					$head.attr("aria-expanded", "false");
				});

				//Remember the current styles for rerendering
				var aStyles = [];
				for (var css in cntntAnimParam) {
					aStyles.push(css, ":", cntntAnimParam[css], ";");
				}
				oList._oCollapseStyles["cntnt"] = aStyles.join("");
				oList._oCollapseStyles["lst"] = "width:0px;";
			}

			oList._bCollapsed = !oList._bCollapsed;
		}

		if (bSkipParentTraversal) {
			return;
		}
		var oParent = oList.getParent();
		if (!oList._isTop() && oParent && oParent._isTop && !oParent._isTop()) {
			collapseHorizontally(oParent, bCollapse);
		}
	}
462584
function expandCollapseList(ul,cName,itemId) {
	if (!ul.childNodes || ul.childNodes.length==0) { return false; }
	// Iterate LIs
	for (var itemi=0;itemi<ul.childNodes.length;itemi++) {
		var item = ul.childNodes[itemi];
		if (itemId!=null && item.id==itemId) { return true; }
		if (item.nodeName == "LI") {
			// Iterate things in this LI
			var subLists = false;
			for (var sitemi=0;sitemi<item.childNodes.length;sitemi++) {
				var sitem = item.childNodes[sitemi];
				if (sitem.nodeName=="UL") {
					subLists = true;
					var ret = expandCollapseList(sitem,cName,itemId);
					if (itemId!=null && ret) {
						item.className=cName;
						return true;
					}
				}
			}
			if (subLists && itemId==null) {
				item.className = cName;
			}
		}
	}
}
527485
def flatten(l: Iterable) -> List:
    
    rval = []
    for e in l:
        if not isinstance(e, str) and isinstance(e, Iterable):
            if len(list(e)):
                rval += flatten(e)
        else:
            rval.append(e)
    return rval
733835
def scroll_to_horizontally(self, obj, *args,**selectors):
        
        return obj.scroll.horiz.to(**selectors)
234879
public void expandListParagraphs()
    {
        if (this.type != BlockType.ORDERED_LIST && this.type != BlockType.UNORDERED_LIST)
        {
            return;
        }
        Block outer = this.blocks, inner;
        boolean hasParagraph = false;
        while (outer != null && !hasParagraph)
        {
            if (outer.type == BlockType.LIST_ITEM)
            {
                inner = outer.blocks;
                while (inner != null && !hasParagraph)
                {
                    if (inner.type == BlockType.PARAGRAPH)
                    {
                        hasParagraph = true;
                    }
                    inner = inner.next;
                }
            }
            outer = outer.next;
        }
        if (hasParagraph)
        {
            outer = this.blocks;
            while (outer != null)
            {
                if (outer.type == BlockType.LIST_ITEM)
                {
                    inner = outer.blocks;
                    while (inner != null)
                    {
                        if (inner.type == BlockType.NONE)
                        {
                            inner.type = BlockType.PARAGRAPH;
                        }
                        inner = inner.next;
                    }
                }
                outer = outer.next;
            }
        }
    }
430935
def _collapse_device(self, node, flat):
        """"""
        items = [item
                 for branch in node.branches
                 for item in self._collapse_device(branch, flat)
                 if item]
        show_all = not flat or self._quickmenu_actions == 'all'
        methods = node.methods if show_all else [
            method
            for method in node.methods
            if method.method in self._quickmenu_actions
        ]
        if flat:
            items.extend(methods)
        else:
            items.append(MenuSection(None, methods))
        return items
1126139
function listAsArray(list){

   return foldR( function(arraySoFar, listItem){
      
      arraySoFar.unshift(listItem);
      return arraySoFar;
           
   }, [], list );
   
}
198059
def flatten(self, l):
        """"""
        if l == []:
            return l
        if isinstance(l[0], list):
            return self.flatten(l[0]) + self.flatten(l[1:])
        return l[:1] + self.flatten(l[1:])
223218
def _flatten(lst):
    
    if not isinstance(lst, (list, tuple)):
        return [lst]
    result = []
    for item in lst:
        result.extend(_flatten(item))
    return result
82541
function expandAll() {
        var editor = EditorManager.getFocusedEditor();
        if (editor) {
            var cm = editor._codeMirror;
            CodeMirror.commands.unfoldAll(cm);
        }
    }
647968
def fold_list(input_list, max_width=None):
    
    if not input_list:
        return ""
    if not isinstance(input_list[0], six.string_types):
        input_list = [str(item) for item in input_list]

    if max_width:
        mystr = ", ".join(input_list)
        return fold_string(mystr, max_width)

    return "\n".join(input_list)
982159
function widen(widening, width) {
  widening = widening || 0;

  return function(d, i, array) {
    if(array.length > 2) throw "array.length > 2 unsupported. array.length = " + array.length;
    width = width || (array[array.length-1] - array[0]);
    return d + (i*2-1)*width*widening;
  };
}
526883
def flatten(l):
    
    l = list(l)
    i = 0
    while i < len(l):
        while isinstance(l[i], list):
            if not l[i]:
                l.pop(i)
                i -= 1
                break
            else:
                l[i:i + 1] = l[i]
        i += 1
    return l
763475
def flatten(items,enter=lambda x:isinstance(x, list)):
    # http://stackoverflow.com/a/40857703
    # https://github.com/ctmakro/canton/blob/master/canton/misc.py
    """"""
    for x in items:
        if enter(x):
            yield from flatten(x)
        else:
            yield x
709529
function wrapInList(
    opts: Options,
    change: Change,
    type?: string,
    data?: Object | Data
): Change {
    const selectedBlocks = getHighestSelectedBlocks(change.value);
    type = type || opts.types[0];

    // Wrap in container
    change.wrapBlock(
        {
            type,
            data: Data.create(data)
        },
        { normalize: false }
    );

    // Wrap in list items
    selectedBlocks.forEach(node => {
        if (isList(opts, node)) {
            // Merge its items with the created list
            node.nodes.forEach(({ key }) =>
                change.unwrapNodeByKey(key, { normalize: false })
            );
        } else {
            change.wrapBlockByKey(node.key, opts.typeItem, {
                normalize: false
            });
        }
    });

    return change.normalize();
}
152416
def collapse_spaces(text):
    """"""
    if not isinstance(text, six.string_types):
        return text
    return COLLAPSE_RE.sub(WS, text).strip(WS)
1062377
def flatten(in_list):
    """"""
    out_list = []
    for val in in_list:
        if isinstance(val, list):
            out_list.extend(val)
        else:
            out_list.append(val)

    return out_list