Returns theme based on site

        Returns None and sets settings.THEME if able to find a theme object by site.

        Otherwise, returns False.
513944
def theme_lookup(self):
        

        # check cache
        cache_key = 'theme:%s' % self.domain_unsplit
        theme = cache.get(cache_key)
        if theme:
            THEME.value = theme
            return None

        # check database
        if hasattr(self.site, 'themes'):
            try:
                themes = [theme.name for theme in self.site.themes.all()]
                THEME.value = themes[0]
                cache.set(cache_key, THEME.value, 5*60)
            except:
                return False
        return None
547359
def site(self, site):
        
        if site is None:
            raise ValueError("Invalid value for `site`, must not be `None`")
        if site is not None and len(site) > 255:
            raise ValueError("Invalid value for `site`, length must be less than or equal to `255`")
        if site is not None and len(site) < 3:
            raise ValueError("Invalid value for `site`, length must be greater than or equal to `3`")
        if site is not None and not re.search('(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?\\.)+[a-z]{2,}(?:@[a-z0-9](?:[-.](?=[a-z0-9])|[a-z0-9]){0,29})?', site):
            raise ValueError("Invalid value for `site`, must be a follow pattern or equal to `/(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?\\.)+[a-z]{2,}(?:@[a-z0-9](?:[-.](?=[a-z0-9])|[a-z0-9]){0,29})?/`")

        self._site = site
1323480
def require_theme_deps
      return false unless site.theme.runtime_dependencies

      site.theme.runtime_dependencies.each do |dep|
        next if dep.name == "jekyll"

        External.require_with_graceful_fail(dep.name) if plugin_allowed?(dep.name)
      end
    end
269563
def _get_site_class(self, sites):
        
        siteclass = sites.siteclass
        S = np.zeros_like(siteclass, dtype=np.float)
        S[(siteclass == b'C') | (siteclass == b'D')] = 1

        return S
1165169
def set_theme(self, theme):
        
        if theme in THEMES:
            self.palette = THEMES[theme]
            if self._scroll_bar:
                # TODO: fix protected access.
                self._scroll_bar._palette = self.palette
479483
def set_theme(color=True):
        
        if color:
            Console.theme = Console.theme_color
        else:
            Console.theme = Console.theme_bw
        Console.color = color
1176932
def _default(self, key, default=None):
        
        try:
            value = self.theme.themeables.property(key)
        except KeyError:
            value = None

        return value if value is not None else default
661685
def get_template_file(self):
        
        if os.path.exists(os.path.join(self.theme_dir, 'base.html')):
            return os.path.join(self.theme_dir, 'base.html')
        default_dir = os.path.join(THEMES_DIR, 'default')
        if not os.path.exists(os.path.join(default_dir, 'base.html')):
            raise IOError(u"Cannot find base.html in default theme")
        return os.path.join(default_dir, 'base.html')
743751
def site_name(self, site_name):
        
        # Set base class property site_name
        _Pybooru.site_name.fset(self, site_name)

        if ('api_version' and 'hashed_string') in SITE_LIST[site_name]:
            self.api_version = SITE_LIST[site_name]['api_version']
            self.hash_string = SITE_LIST[site_name]['hashed_string']
201829
function getTheme(req, res, next) {
  var params = {
    appId: req.params.projectid || req.params.id
  };
  forms.getAppTheme(_.extend(req.connectionOptions, params), function(err, theme) {
    if (err) {
      return next(err);
    }

    req.appformsResultPayload = req.appformsResultPayload || {};

    if (_.isObject(req.appformsResultPayload.data) && theme && !req.getFullTheme) {
      req.appformsResultPayload.data.theme = theme._id;
    } else {
      //Want the full theme definition
      req.appformsResultPayload = {
        data: theme
      };
    }

    next();
  });
}
587154
def use_theme(theme, directory=None):
    """"""
    repo = require_repo(directory)
    if theme not in list_themes(directory):
        raise ThemeNotFoundError(theme)

    old_theme = set_value(repo, 'theme', theme)
    return old_theme != theme
731901
public function theme()
    {
        // nothing set, skip theme
        if (!$this->theme || !isset($this->theme->name)) {
            return false;
        }

        // only theme name is set
        if (is_string($this->theme)) {
            return (object)[
                'name'     => $this->theme,
                'mods'     => [],
                'options'  => [],
                'menus'    => [],
                'sidebars' => []
            ];
        }

        // read theme setting
        return (object)[
            'name'     => $this->theme->name,
            'mods'     => isset($this->theme->mods) ? $this->theme->mods : [],
            'options'  => isset($this->theme->options) ? $this->theme->options : [],
            'menus'    => isset($this->theme->menus) ? $this->theme->menus : [],
            'sidebars' => isset($this->theme->sidebars) ? $this->theme->sidebars : []
        ];
    }
1189124
def _single_site(self):
        
        if appsettings.FLUENT_CONTENTS_FILTER_SITE_ID and self._parent_site is None:
            return self.parent_site(settings.SITE_ID)
        else:
            return self
1355940
def set_is_pallets_theme(app):
    
    if app.config.is_pallets_theme is not None:
        return

    theme = getattr(app.builder, "theme", None)

    while theme is not None:
        if theme.name == "pocoo":
            app.config.is_pallets_theme = True
            break

        theme = theme.base
    else:
        app.config.is_pallets_theme = False
51716
def theme_use(self, theme_name=None):
        
        if theme_name is not None:
            self.set_theme(theme_name)
        return ttk.Style.theme_use(self)
596660
def load_and_check(self, base_settings, prompt=None):
        
        checker = Checker(self.file_name, self.section, self.registry, self.strategy_type, prompt)
        settings = self.load(base_settings)
        if checker.check(settings):
            return settings, True
        return None, False
1232174
def get_themes():
    
    styles_dir = os.path.join(package_dir, 'styles')
    themes = [os.path.basename(theme).replace('.less', '')
              for theme in glob('{0}/*.less'.format(styles_dir))]
    return themes