Get working path to automaticaly searching for default template.
496765
function getWorkingPath(file) {

      var completePath = JSON.stringify(file).slice(2,-2).split('/'),
        lastPathElement = completePath.pop(),
        fileDirectory = completePath.splice(lastPathElement).join('/');

        return fileDirectory;
    }
1144479
def find_name(self, template_name, search_dirs):
        
        file_name = self.make_file_name(template_name)

        return self._find_path_required(search_dirs, file_name)
648873
def retrieve_template(self):
        
        links = self.retrieve_instance_links()
        self.log.debug('Links is \n%s', pformat(links))
        self.pipeline_config['instance_links'].update(links)
        jsondata = get_template(
            template_file='infrastructure/app_data.json.j2',
            appinfo=self.appinfo,
            pipeline_config=self.pipeline_config,
            formats=self.generated,
            run_as_user=DEFAULT_RUN_AS_USER)
        self.log.debug('jsondata is %s', pformat(jsondata))
        return jsondata
710363
def get_page_templates():
    """"""
    PAGE_TEMPLATES = get_setting('PAGE_TEMPLATES',
        default_value=())
    if isinstance(PAGE_TEMPLATES, collections.Callable):
        return PAGE_TEMPLATES()
    else:
        return PAGE_TEMPLATES
118060
function getDefaults(context, options) {
  const defaults = _.cloneDeep(DEFAULT_CONFIG);
  const taskName = context && context.seq[0];

  if (options.src) {
    if (taskName)
      defaults.watch = {
        files: [$.glob(`**/*`, { base: $.glob(options.src, { base: options.base }), exts: FILE_EXTENSIONS })],
        tasks: [taskName]
      };

    defaults.jade.basedir = $.glob(options.src, { base: options.base });
    defaults.pug.basedir = $.glob(options.src, { base: options.base });
    defaults.inPlace.engineOptions.basedir = $.glob(options.src, { base: options.base });
  }

  return defaults;
}
341194
def get_project_template(name="Default", output_type='exe', debugger=None, build_dir='build'):
        

        project_template = {
            'build_dir' : build_dir,  # Build output path
            'debugger' : debugger,    # Debugger
            'export_dir': '',         # Export directory path
            'name': name,             # project name
            'output_type': output_type, # output type, default - exe
            'target': '',             # target
            'tools_supported': [],    # Tools which are supported,
        }
        project_template.update(ProjectTemplate._get_common_data_template())
        project_template.update(ProjectTemplate._get_tool_specific_data_template())
        return project_template
743632
function findImages(templateName, source, deps, options) {
  var imgReg = /(<img\s.*?src\s?=\s?['"])([^'"]+)(['"][^/>]*\/?>)/g,
    referenceReg = /[{}]/,
    result = null;

  // search source & add a dependency for each match
  while ((result = imgReg.exec(source)) !== null) {
    const src = result[2];
    const imageTemplateName = `${templateName}dep${deps.length}`;

    // skip this image if a) it has a dustJS reference in it or b) an optional excludeImageRegex matches
    if (referenceReg.test(src)) {
      log(options, `skipping image ${src} (src includes a DustJS reference)`);
      continue
    }
    if (options.excludeImageRegex && options.excludeImageRegex.test(src)) {
      log(options, `skipping image ${src} (src matches excludeImageRegex)`);
      continue;
    }

    log(options, `requiring image ${src}`);

    // do our own custom registration of a template-like function that will use require to get the actual path
    const srcTemplate = `(function() {
      var path = require('${src}');
      dust.register('${imageTemplateName}', body_0);

      function body_0(chk, ctx) {
          return chk.write(path);
      }
      return body_0;
    })();`
    deps.push(srcTemplate);

    // replace the original image path with a partial template call to our method that will return the path.
    const replace = `${result[1]}{>"${imageTemplateName}"/}${result[3]}`
    source = source.replace(result[0], replace);

    // update regex index
    imgReg.lastIndex += (replace.length - result[0].length);
  }

  return source;
}
1298427
def get_template_substitution_values(self, value):
        
        return {
            'initial': os.path.basename(conditional_escape(value)),
            'initial_url': conditional_escape(value.url),
        }
153658
def load_default_templates(self):
        """"""
        for importer, modname, is_pkg in pkgutil.iter_modules(templates.__path__):
            self.register_template('.'.join((templates.__name__, modname)))
703006
def workflow_template_path(cls, project, region, workflow_template):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/regions/{region}/workflowTemplates/{workflow_template}",
            project=project,
            region=region,
            workflow_template=workflow_template,
        )
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']
579988
def _absolute_template_path(fn):
    
    return os.path.join(os.path.dirname(__file__), "xslt", fn)
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)
391871
def find_template(views, name, engine)
      yield ::File.join(views, "#{name}.#{@preferred_extension}")

      if Tilt.respond_to?(:mappings)
        Tilt.mappings.each do |ext, engines|
          next unless ext != @preferred_extension and engines.include? engine
          yield ::File.join(views, "#{name}.#{ext}")
        end
      else
        Tilt.default_mapping.extensions_for(engine).each do |ext|
          yield ::File.join(views, "#{name}.#{ext}") unless ext == @preferred_extension
        end
      end
    end
1001361
def finding_path(cls, project, scan_config, scan_run, finding):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/scanConfigs/{scan_config}/scanRuns/{scan_run}/findings/{finding}",
            project=project,
            scan_config=scan_config,
            scan_run=scan_run,
            finding=finding,
        )
1127326
def get_template_dir():
    """"""
    try:
        template_dir = os.path.expanduser(os.environ["NET_TEXTFSM"])
        index = os.path.join(template_dir, "index")
        if not os.path.isfile(index):
            # Assume only base ./ntc-templates specified
            template_dir = os.path.join(template_dir, "templates")
    except KeyError:
        # Construct path ~/ntc-templates/templates
        home_dir = os.path.expanduser("~")
        template_dir = os.path.join(home_dir, "ntc-templates", "templates")

    index = os.path.join(template_dir, "index")
    if not os.path.isdir(template_dir) or not os.path.isfile(index):
        msg = """
Valid ntc-templates not found, please install https://github.com/networktocode/ntc-templates
and then set the NET_TEXTFSM environment variable to point to the ./ntc-templates/templates
directory."""
        raise ValueError(msg)
    return os.path.abspath(template_dir)
732973
def get_template_path(self, content=None):
        
        if isinstance(content, Paginator):
            return op.join('api', 'paginator.%s' % self.format)

        if isinstance(content, UpdatedList):
            return op.join('api', 'updated.%s' % self.format)

        app = ''
        name = self.resource._meta.name

        if not content:
            content = self.resource._meta.model

        if isinstance(content, (Model, ModelBase)):
            app = content._meta.app_label
            name = content._meta.module_name

        basedir = 'api'
        if getattr(self.resource, 'api', None):
            basedir = self.resource.api.prefix

        return op.join(
            basedir,
            str(self.resource.api or ''), app, "%s.%s" % (name, self.format)
        )