Shows html explanation in ipython notebook.

        See as_html() for parameters.
        This will throw an error if you don't have IPython installed
481030
def show_in_notebook(self,
                         labels=None,
                         predict_proba=True,
                         show_predicted_value=True,
                         **kwargs):
        """"""

        from IPython.core.display import display, HTML
        display(HTML(self.as_html(labels=labels,
                                  predict_proba=predict_proba,
                                  show_predicted_value=show_predicted_value,
                                  **kwargs)))
226122
def initialize_notebook():
    """"""
    try:
        from IPython.core.display import display, HTML
    except ImportError:
        print("IPython Notebook could not be loaded.")

    lib_js = ENV.get_template('ipynb_init_js.html')
    lib_css = ENV.get_template('ipynb_init_css.html')

    display(HTML(lib_js.render()))
    display(HTML(lib_css.render()))
531360
def get_view_description(view_cls, html=False):
    
    description = view_cls.__doc__ or ''
    description = formatting.dedent(smart_text(description))
    if html:
        return formatting.markup_description(description)
    return description
1110606
def _page_html(page):
    
    out = []
    out.append(_html_title(page))
    out.append(_html_image(page))
    out.append(page.data.get('extract'))
    return "\n".join([x for x in out if x])
638691
def html(self):
        """"""
        output = self.html_preamble
        output += self._repr_html_()
        output += self.html_post
        return output
1002824
def html(self, data='', py=True):
        

        if py:
            value = self.to_html(data)
        else:
            value = data
        if self.static:
            return str('<span class="value">%s</span>' % safe_str(value))
        else:
            if self.hidden:
                build = Hidden
            else:
                build = self.build
            self._get_http_attrs()
            return str(build(name=self.name, value=value, id=self.id, **self.html_attrs))
923298
def render_as_html(self, full=False):
        """"""
        from jinja2.debugrenderer import render_traceback
        return u'%s\n\n<!--\n%s\n-->' % (
            render_traceback(self, full=full),
            self.render_as_text().decode('utf-8', 'replace')
        )
93122
def render_html(self, request, instance, context):
        
        render_template = self.get_render_template(request, instance, email_format='html')
        if not render_template:
            return str(u"{No HTML rendering defined for class '%s'}" % self.__class__.__name__)

        instance_context = self.get_context(request, instance, email_format='html', parent_context=context)
        instance_context['email_format'] = 'html'

        html = self.render_to_string(request, render_template, instance_context)
        if self.render_replace_context_fields:
            html = replace_fields(html, instance_context)  # pass safe-string
        return html
1107349
def _object_type_html(self):
        

        if self.exists:
            return "<a href=\"%s\">%s</a>" % (self.url(), 
                                              self.content_type.name,)
        else:
            return "<s>%s</s>" % self.content_type.name
1149007
def html_content(self):
        
        context = self.acquire_context()
        try:
            return render_placeholder(self.content_placeholder, context)
        except (AttributeError, KeyError):
            # Should happen when ``context`` and ``request``
            # have not been found in the stack.
            pass
        return self.content
116507
def render_html(html_str):
    
    import utool as ut
    from os.path import abspath
    import webbrowser

    try:
        html_str = html_str.decode('utf8')
    except Exception:
        pass

    html_dpath = ut.ensure_app_resource_dir('utool', 'temp_html')
    fpath = abspath(ut.unixjoin(html_dpath, 'temp.html'))
    url = 'file://' + fpath
    ut.writeto(fpath, html_str)
    webbrowser.open(url)
907618
def to_html(self, show_mean=None, sortable=None, colorize=True, *args,
                **kwargs):
        """"""
        if show_mean is None:
            show_mean = self.show_mean
        if sortable is None:
            sortable = self.sortable
        df = self.copy()
        if show_mean:
            df.insert(0, 'Mean', None)
            df.loc[:, 'Mean'] = ['%.3f' % self[m].mean() for m in self.models]
        html = df.to_html(*args, **kwargs)  # Pandas method
        html, table_id = self.annotate(df, html, show_mean, colorize)
        if sortable:
            self.dynamify(table_id)
        return html
490404
def html(self, data=None, template=None):
        
        if data is None:
            data = {}
        if template:
            return render(self.request, template, data)
        return HttpResponse(data)
1268822
def _ipython_display_(self):
        """"""
        contents = self.describe()
        display({  # noqa: F821
            'application/json': contents,
            'text/plain': pretty_describe(contents)
        }, metadata={
            'application/json': {'root': contents["name"]}
        }, raw=True)
11403
def to_html_(self) -> str:
        
        try:
            renderer = pytablewriter.HtmlTableWriter
            data = self._build_export(renderer)
            return data
        except Exception as e:
            self.err(e, "Can not convert data to html")
1074943
def display(self):
        ''''''
        try:
            from IPython.display import HTML
            import uuid
        except ImportError:
            raise IPythonDisplayImportError

        sequence_json = self.json()

        d3cdn = '//d3js.org/d3.v3.min.js'
        div_id = 'sequence_{}'.format(uuid.uuid1())

        cur_dir = os.path.abspath(os.path.dirname(__file__))
        d3_plasmid_path = os.path.join(cur_dir, 'd3-plasmid.js')
        with open(d3_plasmid_path) as f:
            d3_plasmid_js = f.read()

        html = '<div id={div_id}></div>'.format(div_id=div_id)
        js_databind = '''
        <script>
        require([\'{d3_cdn}\'], function(lib) {{
            window.data = {data};'''.format(div_id=div_id, d3_cdn=d3cdn,
                                            data=sequence_json)

        js_viz = '''
            d3sequence(window.data, \'{div_id}\')
        }});
        </script>
        '''.format(div_id=div_id)

        return HTML(html + js_databind + d3_plasmid_js + js_viz)
1280557
def html(dom: str):
    
    r = _get_report()
    r.append_body(render.html(dom))
    r.stdout_interceptor.write_source('[ADDED] HTML\n')