Get color index.

        Refresh data from Vera if refresh is True, otherwise use local cache.
168139
def get_color_index(self, colors, refresh=False):
        
        if refresh:
            self.refresh_complex_value('SupportedColors')

        sup = self.get_complex_value('SupportedColors')
        if sup is None:
            return None

        sup = sup.split(',')
        if not set(colors).issubset(sup):
            return None

        return [sup.index(c) for c in colors]
84780
function getColor(varName, mappings) {
  const color = mappings[varName];
  if (color in mappings) {
    return getColor(color, mappings);
  } else {
    return color;
  }
}
152674
def GetRaw(self, name, context=None, default=utils.NotAValue):
    """"""
    if context is None:
      context = self.context

    # Getting a raw value is pretty cheap so we wont bother with the cache here.
    _, value = self._GetValue(name, context, default=default)
    return value
956704
async def refresh(self):
        """"""
        raw_data = await self.request.get(self._resource_path, {"refresh": "true"})

        self._raw_data = raw_data[ATTR_SHADE]
165463
def vera_request(self, **kwargs):
        """"""
        request_payload = {
            'output_format': 'json',
            'SceneNum': self.scene_id,
        }
        request_payload.update(kwargs)

        return self.vera_controller.data_request(request_payload)
70395
function updateCache(dataIndexInside) {
        dataIndexInside == null && (dataIndexInside = currDataIndexInside);
        if (currDirty) {
            currItemModel = data.getItemModel(dataIndexInside);
            currLabelNormalModel = currItemModel.getModel(LABEL_NORMAL);
            currLabelEmphasisModel = currItemModel.getModel(LABEL_EMPHASIS);
            currVisualColor = data.getItemVisual(dataIndexInside, 'color');

            currDirty = false;
        }
    }
493073
def get_data(url, gallery_dir):
    """"""

    # shelve keys need to be str in python 2
    if sys.version_info[0] == 2 and isinstance(url, unicode):
        url = url.encode('utf-8')

    cached_file = os.path.join(gallery_dir, 'searchindex')
    search_index = shelve.open(cached_file)
    if url in search_index:
        data = search_index[url]
    else:
        data = _get_data(url)
        search_index[url] = data
    search_index.close()

    return data
111881
def _load_background_color(self):
        
        url = self.build_url(self._endpoints.get('fill'))
        response = self.session.get(url)
        if not response:
            return None
        data = response.json()
        self._background_color = data.get('color', None)
292006
def get_color_data(self, condition):
        '''
        
        '''
        if condition not in self.color_icons:
            # Check for similarly-named conditions if no exact match found
            condition_lc = condition.lower()
            if 'cloudy' in condition_lc or 'clouds' in condition_lc:
                if 'partly' in condition_lc:
                    condition = 'Partly Cloudy'
                else:
                    condition = 'Cloudy'
            elif condition_lc == 'overcast':
                condition = 'Cloudy'
            elif 'thunder' in condition_lc or 't-storm' in condition_lc:
                condition = 'Thunderstorm'
            elif 'snow' in condition_lc:
                condition = 'Snow'
            elif 'rain' in condition_lc or 'showers' in condition_lc:
                condition = 'Rainy'
            elif 'sunny' in condition_lc:
                condition = 'Sunny'
            elif 'clear' in condition_lc or 'fair' in condition_lc:
                condition = 'Fair'
            elif 'fog' in condition_lc:
                condition = 'Fog'

        return self.color_icons['default'] \
            if condition not in self.color_icons \
            else self.color_icons[condition]
249764
def refresh(self):
        ''''''

        if not self._item_path:
            raise AttributeError('refresh is not available for %s' % self._type)
        if not self.id:
            raise RedmineError('%s did not come from the Redmine server - no link.' % self._type)

        try:
            self.save()
        except:
            pass

        # Mimic the Redmine_Item_Manager.get command
        target = self._item_path % self.id
        json_data = self._redmine.get(target)
        data = self._redmine.unwrap_json(self._type, json_data)
        self._update_data(data=data)
63781
def refresh_datasources(
            self,
            datasource_name=None,
            merge_flag=True,
            refreshAll=True):
        
        ds_list = self.get_datasources()
        blacklist = conf.get('DRUID_DATA_SOURCE_BLACKLIST', [])
        ds_refresh = []
        if not datasource_name:
            ds_refresh = list(filter(lambda ds: ds not in blacklist, ds_list))
        elif datasource_name not in blacklist and datasource_name in ds_list:
            ds_refresh.append(datasource_name)
        else:
            return
        self.refresh(ds_refresh, merge_flag, refreshAll)
1298060
def get_cached_data(datatable, **kwargs):
    
    cache_key = '%s%s' % (CACHE_PREFIX, datatable.get_cache_key(**kwargs))
    data = cache.get(cache_key)
    log.debug("Reading data from cache at %r: %r", cache_key, data)
    return data
886671
def data(self):
        """"""
        key = cache_key(self.name)
        data = cache.get(key)
        if data is None:
            logger.debug("Updating package info for %s from PyPI.", self.name)
            data = requests.get(self.url).json()
            cache.set(key, data, PYPI_CACHE_EXPIRY)
        return data
1355504
def check_refresh(opts, refresh=None):
    '''
    
    '''
    return bool(
        salt.utils.data.is_true(refresh) or
        (os.path.isfile(rtag(opts)) and refresh is not False)
    )
372943
def get_refresh_flag(self, filename):
        
        if filename is not None and filename != self.open_filename:
            self.open_filename = filename
            self.tree_refresh_flag = True
            self.data_refresh_flag = True
            return True
        else:
            return False
587624
async def get_shade(self, shade_id, from_cache=True) -> BaseShade:
        """"""
        if not from_cache:
            await self.get_shades()
        for _shade in self.shades:
            if _shade.id == shade_id:
                return _shade
        raise ResourceNotFoundException("Shade not found. Id: {}".format(shade_id))
3880
def get(self):
        """"""
        return self.render(
            'index.html',
            databench_version=DATABENCH_VERSION,
            meta_infos=self.meta_infos(),
            **self.info
        )