Construct a list of possible paths to templates.
558901
def _tpl_possibilities(self):
        
        tpl_possibilities = [
            os.path.realpath(self.tpl)
        ]
        for tpl_dir in self.tpl_dirs:
            tpl_possibilities.append(os.path.realpath(os.path.join(tpl_dir, "{0}.tpl".format(self.tpl))))
            tpl_possibilities.append(os.path.realpath(os.path.join(tpl_dir, "{0}.py".format(self.tpl))))

        return tpl_possibilities
368254
public function getPaths() : array
    {
        $templatePaths = [];

        $paths = $this->template->getFinder()->getPaths();
        $hints = $this->template->getFinder()->getHints();

        foreach ($paths as $path) {
            $templatePaths[] = new TemplatePath($path);
        }

        foreach ($hints as $namespace => $path) {
            $templatePaths[] = new TemplatePath($namespace, $path);
        }

        return $templatePaths;
    }
1178493
def _relative_paths(xs, base_path):
    
    if isinstance(xs, six.string_types):
        if xs.startswith(base_path):
            return xs.replace(base_path + "/", "", 1)
        else:
            return xs
    elif isinstance(xs, (list, tuple)):
        return [_relative_paths(x, base_path) for x in xs]
    elif isinstance(xs, dict):
        out = {}
        for k, v in xs.items():
            out[k] = _relative_paths(v, base_path)
        return out
    else:
        return xs
684014
def __ConstructRelativePath(self, method_config, request,
                                relative_path=None):
        """"""
        python_param_names = util.MapParamNames(
            method_config.path_params, type(request))
        params = dict([(param, getattr(request, param, None))
                       for param in python_param_names])
        params = util.MapRequestParams(params, type(request))
        return util.ExpandRelativePath(method_config, params,
                                       relative_path=relative_path)
1344988
def paths_wanted(self):
        """"""
        return set(address.new(b, target='all') for b in self.missing_nodes)
1334997
def template_paths(recipe_path)
      Dir.glob(Pathname.new(recipe_path).dirname.dirname + "templates" +
        "**/*", File::FNM_DOTMATCH).select do |path|
        File.file?(path)
      end.reject do |path|
        File.basename(path) == ".DS_Store" || File.extname(path) == ".swp"
      end
    end
752389
def get_template_sources(template_name, template_dirs=None):
        
        if not connection.tenant or isinstance(connection.tenant, FakeTenant):
            return
        if not template_dirs:
            try:
                template_dirs = settings.MULTITENANT_TEMPLATE_DIRS
            except AttributeError:
                raise ImproperlyConfigured('To use %s.%s you must define the MULTITENANT_TEMPLATE_DIRS' %
                                           (__name__, FilesystemLoader.__name__))
        for template_dir in template_dirs:
            try:
                if '%s' in template_dir:
                    yield safe_join(template_dir % connection.tenant.domain_url, template_name)
                else:
                    yield safe_join(template_dir, connection.tenant.domain_url, template_name)
            except UnicodeDecodeError:
                # The template dir name was a bytestring that wasn't valid UTF-8.
                raise
            except ValueError:
                # The joined path was located outside of this particular
                # template_dir (it might be inside another one, so this isn't
                # fatal).
                pass
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)
563185
def template(path, extend_path, out):
    
    files = []

    # add the "extender" template when it exists
    if len(extend_path) > 0:
        # determine the base readme path
        base_path = os.path.dirname(extend_path)
        new_base_path = os.path.join(base_path, "README.{0}.j2".format(out))

        if os.path.exists(new_base_path):
            path = new_base_path

        if os.path.exists(extend_path):
            files = [path, extend_path]
        else:
            ui.error(c.MESSAGES["template_extender_missing"])
            ui.error(extend_path)
            sys.exit(1)
    else:
        files = [path]

    try:
        # Use the subclassed relative environment class
        env = RelEnvironment(trim_blocks=True)

        # Add a unique dict filter, by key.
        # DEPRECATION WARNING: This is only used for backwards compatibility,
        #                      please use the unique filter instead.
        def unique_dict(items, key):
            return {v[key]: v for v in items}.values()

        env.filters["unique_dict"] = unique_dict

        def unique(a):

            # Don’t use the following commented out optimization which is used
            # in ansible/lib/ansible/plugins/filter/mathstuff.py in Ansigenome
            # as it resorts the role dependencies:
            # if isinstance(a,collections.Hashable):
            #     c = set(a)

            c = []
            for x in a:
                if x not in c:
                    c.append(x)
            return c

        env.filters["unique"] = unique

        # create a dictionary of templates
        templates = dict(
            (name, codecs.open(name, "rb", 'UTF-8').read())
            for name in files)
        env.loader = DictLoader(templates)

        # return the final result (the last template in the list)
        return env.get_template(files[len(files) - 1])
    except Exception as err:
        ui.error(c.MESSAGES["template_error"], err)
        sys.exit(1)
1287539
def paths(self, value):
        """"""

        if value is None:
            value = ()

        elif isinstance(value, string_types):
            value = (value, )

        self._paths = tuple(value)

        if self.autoconf:
            self.applyconfiguration()
1285724
def iter_paths(src_dir):
    
    for x in scandir(os.path.join(src_dir)):
        if x.is_dir(follow_symlinks=False):
            for x in iter_paths(x.path):
                yield x
        else:
            yield x
550031
def gen_template_files(path):
    "  "

    path = path.rstrip(op.sep)
    for root, _, files in walk(path):
        for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files):
            yield op.relpath(op.join(root, f), path)
864699
def partial(template_path, options = {})
      raise RablRails::PartialError.new("No object was given to partial #{template_path}") unless options[:object]
      object = options[:object]
      @_locals = options[:locals].freeze

      return [] if object.respond_to?(:empty?) && object.empty?

      template = RablRails::Library.instance.compile_template_from_path(template_path, @_context)
      if object.respond_to?(:each)
        object.map { |o| sub_visit o, template.nodes }
      else
        sub_visit object, template.nodes
      end
    ensure
      @_locals = {}
    end
1056353
def path(self, args, kw):
        """"""
        params = self._pop_params(args, kw)
        if args or kw:
            raise InvalidArgumentError("Extra parameters (%s, %s) when building path for %s" % (args, kw, self.template))
        return self.build_url(**params)
778992
def path_context(self, path):
        """"""
        prefix = os.path.commonprefix([path, self._path])
        relative_path = path[len(prefix) :]
        relative_path = relative_path.strip(os.sep)
        attrs = self.CONTEXT_ATTRS
        for i, elt in enumerate(relative_path.split(os.sep)):
            yield attrs[i], elt
        yield 'path', path
368193
def _build_paths():
    
    paths = sysconfig.get_paths()
    return {
        "prefix": sys.prefix,
        "data": paths["data"],
        "scripts": paths["scripts"],
        "headers": paths["include"],
        "purelib": paths["purelib"],
        "platlib": paths["platlib"],
    }
929131
def _items_to_rela_paths(self, items):
        """"""
        paths = []
        for item in items:
            if isinstance(item, (BaseIndexEntry, (Blob, Submodule))):
                paths.append(self._to_relative_path(item.path))
            elif isinstance(item, string_types):
                paths.append(self._to_relative_path(item))
            else:
                raise TypeError("Invalid item type: %r" % item)
        # END for each item
        return paths