Render the pillar data and return
771807
def compile_pillar(self, ext=True):
        '''
        
        '''
        top, top_errors = self.get_top()
        if ext:
            if self.opts.get('ext_pillar_first', False):
                self.opts['pillar'], errors = self.ext_pillar(self.pillar_override)
                self.rend = salt.loader.render(self.opts, self.functions)
                matches = self.top_matches(top)
                pillar, errors = self.render_pillar(matches, errors=errors)
                pillar = merge(
                    self.opts['pillar'],
                    pillar,
                    self.merge_strategy,
                    self.opts.get('renderer', 'yaml'),
                    self.opts.get('pillar_merge_lists', False))
            else:
                matches = self.top_matches(top)
                pillar, errors = self.render_pillar(matches)
                pillar, errors = self.ext_pillar(pillar, errors=errors)
        else:
            matches = self.top_matches(top)
            pillar, errors = self.render_pillar(matches)
        errors.extend(top_errors)
        if self.opts.get('pillar_opts', False):
            mopts = dict(self.opts)
            if 'grains' in mopts:
                mopts.pop('grains')
            mopts['saltversion'] = __version__
            pillar['master'] = mopts
        if 'pillar' in self.opts and self.opts.get('ssh_merge_pillar', False):
            pillar = merge(
                self.opts['pillar'],
                pillar,
                self.merge_strategy,
                self.opts.get('renderer', 'yaml'),
                self.opts.get('pillar_merge_lists', False))
        if errors:
            for error in errors:
                log.critical('Pillar render error: %s', error)
            pillar['_errors'] = errors

        if self.pillar_override:
            pillar = merge(
                pillar,
                self.pillar_override,
                self.merge_strategy,
                self.opts.get('renderer', 'yaml'),
                self.opts.get('pillar_merge_lists', False))

        decrypt_errors = self.decrypt_pillar(pillar)
        if decrypt_errors:
            pillar.setdefault('_errors', []).extend(decrypt_errors)

        return pillar
979362
def render(self, db, safe_mode=False, extra_context=None):
        """"""
        return self.renderer.render(
            self.context,
            db,
            safe_mode=safe_mode,
            extra_context=extra_context
        )
129204
def render_pstate(self, sls, saltenv, mods, defaults=None):
        '''
        
        '''
        if defaults is None:
            defaults = {}
        err = ''
        errors = []
        state_data = self.client.get_state(sls, saltenv)
        fn_ = state_data.get('dest', False)
        if not fn_:
            if sls in self.ignored_pillars.get(saltenv, []):
                log.debug('Skipping ignored and missing SLS \'%s\' in '
                          'environment \'%s\'', sls, saltenv)
                return None, mods, errors
            elif self.opts['pillar_roots'].get(saltenv):
                msg = ('Specified SLS \'{0}\' in environment \'{1}\' is not'
                       ' available on the salt master').format(sls, saltenv)
                log.error(msg)
                errors.append(msg)
            else:
                msg = ('Specified SLS \'{0}\' in environment \'{1}\' was not '
                       'found. '.format(sls, saltenv))
                if self.opts.get('__git_pillar', False) is True:
                    msg += (
                        'This is likely caused by a git_pillar top file '
                        'containing an environment other than the one for the '
                        'branch in which it resides. Each git_pillar '
                        'branch/tag must have its own top file.'
                    )
                else:
                    msg += (
                        'This could be because SLS \'{0}\' is in an '
                        'environment other than \'{1}\', but \'{1}\' is '
                        'included in that environment\'s Pillar top file. It '
                        'could also be due to environment \'{1}\' not being '
                        'defined in \'pillar_roots\'.'.format(sls, saltenv)
                    )
                log.debug(msg)
                # return state, mods, errors
                return None, mods, errors
        state = None
        try:
            state = compile_template(fn_,
                                     self.rend,
                                     self.opts['renderer'],
                                     self.opts['renderer_blacklist'],
                                     self.opts['renderer_whitelist'],
                                     saltenv,
                                     sls,
                                     _pillar_rend=True,
                                     **defaults)
        except Exception as exc:
            msg = 'Rendering SLS \'{0}\' failed, render error:\n{1}'.format(
                sls, exc
            )
            log.critical(msg, exc_info=True)
            if self.opts.get('pillar_safe_render_error', True):
                errors.append(
                    'Rendering SLS \'{0}\' failed. Please see master log for '
                    'details.'.format(sls)
                )
            else:
                errors.append(msg)
        mods.add(sls)
        nstate = None
        if state:
            if not isinstance(state, dict):
                msg = 'SLS \'{0}\' does not render to a dictionary'.format(sls)
                log.error(msg)
                errors.append(msg)
            else:
                if 'include' in state:
                    if not isinstance(state['include'], list):
                        msg = ('Include Declaration in SLS \'{0}\' is not '
                               'formed as a list'.format(sls))
                        log.error(msg)
                        errors.append(msg)
                    else:
                        # render included state(s)
                        include_states = []

                        matched_pstates = []
                        for sub_sls in state.pop('include'):
                            if isinstance(sub_sls, dict):
                                sub_sls, v = next(six.iteritems(sub_sls))
                                defaults = v.get('defaults', {})
                                key = v.get('key', None)
                            else:
                                key = None

                            try:
                                if sub_sls.startswith('.'):
                                    if state_data.get('source', '').endswith('/init.sls'):
                                        include_parts = sls.split('.')
                                    else:
                                        include_parts = sls.split('.')[:-1]
                                    sub_sls = '.'.join(include_parts+[sub_sls[1:]])
                                matches = fnmatch.filter(
                                    self.avail[saltenv],
                                    sub_sls,
                                )
                                matched_pstates.extend(matches)
                            except KeyError:
                                errors.extend(
                                    ['No matching pillar environment for environment '
                                     '\'{0}\' found'.format(saltenv)]
                                )

                        for sub_sls in matched_pstates:
                            if sub_sls not in mods:
                                nstate, mods, err = self.render_pstate(
                                        sub_sls,
                                        saltenv,
                                        mods,
                                        defaults
                                        )
                                if nstate:
                                    if key:
                                        # If key is x:y, convert it to {x: {y: nstate}}
                                        for key_fragment in reversed(key.split(":")):
                                            nstate = {
                                                key_fragment: nstate
                                            }
                                    if not self.opts.get('pillar_includes_override_sls', False):
                                        include_states.append(nstate)
                                    else:
                                        state = merge(
                                            state,
                                            nstate,
                                            self.merge_strategy,
                                            self.opts.get('renderer', 'yaml'),
                                            self.opts.get('pillar_merge_lists', False))
                                if err:
                                    errors += err

                        if not self.opts.get('pillar_includes_override_sls', False):
                            # merge included state(s) with the current state
                            # merged last to ensure that its values are
                            # authoritative.
                            include_states.append(state)
                            state = None
                            for s in include_states:
                                if state is None:
                                    state = s
                                else:
                                    state = merge(
                                        state,
                                        s,
                                        self.merge_strategy,
                                        self.opts.get('renderer', 'yaml'),
                                        self.opts.get('pillar_merge_lists', False))
        return state, mods, errors
1369008
def render(self, data, mimetype):
        

        indent = self.__get_indent(mimetype)
        encoding = mimetype.params.get('charset') or 'utf-8'
        return json.dumps(data, indent=indent).encode(encoding)
900450
def render(json_data, saltenv='base', sls='', **kws):
    '''
    
    '''
    if not isinstance(json_data, six.string_types):
        json_data = json_data.read()

    if json_data.startswith('#!'):
        json_data = json_data[(json_data.find('\n') + 1):]
    if not json_data.strip():
        return {}
    return json.loads(json_data)
584050
def render_template(self):
        """"""
        self.import_mappings()
        self.create_template()
        if self.description:
            self.set_template_description(self.description)
        self.setup_parameters()
        rendered = self.template.to_json(indent=self.context.template_indent)
        version = hashlib.md5(rendered.encode()).hexdigest()[:8]
        return (version, rendered)
188861
function render(drizzleData) {
  return Promise.all([
    renderPages(drizzleData),
    renderCollections(drizzleData)
  ]).then(
    allData => {
      return {
        data: drizzleData.data,
        pages: allData[0],
        patterns: allData[1],
        templates: drizzleData.templates,
        options: drizzleData.options,
        tree: drizzleData.tree
      };
    },
    error => DrizzleError.error(error, drizzleData.options.debug)
  );
}
389043
private function renderData()
    {
        echo '<li>Data<ul>';

        foreach ($this->controller->data as $name => $data) {
            // Remove previous overrides
            $override = false;

            // Search the data log array for this name
            $key = array_search($name, array_column($this->controllerDataLog, 'name'));

            // If the name exists in the data log array then get the class
            if ($key !== false) {
                $override = $this->controllerDataLog[$key]['class'];
            }

            // Update data log array with this items name and class
            $this->controllerDataLog[] = [
                'name' => $name,
                'class' => $this->controller->class
            ];

            // Get data type
            $dataType = (isset($data->method) ? gettype($data->returned) : gettype($data));

            // Echo
            echo "<li>{$name}";

            // Override
            if ($override) {
                echo "<small>overrides {$override}</small>";
            }

            // Data type
            echo "<small>{$dataType}</small>";

            // Method lines
            if (isset($data->method)) {
                echo "<small>line {$data->method->getStartLine()}&mdash;{$data->method->getEndLine()}</small>";
            }

            echo '</li>';
        }

        echo '</ul></li>';
    }
123909
def _render_attributes(self, resource):
        """"""
        attributes = {}
        attrs_to_ignore = set()

        for key, relationship in resource.__mapper__.relationships.items():
            attrs_to_ignore.update(set(
                [column.name for column in relationship.local_columns]).union(
                    {key}))

        if self.dasherize:
            mapped_fields = {x: dasherize(underscore(x)) for x in self.fields}
        else:
            mapped_fields = {x: x for x in self.fields}

        for attribute in self.fields:
            if attribute == self.primary_key:
                continue
            # Per json-api spec, we cannot render foreign keys
            # or relationsips in attributes.
            if attribute in attrs_to_ignore:
                raise AttributeError
            try:
                value = getattr(resource, attribute)
                if isinstance(value, datetime.datetime):
                    attributes[mapped_fields[attribute]] = value.isoformat()
                else:
                    attributes[mapped_fields[attribute]] = value
            except AttributeError:
                raise

        return attributes
249205
def render_to_response(self, context, **response_kwargs):
        
        serializer = GeoJSONSerializer()
        response = self.response_class(**response_kwargs)
        queryset = self.get_queryset()

        options = dict(properties=self.properties,
                       precision=self.precision,
                       simplify=self.simplify,
                       srid=self.srid,
                       geometry_field=self.geometry_field,
                       force2d=self.force2d,
                       bbox=self.bbox,
                       bbox_auto=self.bbox_auto,
                       use_natural_keys=self.use_natural_keys,
                       with_modelname=self.with_modelname)
        serializer.serialize(queryset, stream=response, ensure_ascii=False,
                             **options)
        return response
314630
def render(request, template_name, context=None, content_type=None, status=None, using=None, logs=None):
    
    if logs:
        obj_logger = ObjectLogger()
        if not isinstance(logs, list):
            logs = [logs, ]
        for log in logs:
            log = obj_logger.log_response(
                log,
                context,
                status=str(status),
                headers='',
                content_type=str(content_type))
            log.save()
    return django_render(
        request,
        template_name,
        context=context,
        content_type=content_type,
        status=status,
        using=using)
720997
def _ext_pillar(minion_id,
                root_dir,
                follow_dir_links,
                debug,
                keep_newline,
                render_default,
                renderer_blacklist,
                renderer_whitelist,
                template):
    '''
    
    '''
    log.debug('file_tree: reading %s', root_dir)

    if not os.path.isdir(root_dir):
        log.error(
            'file_tree: root_dir %s does not exist or is not a directory',
            root_dir
        )
        return {}

    if not isinstance(keep_newline, (bool, list)):
        log.error(
            'file_tree: keep_newline must be either True/False or a list '
            'of file globs. Skipping this ext_pillar for root_dir %s',
            root_dir
        )
        return {}

    ngroup_pillar = {}
    nodegroups_dir = os.path.join(root_dir, 'nodegroups')
    if os.path.exists(nodegroups_dir) and __opts__.get('nodegroups'):
        master_ngroups = __opts__['nodegroups']
        ext_pillar_dirs = os.listdir(nodegroups_dir)
        if ext_pillar_dirs:
            for nodegroup in ext_pillar_dirs:
                if (os.path.isdir(nodegroups_dir) and
                        nodegroup in master_ngroups):
                    ckminions = salt.utils.minions.CkMinions(__opts__)
                    _res = ckminions.check_minions(
                        master_ngroups[nodegroup],
                        'compound')
                    match = _res['minions']
                    if minion_id in match:
                        ngroup_dir = os.path.join(
                            nodegroups_dir, six.text_type(nodegroup))
                        ngroup_pillar = salt.utils.dictupdate.merge(ngroup_pillar,
                            _construct_pillar(ngroup_dir,
                                              follow_dir_links,
                                              keep_newline,
                                              render_default,
                                              renderer_blacklist,
                                              renderer_whitelist,
                                              template),
                            strategy='recurse'
                        )
        else:
            if debug is True:
                log.debug(
                    'file_tree: no nodegroups found in file tree directory %s, skipping...',
                    ext_pillar_dirs
                )
    else:
        if debug is True:
            log.debug('file_tree: no nodegroups found in master configuration')

    host_dir = os.path.join(root_dir, 'hosts', minion_id)
    if not os.path.exists(host_dir):
        if debug is True:
            log.debug(
                'file_tree: no pillar data for minion %s found in file tree directory %s',
                minion_id,
                host_dir
            )
        return ngroup_pillar

    if not os.path.isdir(host_dir):
        log.error('file_tree: %s exists, but is not a directory', host_dir)
        return ngroup_pillar

    host_pillar = _construct_pillar(host_dir,
                                    follow_dir_links,
                                    keep_newline,
                                    render_default,
                                    renderer_blacklist,
                                    renderer_whitelist,
                                    template)
    return salt.utils.dictupdate.merge(ngroup_pillar,
                                       host_pillar,
                                       strategy='recurse')
1055687
def render(self, get_params, module, _if=None):
        
        enough = False
        output = []
        valid = None

        if self.commands.show:
            valid = True
        if self.parent and self.commands.soft and _if is None:
            return None, self
        if _if:
            valid = True
        elif self.commands._if:
            valid = self.check_valid(get_params)
        if valid is not False:
            for item in self.content:
                if isinstance(item, Placeholder):
                    sub_valid, sub_output, enough = item.get(get_params, self)
                    output.append(sub_output)
                elif isinstance(item, Literal):
                    sub_valid = None
                    enough = True
                    output.append(item.text)
                elif isinstance(item, Block):
                    sub_valid, sub_output = item.render(get_params, module)
                    if sub_valid is None:
                        output.append(sub_output)
                    else:
                        output.extend(sub_output)
                valid = valid or sub_valid
        if not valid:
            if self.next_block:
                valid, output = self.next_block.render(
                    get_params, module, _if=self.commands._if
                )
            elif self.parent is None and (
                (not self.next_block and enough) or self.base_block
            ):
                valid = True
            else:
                output = []

        # clean
        color = self.commands.color
        if color and color[0] != "#":
            color_name = "color_%s" % color
            threshold_color_name = "color_threshold_%s" % color
            # substitute color
            color = (
                getattr(module, color_name, None)
                or getattr(module, threshold_color_name, None)
                or getattr(module.py3, color_name.upper(), None)
            )
            if color == "hidden":
                return False, []

        text = u""
        out = []
        if isinstance(output, str):
            output = [output]

        # merge as much output as we can.
        # we need to convert values to unicode for concatination.
        if python2:
            conversion = unicode  # noqa
            convertables = (str, bool, int, float, unicode)  # noqa
        else:
            conversion = str
            convertables = (str, bool, int, float, bytes)

        first = True
        last_block = None
        for index, item in enumerate(output):
            is_block = isinstance(item, Block)
            if not is_block and item:
                last_block = None
            if isinstance(item, convertables) or item is None:
                text += conversion(item)
                continue
            elif text:
                if not first and (text == "" or out and out[-1].get("color") == color):
                    out[-1]["full_text"] += text
                else:
                    part = {"full_text": text}
                    if color:
                        part["color"] = color
                    out.append(part)
                text = u""
            if isinstance(item, Composite):
                if color:
                    item.composite_update(item, {"color": color}, soft=True)
                out.extend(item.get_content())
            elif is_block:
                # if this is a block then likely it is soft.
                if not out:
                    continue
                for x in range(index + 1, len(output)):
                    if output[x] and not isinstance(output[x], Block):
                        valid, _output = item.render(get_params, module, _if=True)
                        if _output and _output != last_block:
                            last_block = _output
                            out.extend(_output)
                        break
            else:
                if item:
                    out.append(item)
            first = False

        # add any left over text
        if text:
            part = {"full_text": text}
            if color:
                part["color"] = color
            out.append(part)

        # process any min/max length commands
        max_length = self.commands.max_length
        min_length = self.commands.min_length

        if max_length or min_length:
            for item in out:
                if max_length is not None:
                    item["full_text"] = item["full_text"][:max_length]
                    max_length -= len(item["full_text"])
                if min_length:
                    min_length -= len(item["full_text"])
            if min_length > 0:
                out[0]["full_text"] = u" " * min_length + out[0]["full_text"]
                min_length = 0

        return valid, out
221796
def render_to_response(self, template_name, __data,
                           content_type="text/html"):
        ''''''
        resp = self.render(template_name, __data)
        return Response(resp,
                        content_type=content_type)
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")}
3880
def get(self):
        """"""
        return self.render(
            'index.html',
            databench_version=DATABENCH_VERSION,
            meta_infos=self.meta_infos(),
            **self.info
        )
1203065
def get_render_data(self, **kwargs):
        
        kwargs['model_name'] = self.model_name
        kwargs['model_name_plural'] = self.model_name_plural
        return super(ModelCMSView, self).get_render_data(**kwargs)