If not yet in the cache, load the named template and compiles it,
        placing it into the cache.

        If in cache, return the cached template.
515802
def load(self, name):
        

        if self.reload:
            self._maybe_purge_cache()

        template = self.cache.get(name)
        if template:
            return template

        path = self.resolve(name)
        if not path:
            raise OSError(errno.ENOENT, "File not found: %s" % name)

        with codecs.open(path, 'r', encoding='UTF-8') as f:
            contents = f.read()
            mtime = os.fstat(f.fileno()).st_mtime

        template = self.load_string(contents, filename=path)
        template.mtime = mtime
        template.path = path

        self.cache[name] = template
        return template
1134178
def load(self, name: str, parent_path: str = None) -> Template:
        """"""
        name = self.resolve_path(name, parent_path=parent_path)
        with self.lock:
            if name not in self.templates:
                self.templates[name] = self._create_template(name)
            return self.templates[name]
682987
protected function _compile($template)
    {
        // Prepare template info
        $view_path = $this->_find_view($template);
        $cache_id  = 'blade-' . md5($view_path);
        // Test if a compiled version exists in the cache
        if ($compiled = $this->cache->file->get($cache_id)) {
            // In production, avoid to test if the template was updated
            if (ENVIRONMENT == 'production') {
                return $compiled;
            }
            // Return cache version if the template was not updated
            $meta = $this->cache->file->get_metadata($cache_id);
            if ($meta['mtime'] > filemtime($view_path)) {
                return $compiled;
            }
        }
        // Template content
        $template = file_get_contents($view_path);
        // Compilers
        foreach ($this->_compilers as $compiler) {
            $method   = "_compile_{$compiler}";
            $template = $this->$method($template);
        }
        // Store compiled version in the cache
        $this->cache->file->save($cache_id, $template, $this->cache_time);

        // Return compiled template
        return $template;
    }
733510
private final CompiledST loadTemplateResource(String prefix, String unqualifiedFileName) {
        //if (resourceRoot == null) return null;
        //return loadTemplate(resourceRoot, prefix, unqualifiedFileName);
        if (resourceRoots.isEmpty()) return null;
        CompiledST template = null;
        for (URL resourceRoot : resourceRoots) {
            if ((template = loadTemplate(resourceRoot, prefix, unqualifiedFileName)) != null)
                return template;
        }
        return null;
    }
427578
def template_exists(template_name):
    '''
    
    '''
    try:
        template.loader.get_template(template_name)
        return True
    except template.TemplateDoesNotExist:
        return False
276465
def load_template_source(template_name, template_dirs=None):
    """"""
    template_zipfiles = getattr(settings, "TEMPLATE_ZIP_FILES", [])

    # Try each ZIP file in TEMPLATE_ZIP_FILES.
    for fname in template_zipfiles:
        try:
            z = zipfile.ZipFile(fname)
            source = z.read(template_name)
        except (IOError, KeyError):
            continue
        z.close()
        # We found a template, so return the source.
        template_path = "%s:%s" % (fname, template_name)
        return (source, template_path)

    # If we reach here, the template couldn't be loaded
    raise TemplateDoesNotExist(template_name)
169911
function compile(template, context) {
        for (var name in context) {
            template = template.replace('{{' + name + '}}', context[name])
        }
        return template
    }
1347740
public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null)
    {
        /** @var Smarty_Internal_Template $_smarty_tpl
         * used in included file
         */
        $_smarty_tpl = $_template;

        return @include $_template->cached->filepath;
    }
725953
function cacheAndCompile(filename, str) {
    var layout_template = handlebars.compile(str);
    if (options.cache) {
      cache[filename] = layout_template;
    }

    render_with_layout(layout_template, options, cb);
  }
1069579
def find_first_available_template(self, template_name_list):
        
        if isinstance(template_name_list, six.string_types):
            return template_name_list
        else:
            # Take advantage of fluent_pages' internal implementation
            return _select_template_name(template_name_list)
1057736
function(name, ctx, cb) {
                if (lib.isFunction(ctx)) {
                    cb = ctx;
                    ctx = null;
                }

                // We support a synchronous API to make it easier to migrate
                // existing code to async. This works because if you don't do
                // anything async work, the whole thing is actually run
                // synchronously.
                var syncResult = null;

                this.getTemplate(name, function(err, tmpl) {
                    if (err && cb) {
                        cb(err);
                    } else if (err) {
                        throw err;
                    } else {
                        tmpl.render(ctx, cb || function(err, res) {
                            if (err) {
                                throw err;
                            }
                            syncResult = res;
                        });
                    }
                });

                return syncResult;
            }
322566
public Template getTemplate(String key, ResourceLoader loader)
	{
		return this.getTemplateByLoader(key, loader,true);
	}
1314718
public Template getTemplate(final String parentName, final String name) throws ResourceNotFoundException {
        return getTemplate(this.loader.concat(parentName, name));
    }
1217929
def get_template(name, base=None):
    '''
    '''
    # If the file doesn't exist, assume relative to base
    template_file = name
    if not os.path.exists(template_file):
        if base is None:
            base = get_templatedir()
        template_file = "%s/%s" %(base, name)

    # Then try again, if it still doesn't exist, bad name
    if os.path.exists(template_file):
        with open(template_file,"r") as filey:
            template = "".join(filey.readlines())
        return template
    bot.error("%s does not exist." %template_file)
306533
def resolve_template(template):
    ""
    if isinstance(template, (list, tuple)):
        return loader.select_template(template)
    elif isinstance(template, basestring):
        try:
            return loader.get_template(template)
        except TemplateDoesNotExist:
            return None
    else:
        return template
1347784
public static UriTemplate of(String template) {

		Assert.hasText(template, "Template must not be null or empty!");

		return CACHE.computeIfAbsent(template, UriTemplate::new);
	}
1222624
function (done) {
      var root = node_path.join(__dirname, 'templates', template);

      fs.exists(root, function(exists){
        if(exists){
          template_root = root;
        }else{
          template_root = node_path.join(DIR_CUSTOM_TEMPLATES, template)
        }
        done(null);
      });
    }