Check if a file is a template.

        A file is a considered a template if it is neither a partial nor
        ignored.

        :param filename: the name of the file to check
329053
def is_template(self, filename):
        
        if self.is_partial(filename):
            return False

        if self.is_ignored(filename):
            return False

        if self.is_static(filename):
            return False

        return True
438227
def enable_template(name)
      name = name.to_sym

      return false if @enabled_templates.include?(name)

      unless (template_dir = Template.templates[name])
        say "Unknown template #{name}", :red
        exit -1
      end

      new_template = Template::Directory.new(template_dir)

      # mark the template as enabled
      @enabled_templates << name

      # enable any other templates
      new_template.enable.each do |sub_template|
        enable_template(sub_template)
      end

      # append the new template to the end of the list,
      # to override previously loaded templates
      @templates << new_template

      # add the template directory to the source-paths
      self.source_paths << new_template.path
      return true
    end
696835
def load_template(self, name):
        
        # hopefully speeds up loading of templates a little, especially when loaded multiple times
        if name in self.cached_templates:
            logger.debug("Using cached template: %s", name)
            return self.cached_templates[name]

        logger.debug("Attempting to find template by name: %s", name)
        name_with_ext, provider_name, base_path = self.find_template_details(name)

        full_path = None
        if base_path is not None:
            full_path = os.path.join(base_path, name_with_ext)

        # load it with the relevant provider
        template = template_exception_handler(
            lambda: self.get_provider(provider_name).load_template(
                name_with_ext,
                full_path=full_path
            ),
            self.error_context,
            filename=full_path
        )

        # cache it for potential later use
        self.cached_templates[name] = template
        return template
935036
def __isValidFilename(self, filename):
        """"""
        if filename and isinstance(filename, string_types):
            if re.match(r'^[\w\d\_\-\.]+$', filename, re.I):
                if self.__isValidTGZ(filename) or self.__isValidZIP(filename):
                    return True
        return False
71982
def should_exclude(self, filename) -> bool:
        
        for skip_glob in self.skip_globs:
            if self.filename_matches_glob(filename, skip_glob):
                return True
        return False
820908
public boolean isHelpSetFile(String fileName) {
        if (helpSetFilter == null) {
            helpSetFilter = new WildcardFileFilter(helpSetPattern);
        }
        
        return helpSetFilter.accept(new File(fileName));
    }
1306635
def _validate_templates(self, app, files, verbose):
        
        from uliweb import application
        from uliweb.core.template import template_file
        from uliweb.utils.common import trim_path

        app.template_loader.log = None
        for f in files:
            try:
                t = app.template_loader.load(f)
                if verbose:
                    print 'PASSED', f
            except Exception as e:
                print 'FAILED', f, str(e)
971078
public function template_exists($filename)
    {
        if (!is_array($this->template_dir)) {
            return file_exists($this->template_dir . DIRECTORY_SEPARATOR . $filename);
        } else {
            foreach ($this->template_dir as $tpl_dir) {
                if (file_exists($tpl_dir . DIRECTORY_SEPARATOR . $filename)) {
                    return true;
                }
            }

            return false;
        }
    }
1172615
public function isNamed()
    {
        // If file is not array, then template
        // is not named for sure.
        if ( ! is_array($this->file)) {
            return false;
        }

        // Return false if template is named, but name 
        // is invalid. A valid name should be:
        if (
            isset($this->file[1]) && is_bool($this->file[1]) // should be set and not be a boolean
            || null === $this->file[1] // or null value
            || empty($this->file[1]) // or empty sting or array
        ) {
            return false;
        }

        return true;
    }
673735
def partial(name)
      name = self.class.generate_template_name name, config.file_template_extension

      # return self.read_template_from_media name, media
      @_cached_partials ||= {}
      (@_cached_partials[media] ||= {})[name] ||= self.read_template_from_media name, media
    end
815255
def render(filename, context=binding)
      contents=File.read(expand_filename(filename))
      template(contents, context)
    end
939399
private synchronized void checkFileName(String fileName) throws ParameterException{
		Validate.notNull(fileName);
		File cFile = new File(fileName);
		if(cFile.getName().length()==0)
			throw new ParameterException(ErrorCode.INCOMPATIBILITY, fileName + " is not a valid file-name!");
	}
35216
def grok_template_file(src):
    """"""
    if not src.startswith('builtin:'):
        return abspath(src)

    builtin = src.split(':')[1]
    builtin = "templates/%s.j2" % builtin
    return resource_filename(__name__, builtin)
946114
def filled_out_template(filename, **substitutions):
    ''''''
    res = None
    with open(filename, 'r') as fp:
        template = fp.read()
        res = filled_out_template_str(template, **substitutions)
    return res
172087
def _is_excluded(filename, exclusions):
    """"""
    for exclusion in exclusions:
        if fnmatch(filename, exclusion):
            return True

    return False
489117
def valid_file(cls, filename):
        
        file_ex = os.path.splitext(filename)[1].replace('.', '', 1)
        return file_ex in SUPPORTED_FILES and is_excel_file(filename)
608030
def _get_template(self, template_name, template_file):
        
        template = os.path.join(self.location, 'templates',
                                template_name, template_file)
        return jinja2.Template(open(template).read())