update context on all items except group headers
501685
function(aContexts, oModel) {
			if (!aContexts.length) {
				return;
			}

			var aItems = this._oControl.getItems(true);
			for (var i = 0, c = 0, oItem; i < aItems.length; i++) {
				oItem = aItems[i];

				// group headers are not in binding context
				if (!oItem.isGroupHeader()) {
					oItem.setBindingContext(aContexts[c++], oModel);
				}
			}
		}
1312182
def get_contextualize_items_by_step(self, default=None):
        """"""
        if self.items:
            res = {}
            for elem in self.items.values():
                if elem.num in res:
                    res[elem.num].append(elem)
                else:
                    res[elem.num] = [elem]
            return res
        else:
            return default
1308930
function addPathContext(pathContexts) {
  _each(pathContexts, pathContext => {
    if (pathContext.paths) {
      pathContext.paths = _arrayify(pathContext.paths)
    }

    if (pathContext.regexes) {
      pathContext.regexes = _arrayify(pathContext.regexes)
    }

    if (pathContext.contexts) {
      pathContext.contexts = _arrayify(pathContext.contexts)
    }
  })
  _addUniqueItems(_pathContexts, pathContexts)
  return _pathContexts
}
1337420
def extra_context(self, request, context):
        """"""
        if settings.PAGE_EXTRA_CONTEXT:
            context.update(settings.PAGE_EXTRA_CONTEXT())
1060439
def update_context(app, pagename, templatename, context, doctree):
    
    if doctree is None:
        return
    visitor = _FindTabsDirectiveVisitor(doctree)
    doctree.walk(visitor)
    if not visitor.found_tabs_directive:
        paths = [posixpath.join('_static', 'sphinx_tabs/' + f) for f in FILES]
        if 'css_files' in context:
            context['css_files'] = context['css_files'][:]
            for path in paths:
                if path.endswith('.css'):
                    context['css_files'].remove(path)
        if 'script_files' in context:
            context['script_files'] = context['script_files'][:]
            for path in paths:
                if path.endswith('.js'):
                    context['script_files'].remove(path)
321727
def update_headers(self, dictionary, keys=None):
        
        if keys is None: keys = list(dictionary.keys())
        for k in keys: self.insert_header(k, dictionary[k])
        return self
1086806
def context(names):
    """"""
    import json

    contexts = [_context_json(name) for name in set(names)]
    if contexts:
        click.echo(
            json.dumps(
                contexts[0] if len(contexts) == 1 else contexts,
                indent=2,
            )
        )
1151367
function(oContext, oBindingInfo, bSuppressInvalidate) {

			var oControl = this._oControl,
				oBinding = oBindingInfo.binding,
				oItem = this.createListItem(oContext, oBindingInfo);

			if (oBinding.isGrouped()) {
				// creates group header if need
				var aItems = oControl.getItems(true),
					oLastItem = aItems[aItems.length - 1],
					sModelName = oBindingInfo.model,
					oGroupInfo = oBinding.getGroup(oItem.getBindingContext(sModelName));

				if (oLastItem && oLastItem.isGroupHeader()) {
					oControl.removeAggregation("items", oLastItem, true);
					this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oLastItem, bSuppressInvalidate);
					oLastItem = aItems[aItems.length - 1];
				}

				if (!oLastItem || oGroupInfo.key !== oBinding.getGroup(oLastItem.getBindingContext(sModelName)).key) {
					var oGroupHeader = (oBindingInfo.groupHeaderFactory) ? oBindingInfo.groupHeaderFactory(oGroupInfo) : null;
					if (oControl.getGrowingDirection() == ListGrowingDirection.Upwards) {
						this.applyPendingGroupItem();
						this._fnAppendGroupItem = this.appendGroupItem.bind(this, oGroupInfo, oGroupHeader, bSuppressInvalidate);
					} else {
						this.appendGroupItem(oGroupInfo, oGroupHeader, bSuppressInvalidate);
					}
				}
			}

			oControl.addAggregation("items", oItem, bSuppressInvalidate);
			if (bSuppressInvalidate) {
				this._aChunk.push(oItem);
			}
		}
685734
def p_contextualize_items(self, t):
        """"""
        if len(t) == 3:
            t[0] = t[1]
            t[0].append(t[2])
        elif t[1]:
            t[0] = [t[1]]
        else:
            t[0] = []
559975
def init_with_context(self, context):
        
        items = self._visible_models(context['request'])
        for model, perms in items:
            if not (perms['change'] or perms.get('view', False)):
                continue
            title = model._meta.verbose_name_plural
            url = self._get_admin_change_url(model, context)
            item = MenuItem(title=title, url=url)
            self.children.append(item)
1282495
def with_headers(self, headers):
        
        for key, value in headers.items():
            self.with_header(key, value)
        return self
1350829
def make_context(headers: Headers) -> Optional[TraceContext]:
    
    # TODO: add validation for trace_id/span_id/parent_id

    # normalize header names just in case someone passed regular dict
    # instead dict with case insensitive keys
    headers = {k.lower(): v for k, v in headers.items()}

    required = (TRACE_ID_HEADER.lower(), SPAN_ID_HEADER.lower())
    has_b3 = all(h in headers for h in required)
    has_b3_single = SINGLE_HEADER in headers

    if not(has_b3_single or has_b3):
        return None

    if has_b3:
        debug = parse_debug_header(headers)
        sampled = debug if debug else parse_sampled_header(headers)
        context = TraceContext(
            trace_id=headers[TRACE_ID_HEADER.lower()],
            parent_id=headers.get(PARENT_ID_HEADER.lower()),
            span_id=headers[SPAN_ID_HEADER.lower()],
            sampled=sampled,
            debug=debug,
            shared=False,
        )
        return context
    return _parse_single_header(headers)
1071856
def move_to_group(self, items, new_group_id: int):
        
        group = self.rootItem.child(new_group_id)
        for item in items:
            group.appendChild(item)
        self.controller.refresh()
800291
def set_context(self, definition: Definition, explanation: str) -> None:
        """"""
        self.definition = definition
        self.explanation = explanation
693409
def compose_headers(self, req, headers=None, opt=None, as_dict=False):
        
        if headers is None:
            return list(req.header.items()) if not as_dict else req.header

        opt = opt or {}
        join_headers = opt.pop(BaseClient.join_headers, None)
        if as_dict and not join_headers:
            # pick the most efficient way for special case
            headers = dict(headers) if isinstance(headers, list) else headers
            headers.update(req.header)
            return headers

        # include Request.headers
        aggregated_headers = list(req.header.items())

        # include customized headers
        if isinstance(headers, list):
            aggregated_headers.extend(headers)
        elif isinstance(headers, dict):
            aggregated_headers.extend(headers.items())
        else:
            raise Exception('unknown type as header: {}'.format(str(type(headers))))

        if join_headers:
            joined = {}
            for h in aggregated_headers:
                key = h[0]
                if key in joined:
                    joined[key] = ','.join([joined[key], h[1]])
                else:
                    joined[key] = h[1]
            aggregated_headers = list(joined.items())

        return dict(aggregated_headers) if as_dict else aggregated_headers
453414
def update(context, resource, **kwargs):
    """"""
    etag = kwargs.pop('etag')
    id = kwargs.pop('id')
    data = utils.sanitize_kwargs(**kwargs)
    uri = '%s/%s/%s' % (context.dci_cs_api, resource, id)
    r = context.session.put(uri, timeout=HTTP_TIMEOUT,
                            headers={'If-match': etag},
                            json=data)
    return r
354393
function _updateLayerGroups($canvas, data, layer, props) {
	var groupMap = data.layer.groups,
		group, groupName, g,
		index, l;

	// If group name is not changing
	if (!props) {

		props = layer;

	} else {

		// Remove layer from all of its associated groups
		if (props.groups !== undefined && layer.groups !== null) {
			for (g = 0; g < layer.groups.length; g += 1) {
				groupName = layer.groups[g];
				group = groupMap[groupName];
				if (group) {
					// Remove layer from its old layer group entry
					for (l = 0; l < group.length; l += 1) {
						if (group[l] === layer) {
							// Keep track of the layer's initial index
							index = l;
							// Remove layer once found
							group.splice(l, 1);
							break;
						}
					}
					// Remove layer group entry if group is empty
					if (group.length === 0) {
						delete groupMap[groupName];
					}
				}
			}
		}

	}

	// Add layer to new group if a new group name is given
	if (props.groups !== undefined && props.groups !== null) {

		for (g = 0; g < props.groups.length; g += 1) {

			groupName = props.groups[g];

			group = groupMap[groupName];
			if (!group) {
				// Create new group entry if it doesn't exist
				group = groupMap[groupName] = [];
				group.name = groupName;
			}
			if (index === undefined) {
				// Add layer to end of group unless otherwise stated
				index = group.length;
			}
			// Add layer to its new layer group
			group.splice(index, 0, layer);

		}

	}
}