Normalize the list of selected categories to fit for the ids of the tree items.
976235
private void normalizeSelectedCategories() {

        Collection<String> normalizedCategories = new ArrayList<String>(m_selectedCategories.size());
        for (CmsTreeItem item : m_categories.values()) {
            if (item.getCheckBox().isChecked()) {
                normalizedCategories.add(item.getId());
            }
        }
        m_selectedCategories = normalizedCategories;

    }
1170818
def sort_items(items):
    """"""

    sorted_items = {}
    for item in items:
        category = lookup(item, 'itemCategory', 'categoryCode')
        if sorted_items.get(category) is None:
            sorted_items[category] = []
        sorted_items[category].append(item)

    return sorted_items
897434
def normalize(self):
        
        order = [
            'sld:Title', 'ogc:Filter', 'sld:MinScaleDenominator',
            'sld:MaxScaleDenominator', 'sld:PolygonSymbolizer',
            'sld:LineSymbolizer', 'sld:TextSymbolizer', 'sld:PointSymbolizer']
        for item in order:
            xpath = self._node.xpath(item, namespaces=SLDNode._nsmap)
            for xitem in xpath:
                # move this to the end
                self._node.remove(xitem)
                self._node.append(xitem)
282568
def __related_categories(self, category_id):
        
        related = []
        for cat in self.categories_tree:
            if category_id in self.categories_tree[cat]:
                related.append(self.categories[cat])
        return related
1287369
void normalize()
    {
        double nrm = norm();
        for (Map.Entry<Integer, Double> d : entrySet())
        {
            d.setValue(d.getValue() / nrm);
        }
    }
173227
function normalize (specs) {
  const arrayedSpecs = Array.isArray(specs) ? specs : [specs]
  const objectifiedSpecs = arrayedSpecs.map(normalizeSpec)
  return objectifiedSpecs
}
482532
public function normalize() {
        $len =  $this->length();

        if ($len === 0.0) {
            return;
        }
        $count = count($this->elements);
        for ($i=0;$i<$count;$i++) {
            $this[$i] /= $len;
        }
    }
659092
public void normalize() {
		double sum = 0;
		for(Entry e:entries.values())
			sum+=e.getAssocRate();
		if(sum != 0) {
			for(Entry e:entries.values())
				e.setAssocRate(e.getAssocRate()/sum);
		}
		setDirty();
	}
760133
private CmsTreeItem buildTreeItem(CmsCategoryTreeEntry category, List<String> selectedCategories) {

        m_categories.put(category.getPath(), category);
        // set the list item widget
        CmsDataValue dataValue = new CmsDataValue(
            600,
            3,
            CmsCategoryBean.SMALL_ICON_CLASSES,
            category.getTitle(),
            CmsStringUtil.isNotEmptyOrWhitespaceOnly(category.getDescription())
            ? category.getDescription()
            : category.getPath());

        // the checkbox
        CmsCheckBox checkBox = new CmsCheckBox();
        if ((selectedCategories != null) && selectedCategories.contains(category.getPath())) {
            checkBox.setChecked(true);
        }
        SelectionHandler selectionHandler = new SelectionHandler(category.getPath(), checkBox);
        checkBox.addClickHandler(selectionHandler);
        dataValue.addClickHandler(selectionHandler);
        dataValue.addButton(createSelectButton(selectionHandler));
        dataValue.setUnselectable();
        // set the category tree item and add to list
        CmsTreeItem treeItem = new CmsTreeItem(true, checkBox, dataValue);
        treeItem.setSmallView(true);
        treeItem.setId(category.getPath());
        return treeItem;
    }
1202612
def folderitems(self):
        
        items = super(AnalysisProfileAnalysesView, self).folderitems()
        self.categories.sort()
        return items
530790
def _get_normalized_columns(cls, list_):
        
        ret = []
        for row in list_:
            if len(row.keys()) > len(ret):
                ret = cls._ordered_keys(row)

        for row in list_:
            for key in row.keys():
                if key not in ret:
                    ret.append(key)
                    if not isinstance(row, OrderedDict):
                        ret.sort()
        return ret
1304469
def selected(self, ids):
        
        # Cleanup the ID list
        if self.get_field_name() == 'pk':
            ids = filter(lambda x: "{}".format(x).isdigit(), copy(ids))
        else:
            ids = filter(lambda x: len("{}".format(x)) > 0, copy(ids))
        # Prepare the QS
        # TODO: not contextually filtered, check if it's possible at some point
        qs = self.get_model_queryset().filter(
            **{'{}__in'.format(self.get_field_name()): ids})
        result = []
        for item in qs:
            item_repr = self.item(item)
            result.append(
                (item_repr['value'], item_repr['label'])
            )
        return result
395957
def selected_cats(self, items):
        
        cats = []
        for item in items:
            if 'category' in item and item['category'] not in cats:
                cats.append(item['category'])
        return cats
796183
def category_ids
      component
        .categories
        .where(id: category_id)
        .or(component.categories.where(parent_id: category_id))
        .pluck(:id)
    end
866910
def process_lists(self):
        """"""
        for l1_idx, obj1 in enumerate(self.l1):
            for l2_idx, obj2 in enumerate(self.l2):
                if self.equal(obj1, obj2):
                    self.matches.add((l1_idx, l2_idx))
658803
def _build_category_tree(slug, reference=None, items=None):
    

    if items is None:
        items = []

    for key in reference:
        category = reference[key]

        if category["parent"] == slug:
            children = _build_category_tree(category["nicename"],
                                            reference=reference)
            category["children"] = children
            items.append(category)

    return items
418294
function normalizeObjects(types) {
  var ret = types[0].type ? types[0].type : types[0];
  var args = types[1].map(function(item) { return item.type ? item.type : item; });
  return [ret, args];
 }