Construct an selector for context.
4697
def construct_selector(self, el, attr=''):
        """"""

        selector = deque()
        ancestor = el
        while ancestor and ancestor.parent:
            if ancestor is not el:
                selector.appendleft(ancestor.name)
            else:
                tag = ancestor.name
                prefix = ancestor.prefix
                classes = self.get_classes(ancestor)
                tag_id = ancestor.attrs.get('id', '').strip()
                sel = ''
                if prefix:
                    sel += prefix + '|'
                sel += tag
                if tag_id:
                    sel += '#' + tag_id
                if classes:
                    sel += '.' + '.'.join(classes)
                if attr:
                    sel += '[%s]' % attr
                selector.appendleft(sel)
            ancestor = ancestor.parent
        return '>'.join(selector)
1354821
function negationSelector(selectorContext) {
    // If no properties currently selected, select them all first.
    if (isEmpty(selectorContext.sourceKeys)) {
        extendSourceKeys(selectorContext.sourceKeys, selectorContext.source);
    }
    // Then remove the negated property.
    if (selectorContext.sourceKeys[selectorContext.sourceKey] !== undefined) {
        delete selectorContext.sourceKeys[selectorContext.sourceKey];

    } else {
        // Throw error if negated property not found.
        errorManager.propertyNotFound(selectorContext.sourceKey, selectorContext.source);
    }
}
152114
function context(phase, stage, mode, local) {
        return {phase: phase, stage: stage, mode: mode, local: local};
    }
283935
function (context) {
                var oElement;
                var oFocusControl;
                var that = context;
                var defaultFocusableElements = [that._mParameters.firstFocusable, that._mParameters.lastFocusable];
                // jQuery custom selectors ":sapTabbable"
                var aTabbables = jQuery(":sapTabbable", that.$()).get();

                // search the first tabbable element
                for (var i = 0; i < aTabbables.length; i++) {
                    if (defaultFocusableElements.indexOf(aTabbables[i].id) === -1) {
                        oElement = aTabbables[i];
                        break;
                    }
                }

                // If a tabbable element is part of a control, focus the control instead
                // jQuery Plugin "control"
                oFocusControl = jQuery(oElement).control();
                if (oFocusControl[0]) {
                    var oFocusDomRef = oFocusControl[0].getFocusDomRef();
                    oElement = oFocusDomRef || oElement;
                } else {
                    // if there is no tabbable element in the content use the first fake
                    // element to set the focus to the toolpopup
                    oElement = defaultFocusableElements[0] ? window.document.getElementById(defaultFocusableElements[0]) : null;
                }

                // oElement might not be available if this function is called during destroy
                if (oElement) {
                    if (oElement) {
                        oElement.focus();
                    }
                    that._sInitialFocusId = oElement.id;
                }
            }
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] = []
265408
def construct_context(self, request):
        
        opts = self.model._meta
        app_label = opts.app_label
        object_name = opts.object_name.lower()
        form = self.construct_form(request)

        media = self.media(form)
        context = {
            'user': request.user,
            'title': '%s %s' % (self.label, opts.verbose_name_plural.lower()),
            'tool': self,
            'opts': opts,
            'app_label': app_label,
            'media': media,
            'form': form,
            'changelist_url': reverse('admin:%s_%s_changelist' % (
                app_label, object_name
            ))
        }

        # Pass along fieldset if sepcififed.
        if hasattr(form, 'fieldsets'):
            admin_form = helpers.AdminForm(form, form.fieldsets, {})
            context['adminform'] = admin_form

        return context
1361240
def eval_context(context, node)
      node.context(&context[:block]) if context[:nodes].matches?(node.name)
    end
241459
def get_context(self, name):
        """"""
        contexts = self.data['contexts']
        for context in contexts:
            if context['name'] == name:
                return context
        raise KubeConfError("context name not found.")
820492
def _build_block_context(template, context):
    """"""

    # Ensure there's a BlockContext before rendering. This allows blocks in
    # ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
    # overriding sub-blocks to work).
    if BLOCK_CONTEXT_KEY not in context.render_context:
        context.render_context[BLOCK_CONTEXT_KEY] = BlockContext()
    block_context = context.render_context[BLOCK_CONTEXT_KEY]

    for node in template.nodelist:
        if isinstance(node, ExtendsNode):
            compiled_parent = node.get_parent(context)

            # Add the parent node's blocks to the context. (This ends up being
            # similar logic to ExtendsNode.render(), where we're adding the
            # parent's blocks to the context so a child can find them.)
            block_context.add_blocks(
                {n.name: n for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)})

            _build_block_context(compiled_parent, context)
            return compiled_parent

        # The ExtendsNode has to be the first non-text node.
        if not isinstance(node, TextNode):
            break
778992
def path_context(self, path):
        """"""
        prefix = os.path.commonprefix([path, self._path])
        relative_path = path[len(prefix) :]
        relative_path = relative_path.strip(os.sep)
        attrs = self.CONTEXT_ATTRS
        for i, elt in enumerate(relative_path.split(os.sep)):
            yield attrs[i], elt
        yield 'path', path
124844
function Context(name, files, ignore) {
    this.name = name;
    this.files = files || {};
    this.ingore = ignore || [];
}
824513
def getContext(context):
    
    context = aq_parent(aq_base(context))
    if not context or IBrowserView.providedBy(context):
        return getSite()
    return context
634073
def context_binding(variables)
      context = TemplateEvaluationContext.new

      helpers.each { |helper| context.extend(helper) }

      variables.each do |k, v|
        context.instance_variable_set("@#{k}", v)
      end

      context.__get_binding
    end
1185429
function context(self, method) {
  if (self instanceof Primus) return;

  var failure = new Error('Primus#'+ method + '\'s context should called with a Primus instance');

  if ('function' !== typeof self.listeners || !self.listeners('error').length) {
    throw failure;
  }

  self.emit('error', failure);
}
90796
def context_value(name):
    

    def context_value(_value, context, **_params):
        return defer.succeed(context[name])

    return context_value
42173
def p_contextualize_item(self, t):
        """"""

        if len(t) == 5:
            t[0] = contextualize_item(t[2], t[4], line=t.lineno(1))
        elif t[5] == "with":
            t[0] = contextualize_item(t[2], t[4], ctxt_tool=t[6], line=t.lineno(1))
        else:
            t[0] = contextualize_item(t[2], t[4], num=t[6], line=t.lineno(1))
1340472
def when(self, key):
        
        ctx = Context(key, self)
        self.context.append(ctx)
        return ctx