return a context dict of the desired state
2681
def get_context_dict(self):
        
        context_dict = {}
        for s in self.sections():
            for k, v in self.manifest.items(s):
                context_dict["%s:%s" % (s, k)] = v
        for k, v in self.inputs.values().items():
            context_dict["config:{0}".format(k)] = v
        context_dict.update(self.additional_context_variables.items())
        context_dict.update(dict([("%s|escaped" % k, re.escape(str(v) or "")) for k, v in context_dict.items()]))
        return context_dict
52056
def get_state(self, state):
        """"""
        # Check to see if we have a change request pending; if we do
        # return the value we expect it to change to.
        for data in list(self._send_queue.queue):
            desired_states = data['desired_states']
            for desired_state in desired_states:
                if desired_state['state'] == state:
                    return desired_state['enabled']
        if state == States.FILTER_LOW_SPEED:
            return (States.FILTER.value & self._flashing_states) != 0
        return (state.value & self._states) != 0
737294
def getContext(self, context_name = 'default'):
		
		if context_name == 'default' and 'default' not in self.contexts:
			self('default')

		return self.contexts[context_name]
1219022
def get_state_batch(keys, namespace=None, consistent=True):
    """"""

    ukeys = set(keys)

    if namespace:
        ns_keys = ["{}:{}".format(namespace, key) for key in ukeys]

    uvalues = {k: v for k, v
               in zip(ukeys, get_item_batch(ns_keys, consistent=consistent))}
    return list(zip(keys, (uvalues[k] for k in keys)))
39092
def ctx(self):
        '''
        
        '''
        if six.PY2:
            return contextlib.nested(
                self.functions.context_dict.clone(),
                self.returners.context_dict.clone(),
                self.executors.context_dict.clone(),
            )
        else:
            exitstack = contextlib.ExitStack()
            exitstack.enter_context(self.functions.context_dict.clone())
            exitstack.enter_context(self.returners.context_dict.clone())
            exitstack.enter_context(self.executors.context_dict.clone())
            return exitstack
576767
def current_state(self):
        
        field_names = set()
        [field_names.add(f.name) for f in self._meta.local_fields]
        [field_names.add(f.attname) for f in self._meta.local_fields]
        return dict([(field_name, getattr(self, field_name)) for field_name in field_names])
1208674
def get_state(self, caller):
        

        if caller in self.state:
            return self.state[caller]
        else:
            rv = self.state[caller] = DictObject()
            return rv
962925
def from_context(cls, context):
        """"""
        return cls(id=context.id, context=context.to_dict())
1182336
def _embed_state(embedding, state):
    """"""
    return {u: state[v] for v, chain in embedding.items() for u in chain}
496561
function getReturnContext(state) {
    let context = state.tryContext;

    while (context) {
        if (context.hasFinalizer && context.position !== "finally") {
            return context;
        }
        context = context.upper;
    }

    return state;
}
1342343
def _get_context(argspec, kwargs):
    
    if argspec.keywords is not None:
        return kwargs
    return dict((arg, kwargs[arg]) for arg in argspec.args if arg in kwargs)
119619
def state(self):
        '''

        '''
        return dict(a=self.a.tolist(), b=self.b.tolist(), c=self.c.tolist(),
                    pivot=self.pivot.tolist(), position=self.position.tolist())
976132
def get_state():
    
    sdp_state = SDPState()
    errval, errdict = _check_status(sdp_state)
    if errval == "error":
        LOG.debug(errdict['reason'])
        return dict(
            current_state="unknown",
            target_state="unknown",
            last_updated="unknown",
            reason=errdict['reason']
        )
    _last_updated = sdp_state.current_timestamp
    if sdp_state.target_timestamp > _last_updated:
        _last_updated = sdp_state.target_timestamp

    return dict(
        current_state=sdp_state.current_state,
        target_state=sdp_state.target_state,
        allowed_target_states=sdp_state.allowed_target_states[
            sdp_state.current_state],
        last_updated=_last_updated.isoformat()
    ), HTTPStatus.OK
775885
def get_context_data(self, **kwargs):
        """"""
        context = super().get_context_data(**kwargs)
        context.update({
            'title': self.get_title(),
            'ajax_url': self.get_ajax_url(),
            'download_url': self.get_download_url(),
            'create_url': self.get_create_url(),
        })
        return context
638405
def inject_context(self):
        """"""
        navbar = filter(lambda entry: entry.visible, self.navbar_entries)
        return {'navbar': navbar}
246720
def get_tag_context(name, state):
    
    new_contexts = 0
    ctm = None
    while True:
        try:
            ctx_key, name = name.split('.', 1)
            ctm = state.context.get(ctx_key)
        except ValueError:
            break
        if not ctm:
            break
        else:
            state.context.push(ctm)
            new_contexts += 1

    ctm = state.context.get(name)

    return new_contexts, ctm
964672
def complete_contexts(self):
        '''
        
        '''
        if self._complete_contexts:
            return self._complete_contexts
        self.context()
        return self._complete_contexts