Return a list of directories where templates may be located.
171772
def _get_template_dirs(type="plugin"):
    
    template_dirs = [
        os.path.expanduser(os.path.join(USER_CONFIG_DIR, "templates", type)),
        os.path.join("rapport", "templates", type)  # Local dev tree
    ]
    return template_dirs
311727
function getTemplatesList(customPath = null) {
  const predefined = getDirectories(DEFAULT_PATH_TEMPLATES).reduce(createListOfDirectories, {})
  try {
    const custom = customPath ? getDirectories(customPath).reduce(createListOfDirectories, {}) : []

    return { ...predefined, ...custom }
  } catch (error) {
    Logger.warn('The custom templates path that you supply is unreachable')
    Logger.warn('falling back to defaults templates')
    return predefined
  }
}
333965
def file_attribs(location,
                 mode=None,
                 owner=None,
                 group=None,
                 use_sudo=False,
                 recursive=True):
    """"""
    return dir_attribs(location=location,
                       mode=mode,
                       owner=owner,
                       group=group,
                       recursive=recursive,
                       use_sudo=False)
593641
def get_template_folder():
    """"""
    cfg = get_project_configuration()
    if 'templates' not in cfg:
        home = os.path.expanduser("~")
        rcfile = os.path.join(home, ".hwrtrc")
        cfg['templates'] = pkg_resources.resource_filename('hwrt',
                                                           'templates/')
        with open(rcfile, 'w') as f:
            yaml.dump(cfg, f, default_flow_style=False)
    return cfg['templates']
920878
def ListDirectoryAbsolute(directory):
  """"""
  return (os.path.join(directory, path)
          for path in tf.io.gfile.listdir(directory))
53616
def list_templates(self) -> List[str]:
        
        result = set()
        for loader in self._loaders():
            for template in loader.list_templates():
                result.add(str(template))
        return list(result)
824742
function getTemplates(config) {

  var templates = {};

  Object.keys(templatePaths).forEach(function(key) {
      if (config.templates && (config.templates[key] && config.templates[key] !== true)) {
        templates[key] = config.templates[key];
      } else {
        templates[key] = fs.readFileSync(__dirname + templatePaths[key], "utf-8");
      }
    });

  return templates;
}
1280943
def get_templates():
    
    injected = {}
    for name, data in templates.items():
        injected[name] = dict([(k, v % env) for k, v in data.items()])
    return injected
736040
def _list_templates(settings):
    
    for idx, option in enumerate(settings.config.get("project_templates"), start=1):
        puts("  {0!s:5} {1!s:36}".format(
            colored.yellow("[{0}]".format(idx)),
            colored.cyan(option.get("name"))
        ))
        if option.get("url"):
            puts("      {0}\n".format(option.get("url")))
1130790
def find_template_from_path(filepath, paths=None):
    
    if paths is None or not paths:
        paths = [os.path.dirname(filepath), os.curdir]

    for path in paths:
        candidate = os.path.join(path, filepath)
        if os.path.exists(candidate):
            return candidate

    LOGGER.warning("Could not find template=%s in paths=%s", filepath, paths)
    return None
1086153
protected function getTwigTemplatesIn($directories)
    {
        if (count($directories) === 0) {
            return array();
        }
        $templates = Finder::create()->in($directories)->files()->name('*.*.twig');
        $templates = iterator_to_array($templates, false);
        $templates = array_map(function (SplFileInfo $file) {
            return $file->getRealPath();
        }, $templates);
        return $templates;
    }
237560
def _TemplateNamesToFiles(self, template_str):
        """"""
        template_list = template_str.split(":")
        template_files = []
        try:
            for tmplt in template_list:
                template_files.append(open(os.path.join(self.template_dir, tmplt), "r"))
        except:  # noqa
            for tmplt in template_files:
                tmplt.close()
            raise

        return template_files
752413
def get_available_themes():
    
    for d in settings.TEMPLATE_DIRS:
        for _d in os.listdir(d):
            if os.path.isdir(os.path.join(d, _d)) and is_theme_dir(_d):
                yield _d
1110938
def dirs(self):
        
        if self._dirs.get(connection.schema_name, None) is None:
            try:
                # Use directories configured via MULTITENANT_TEMPLATE_DIRS
                dirs = [
                    utils.parse_tenant_config_path(dir_)
                    for dir_ in settings.MULTITENANT_TEMPLATE_DIRS
                ]
            except AttributeError:
                raise ImproperlyConfigured(
                    "To use {}.{} you must define the MULTITENANT_TEMPLATE_DIRS setting.".format(
                        __name__, Loader.__name__
                    )
                )

            self.dirs = dirs

        return self._dirs[connection.schema_name]
550760
def list_templates():
    """"""
    templates = [f for f in glob.glob(os.path.join(template_path, '*.yaml'))]
    return templates
739042
public function listTemplateFolders()
    {

        $this->setUpTemplate();
        $result = [];
        foreach ($this->templateNamespace as $ns => $paths) {
            foreach ($paths as $path) {
                $path = $this->getRootPath() . "/" . $path;
                if ($ns == "") {
                    $result[] = $path;
                } else {
                    $result[] = ['path' => $path, 'namespace' => $ns];
                }
            }
        }

        return $result;
    }
1004458
def get_template_names(self):
        """"""
        if self.request.is_ajax():
            template = self.ajax_template_name
        else:
            template = self.template_name
        return template