Load Context with data
427091
def set_context(self, data):
        """"""
        for key in data:
            setattr(self.local_context, key, data[key])
1085492
def InitializeContext(self, args):
    """"""
    if args is None:
      args = rdf_hunts.HuntRunnerArgs()

    context = rdf_hunts.HuntContext(
        create_time=rdfvalue.RDFDatetime.Now(),
        creator=self.token.username,
        duration=args.expiry_time,
        start_time=rdfvalue.RDFDatetime.Now(),
        usage_stats=rdf_stats.ClientResourcesStats())

    return context
521214
def get_context_data(self, **kwargs):
        
        context = super(BaseEntrySearch, self).get_context_data(**kwargs)
        context.update({'error': self.error, 'pattern': self.pattern})
        return context
685089
function Context(data, parent, path, env) {
	/** 
	 * Context will inherit of AsyncCollector to manage all internal or external asynchroneous calls.
	 * It allows us to know when a context and its descendants are stabilised(i.e.all data are up to date).
	 **/
	AsyncCollector.call(this);
	this.__yContext__ = true;
	this.data = (data !== undefined) ? data : {};
	this.map = {};
	this.binds = [];
	if (parent) {
		this.parent = parent;
		this.env = env ? new Context(env) : parent.env;
		if (path) {
			var self = this;
			this.path = path;
			this.data = this.data || parent.get(path);
			this.parent.subscribe(path, function(value, type, p, key) {
				// console.log('binded context update : ', type, path, p, key, value);
				if (!p.length)
					p.push('$this');
				switch (type) {
					case 'set':
						self.set(p, value, true);
						break;
					case 'push':
						self.push(p, value, true);
						break;
					case 'delete':
						self.del(p, true);
						break;
					case 'displaceItem':
						self.displaceItem(p, value, true);
						break;
					case 'insertItem':
						self.insertItem(p, value, true);
						break;
					case 'deleteItem':
						self.deleteItem(p, value, true);
						break;
				}
			}, true, this.binds);
		}
	} else
		this.env = env ? (env.__yContext__ ? env : new Env(env)) : Context.env;
}
753144
def get_context_data(self, **kwargs):
        '''
        
        '''

        # Call the base implementation first to get a context
        context = super(GenList, self).get_context_data(**kwargs)
        # Update general context with the stuff we already calculated
        context.update(self.__context)

        # Initialize with our timestamp
        context['now'] = epochdate(time.time())
        context['profile'] = self.profile

        # Check vtable
        context['vtable'] = getattr(self, 'vtable', False)

        # Export to excel
        context['export_excel'] = getattr(self, 'export_excel', True)
        context['export_name'] = getattr(self, 'export_name', 'list')

        # Check ngincludes
        context['ngincludes'] = getattr(self, 'ngincludes', {})
        if 'table' not in context['ngincludes'].keys():
            context['ngincludes']['table'] = "{}codenerix/partials/table.html".format(settings.STATIC_URL)

        # Check linkadd
        context['linkadd'] = getattr(self, 'linkadd', self.auth_permission('add') or getattr(self, 'public', False))

        # Check linkedit
        context['linkedit'] = getattr(self, 'linkedit', self.auth_permission('change') or getattr(self, 'public', False))

        # Check showdetails
        context['show_details'] = getattr(self, 'show_details', False)

        # Check showmodal
        context['show_modal'] = getattr(self, 'show_modal', False)

        # Set search filter button
        context['search_filter_button'] = getattr(self, 'search_filter_button', False)

        # Get base template
        if not self.json_worker:
            template_base = getattr(self, 'template_base', 'base/base')
            template_base_ext = getattr(self, 'template_base_ext', 'html')
            context['template_base'] = get_template(template_base, self.user, self.language, extension=template_base_ext)

        # Try to convert object_id to a numeric id
        object_id = kwargs.get('object_id', None)
        try:
            object_id = int(object_id)
        except Exception:
            pass

        # Python 2 VS Python 3 compatibility
        try:
            unicode('codenerix')
            unicodetest = unicode
        except NameError:
            unicodetest = str

        if isinstance(object_id, str) or isinstance(object_id, unicodetest):
            # If object_id is a string, we have a name not an object
            context['object_name'] = object_id
            object_obj = None
        else:
            # If is not an string
            if object_id:
                # If we got one, load the object
                obj = context['obj']
                object_obj = get_object_or_404(obj, pk=object_id)
            else:
                # There is no object
                object_obj = None
            context['object_obj'] = object_obj

        # Attach extra_context
        context.update(self.extra_context)
        # Return new context
        return context
1320041
def get_context_data(self, **kwargs):
        """"""
        context = super().get_context_data(**kwargs)
        tabs = self.get_active_tabs()
        context.update({
            'page_detail_tabs': tabs,
            'active_tab': tabs[0].code if tabs else '',
            'app_label': self.get_app_label(),
            'model_name': self.get_model_name(),
            'model_alias': self.get_model_alias(),
            'model_verbose_name': self.object._meta.verbose_name.title(),
            'back_url': self.get_back_url(),
            'edit_url': self.get_edit_url(),
            'delete_url': self.get_delete_url(),
            'title': self.title,
        })
        return context
70058
def get_context(self, name, value, attrs):
        """"""
        context = super(CaptchaTextInput, self).get_context(name, value, attrs)
        context['image'] = self.image_url()
        context['audio'] = self.audio_url()
        return context
1179045
def init_with_context(self, context):
        
        # Apply the include/exclude patterns:
        listitems = self._visible_models(context['request'])

        # Convert to a similar data structure like the dashboard icons have.
        # This allows sorting the items identically.
        models = [
            {'name': model._meta.model_name,
             'app_name': model._meta.app_label,
             'title': capfirst(model._meta.verbose_name_plural),
             'url': self._get_admin_change_url(model, context)
             }
            for model, perms in listitems if self.is_item_visible(model, perms)
        ]

        # Sort models.
        sort_cms_models(models)

        # Convert to items
        for model in models:
            self.children.append(items.MenuItem(title=model['title'], url=model['url']))
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.")
704805
def get_context_data(self, **kwargs):
        """"""
        r = get_r()
        category = kwargs.pop('category', None)
        data = super(AggregateDetailView, self).get_context_data(**kwargs)

        if category:
            slug_set =   r._category_slugs(category)
        else:
            slug_set = set(kwargs['slugs'].split('+'))

        data['granularities'] = list(r._granularities())
        data['slugs'] = slug_set
        data['category'] = category
        return data
481955
def get_context_data(self, **kwargs):
        """"""
        data = super(GaugesView, self).get_context_data(**kwargs)
        data.update({'gauges': get_r().gauge_slugs()})
        return data
26489
def _ResolveContext(self, context, name, raw_data, path=None):
    """"""
    if path is None:
      path = []

    for element in context:
      if element not in self.valid_contexts:
        raise InvalidContextError("Invalid context specified: %s" % element)

      if element in raw_data:
        context_raw_data = raw_data[element]

        value = context_raw_data.get(name)
        if value is not None:
          if isinstance(value, string_types):
            value = value.strip()

          yield context_raw_data, value, path + [element]

        # Recurse into the new context configuration.
        for context_raw_data, value, new_path in self._ResolveContext(
            context, name, context_raw_data, path=path + [element]):
          yield context_raw_data, value, new_path
711101
def load(self, context):
    
    try:
      # pylint: disable=g-import-not-at-top,unused-import
      import tensorflow
    except ImportError:
      return
    # pylint: disable=g-import-not-at-top
    from tensorboard.plugins.hparams.hparams_plugin import HParamsPlugin
    return HParamsPlugin(context)
193790
def context(self, name):
        
        data = self._context(name)
        context = data.get("context")
        if context:
            return context

        assert self.load_path
        context_path = os.path.join(self.load_path, "contexts", "%s.rxt" % name)
        context = ResolvedContext.load(context_path)
        data["context"] = context
        data["loaded"] = True
        return context
208536
function getContext(i) {
  if (context) {
    return context
  } else {
    const path = getCallsite(i || 2).getFileName()
    const file = files[path]
    if (file) return file.group
    throw Error(`Test module was not loaded properly: "${path}"`)
  }
}
1116370
def get_context_data(self, **kwargs):
        """"""
        
        context = super(StrainList, self).get_context_data(**kwargs)
        context['strain_list_alive'] = Strain.objects.filter(animal__Alive=True).annotate(alive=Count('animal'))
        context['cages'] = Animal.objects.filter(Alive=True).values("Cage")        
        return context
962925
def from_context(cls, context):
        """"""
        return cls(id=context.id, context=context.to_dict())