Render REANA_CVMFS_PVC_TEMPLATE.
12613
def render_cvmfs_pvc(cvmfs_volume):
    """"""
    name = CVMFS_REPOSITORIES[cvmfs_volume]
    rendered_template = dict(REANA_CVMFS_PVC_TEMPLATE)
    rendered_template['metadata']['name'] = 'csi-cvmfs-{}-pvc'.format(name)
    rendered_template['spec']['storageClassName'] = "csi-cvmfs-{}".format(name)
    return rendered_template
1285218
def render(filename, obj):
    """"""
    template_path = abspath(filename)
    env = jinja_env(template_path)
    template_base = os.path.basename(template_path)
    try:
        parsed_content = env.parse(env
                                   .loader
                                   .get_source(env, template_base))
        template_vars = meta.find_undeclared_variables(parsed_content)
        if template_vars:
            missing_vars(template_vars, parsed_content, obj)

        LOG.debug("rendering %s with %s vars",
                  template_path, len(template_vars))
        return env \
            .get_template(template_base) \
            .render(**obj)
    except jinja2.exceptions.TemplateSyntaxError as exception:
        template_trace = traceback.format_tb(sys.exc_info()[2])
        # Different error context depending on whether it is the
        # pre-render variable scan or not
        if exception.filename:
            template_line = template_trace[len(template_trace) - 1]
            raise aomi_excep.Validation("Bad template %s %s" %
                                        (template_line,
                                         str(exception)))

        template_str = ''
        if isinstance(exception.source, tuple):
            # PyLint seems confused about whether or not this is a tuple
            # pylint: disable=locally-disabled, unsubscriptable-object
            template_str = "Embedded Template\n%s" % exception.source[0]

        raise aomi_excep.Validation("Bad template %s" % str(exception),
                                    source=template_str)

    except jinja2.exceptions.UndefinedError as exception:
        template_traces = [x.strip()
                           for x in traceback.format_tb(sys.exc_info()[2])
                           if 'template code' in x]
        raise aomi_excep.Validation("Missing template variable %s" %
                                    ' '.join(template_traces))
178595
def render_data(context, templateContent, proxyMode, rendered_data, menukey='menubar'):
    """"""

    if proxyMode:
        # Update csrf_tokens
        csrf = unicode(context['csrf_token'])
        tag = u'{~__PLUGIT_CSRF_TOKEN__~}'
        rendered_data = unicode(rendered_data, 'utf-8').replace(tag, csrf)

        result = rendered_data  # Render in proxy mode
        menu = None  # Proxy mode plugit do not have menu

    else:
        # Render it
        template = Template(templateContent)
        result = template.render(context)
        menu = _get_node(template, context, menukey)

    return (result, menu)
964235
def rendered(self):
        """"""
        if not self._rendered:
            template_path = get_template_path(self.raw_template_path)
            if template_path:
                with open(template_path, 'r') as template:
                    if len(os.path.splitext(template_path)) == 2 and (
                            os.path.splitext(template_path)[1] == '.j2'):
                        self._rendered = Template(template.read()).render(
                            context=self.context,
                            mappings=self.mappings,
                            name=self.name,
                            variables=self.resolved_variables
                        )
                    else:
                        self._rendered = template.read()
            else:
                raise InvalidConfig(
                    'Could not find template %s' % self.raw_template_path
                )

        return self._rendered
30152
def render_tmplt(path, cp):
    

    # define filename and slug from path
    filename = os.path.basename(path)
    slug = filename.replace('.', '_')

    # initializations
    content = None

    # read file as a string
    with open(path, 'rb') as fp:
        content = fp.read()

    # replace all the escaped characters
    content = unescape(content, unescape_table)

    # render template
    template_dir = '/'.join(path.split('/')[:-1])
    env = Environment(loader=FileSystemLoader(template_dir))
    env.globals.update(setup_template_render=setup_template_render)
    env.globals.update(get_embedded_config=get_embedded_config)
    env.globals.update(path_exists=os.path.exists)
    template = env.get_template(filename)
    context = {'filename' : filename,
               'slug'     : slug,
               'cp'       : cp,
               'content'  : content}
    output = template.render(context)

    return output
551067
def render(template_file, saltenv='base', sls='', context=None, tmplpath=None, **kws):
    '''
    
    '''
    tmp_data = salt.utils.templates.MAKO(template_file, to_str=True,
                    salt=__salt__,
                    grains=__grains__,
                    opts=__opts__,
                    pillar=__pillar__,
                    saltenv=saltenv,
                    sls=sls,
                    context=context,
                    tmplpath=tmplpath,
                    **kws)
    if not tmp_data.get('result', False):
        raise SaltRenderError(tmp_data.get('data',
            'Unknown render error in mako renderer'))
    return six.moves.StringIO(tmp_data['data'])
1280105
def render(template, **kwargs):
    
    import jinja2
    import os.path as path

    searchpath = path.join(path.dirname(__file__), 
        "templates") 
    loader = jinja2.FileSystemLoader(searchpath=searchpath)
    env = jinja2.Environment(loader=loader)
    temp = env.get_template(template)

    return temp.render(**kwargs)
520349
def render_python_template_to(src, dest, subsd, only_update=False,
                              prev_subsd=None, create_dest_dirs=True,
                              logger=None):
        
        if only_update:
            if subsd == prev_subsd:
                if not missing_or_other_newer(dest, src):
                    if logger:
                        msg = ("Did not re-render {}. "
                               "(destination newer + same dict)")
                        logger.info(msg.format(src))
                    return

        with open(src, 'rt') as ifh:
            data = ifh.read()  # Don't go crazy on file size...

        if create_dest_dirs:
            dest_dir = os.path.dirname(dest)
            if not os.path.exists(dest_dir):
                make_dirs(dest_dir)

        with open(dest, 'wt') as ofh:
            ofh.write(data % subsd)
967047
def _render_template(config_file):
    '''
    
    '''
    dirname, filename = os.path.split(config_file)
    env = jinja2.Environment(loader=jinja2.FileSystemLoader(dirname))
    template = env.get_template(filename)
    return template.render(__grains__)
490849
def render_to_string(self, *args, **kwargs):
        """"""
        try:
            template_name, args = args[0], args[1:]
        except IndexError:
            raise TypeError('name of template required')
        return self.get_template(template_name).render(*args, **kwargs)
983066
def render(pieces, style):
    """"""
    if pieces["error"]:
        return {"version": "unknown",
                "full-revisionid": pieces.get("long"),
                "dirty": None,
                "error": pieces["error"],
                "date": None}

    if not style or style == "default":
        style = "pep440"  # the default

    if style == "pep440":
        rendered = render_pep440(pieces)
    elif style == "pep440-pre":
        rendered = render_pep440_pre(pieces)
    elif style == "pep440-post":
        rendered = render_pep440_post(pieces)
    elif style == "pep440-old":
        rendered = render_pep440_old(pieces)
    elif style == "pep440-branch-based":
        rendered = render_pep440_branch_based(pieces)
    elif style == "git-describe":
        rendered = render_git_describe(pieces)
    elif style == "git-describe-long":
        rendered = render_git_describe_long(pieces)
    else:
        raise ValueError("unknown style '%s'" % style)

    return {"version": rendered, "full-revisionid": pieces["long"],
            "dirty": pieces["dirty"], "error": None,
            "date": pieces.get("date")}
622177
def _render(template, callable_, args, data, as_unicode=False):
    """"""

    if as_unicode:
        buf = util.FastEncodingBuffer(as_unicode=True)
    elif template.bytestring_passthrough:
        buf = compat.StringIO()
    else:
        buf = util.FastEncodingBuffer(
                        as_unicode=as_unicode,
                        encoding=template.output_encoding,
                        errors=template.encoding_errors)
    context = Context(buf, **data)
    context._outputting_as_unicode = as_unicode
    context._set_with_template(template)

    _render_context(template, callable_, context, *args,
                            **_kwargs_for_callable(callable_, data))
    return context._pop_buffer().getvalue()
212301
def renderModelHasComponent(self, pchRenderModelName, pchComponentName):
        """"""

        fn = self.function_table.renderModelHasComponent
        result = fn(pchRenderModelName, pchComponentName)
        return result
992204
def render_template(self, template, **kwargs):
        '''
        
        '''
        high = compile_template(template,
                                self.rend,
                                self.opts['renderer'],
                                self.opts['renderer_blacklist'],
                                self.opts['renderer_whitelist'],
                                **kwargs)
        if not high:
            return high
        return self.pad_funcs(high)
1077880
def render_template(self, template_file, target_file, template_vars = {}):
        
        template_dir = str(self.__class__.__name__).lower()
        template = self.jinja_env.get_template(os.path.join(template_dir, template_file))
        file_path = os.path.join(self.work_root, target_file)
        with open(file_path, 'w') as f:
            f.write(template.render(template_vars))
283342
def render(self, template, filename, context={}, filters={}):
        
        filename = os.path.normpath(filename)
        path, file = os.path.split(filename)
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise

        path, file = os.path.split(template)
        loader = jinja2.FileSystemLoader(path)
        env = jinja2.Environment(loader=loader, trim_blocks=True, lstrip_blocks=True)
        env.filters.update(filters)
        template = env.get_template(file)
        text = template.render(context)
        with open(filename, 'wt') as f:
            f.write(text)
1246094
def _render(self, data, formula_def):
        '''
        
        '''
        # FORMULA can contain a renderer option
        renderer = formula_def.get('renderer', self.opts.get('renderer', 'jinja|yaml'))
        rend = salt.loader.render(self.opts, {})
        blacklist = self.opts.get('renderer_blacklist')
        whitelist = self.opts.get('renderer_whitelist')
        template_vars = formula_def.copy()
        template_vars['opts'] = self.opts.copy()
        return compile_template(
            ':string:',
            rend,
            renderer,
            blacklist,
            whitelist,
            input_data=data,
            **template_vars
        )