当前位置: 首页>>代码示例>>Python>>正文


Python display.HTML属性代码示例

本文整理汇总了Python中IPython.core.display.HTML属性的典型用法代码示例。如果您正苦于以下问题:Python display.HTML属性的具体用法?Python display.HTML怎么用?Python display.HTML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在IPython.core.display的用法示例。


在下文中一共展示了display.HTML属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Draw

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def Draw(obj, jsDrawMethod='draw', objIsJSON=False):
        if objIsJSON:
            dat = obj
        else:
            dat = ROOT.TBufferJSON.ConvertToJSON(obj)
            dat = str(dat).replace("\n", "")
        JsDraw.__divUID += 1
        display(HTML(JsDraw.__jsCode.substitute({
            'funcName': jsDrawMethod,
            'divid':'jstmva_'+str(JsDraw.__divUID),
            'dat': dat,
            'width': JsDraw.jsCanvasWidth,
            'height': JsDraw.jsCanvasHeight
         })))

    ## Inserts CSS file
    # @param cssName The CSS file name. File must be in jsMVACSSDir! 
开发者ID:dnanexus,项目名称:parliament2,代码行数:19,代码来源:JPyInterface.py

示例2: highlight_dep

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def highlight_dep(dep, show_pos=False):
    s = []
    s2 = []
    z = zip(dep.orig_sentence.split(), dep.sentence.split(),
            dep.pos_sentence.split())
    for i, (tok, mixed, pos) in enumerate(z):
        color = 'black'
        if i == dep.subj_index - 1 or i == dep.verb_index - 1:
            color = 'blue'
        elif (dep.subj_index - 1 < i < dep.verb_index - 1 and 
              pos in ['NN', 'NNS']): 
            color = 'red' if pos != dep.subj_pos else 'green'
        s.append('<span style="color: %s">%s</span>' % (color, tok))
        if show_pos:
            s2.append('<span style="color: %s">%s</span>' % (color, pos))
    res = ' '.join(s)
    if show_pos:
        res +=  '<br>' + ' '.join(s2)
    display(HTML(res)) 
开发者ID:TalLinzen,项目名称:rnn_agreement,代码行数:21,代码来源:plotting.py

示例3: render

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def render(self, typ="html"):
        """
        Render this Switchboard into the requested format.

        The returned string(s) are intended to be used to embedded a
        visualization of this object within a larger document.

        Parameters
        ----------
        typ : {"html"}
            The format to render as.  Currently only HTML is supported.

        Returns
        -------
        dict
            A dictionary of strings whose keys indicate which portion of
            the embeddable output the value is.  Keys will vary for different
            `typ`.  For `"html"`, keys are `"html"` and `"js"` for HTML and
            and Javascript code, respectively.
        """
        return self._render_base(typ, None, self.show) 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:23,代码来源:workspace.py

示例4: display_logon_data

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def display_logon_data(
    logon_event: pd.DataFrame, alert: SecurityAlert = None, os_family: str = None
):
    """
    Display logon data for one or more events as HTML table.

    Parameters
    ----------
    logon_event : pd.DataFrame
        Dataframe containing one or more logon events
    alert : SecurityAlert, optional
        obtain os_family from the security alert
        (the default is None)
    os_family : str, optional
         explicitly specify os_family (Linux or Windows)
         (the default is None)

    Notes
    -----
    Currently only Windows Logon events.

    """
    display(format_logon(logon_event, alert, os_family)) 
开发者ID:microsoft,项目名称:msticpy,代码行数:25,代码来源:nbdisplay.py

示例5: generate_output

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def generate_output():
    """function for testing output
    
    publishes two outputs of each type, and returns
    a rich displayable object.
    """
    
    import sys
    from IPython.core.display import display, HTML, Math
    
    print("stdout")
    print("stderr", file=sys.stderr)
    
    display(HTML("<b>HTML</b>"))
    
    print("stdout2")
    print("stderr2", file=sys.stderr)
    
    display(Math(r"\alpha=\beta"))
    
    return Math("42")

# test decorator for skipping tests when libraries are unavailable 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:25,代码来源:clienttest.py

示例6: InsertData

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def InsertData(obj, dataInserterMethod="updateTrainingTestingErrors", objIsJSON=False, divID=""):
        if objIsJSON:
            dat = obj
        else:
            dat = ROOT.TBufferJSON.ConvertToJSON(obj)
            dat = str(dat).replace("\n", "")
        if len(divID)>1:
            divid = divID
            jsCode = JsDraw.__jsCodeForDataInsertNoRemove
        else:
            divid = str(JsDraw.__divUID)
            jsCode = JsDraw.__jsCodeForDataInsert
        display(HTML(jsCode.substitute({
            'funcName': dataInserterMethod,
            'divid': 'jstmva_'+divid,
            'dat': dat
        })))

    ## Draws a signal and background histogram to a newly created TCanvas
    # @param sig signal histogram
    # @param bkg background histogram
    # @param title all labels 
开发者ID:dnanexus,项目名称:parliament2,代码行数:24,代码来源:JPyInterface.py

示例7: get_num_hits_per_matchup

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def get_num_hits_per_matchup(self):
        """
        Return the number of hits per matchup.
        """
        matchup_total_1_df = self.matchup_total_df.reset_index()
        matchup_total_2_df = matchup_total_1_df.rename(
            columns={'eval_choice_0': 'eval_choice_1', 'eval_choice_1': 'eval_choice_0'}
        )
        self.num_hits_per_matchup_df = (
            pd.concat([matchup_total_1_df, matchup_total_2_df], axis=0)
            .pivot(
                index='eval_choice_0', columns='eval_choice_1', values='matchup_total'
            )
            .reindex(index=self.models_by_win_frac, columns=self.models_by_win_frac)
        )
        return self.num_hits_per_matchup_df

    ##################
    # Rendering HTML #
    ################## 
开发者ID:facebookresearch,项目名称:ParlAI,代码行数:22,代码来源:analysis.py

示例8: diff

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def diff(lhs, rhs, profiles=None):
  """
  Compares statistics for a pair or a group of transactions

  :param lhs: Transaction ID or A list of transaction ids (lhs value of comparison)
  :param rhs: Transaction ID or A list of transaction ids (rhs value of comparison)
  :param profiles: Transactions from the current profile session
  :type profiles: xpedite.report.profile.Profiles

  """
  profiles = profiles if profiles else globalProfile()
  if isinstance(lhs, int) and isinstance(rhs, int):
    diffTxn(lhs, rhs, profiles)
  elif isinstance(lhs, list) or isinstance(rhs, list):
    diffTxns(lhs, rhs, profiles)
  else:
    display(HTML(ERROR_TEXT.format(
"""
Invalid arguments:<br>
diff expects either a pair of txns or a pair of list of txns<br>
usage 1: diff(&lt;txnId1&gt;, &lt;txnId2&gt;) - compares two transactions with id txnId1 vs txnId2<br>
usage 2: diff(&lt;List of txns&gt;, &lt;List of txns&gt;) - compares stats for the first list of txns vs the second.<br>
"""
    ))) 
开发者ID:Morgan-Stanley,项目名称:Xpedite,代码行数:26,代码来源:commands.py

示例9: show

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def show(self):
        """Display a figure (called by backtrader)."""
         # as the plot() function only created the figures and the columndatasources with no data -> now we fill it
        for idx in range(len(self.figurepages)):
            model = self.generate_model(idx)

            if self.p.output_mode in ['show', 'save']:
                if self._iplot:
                    css = self._output_stylesheet()
                    display(HTML(css))
                    show(model)
                else:
                    filename = self._output_plot_file(model, idx, self.p.filename)
                    if self.p.output_mode == 'show':
                        view(filename)
            elif self.p.output_mode == 'memory':
                pass
            else:
                raise RuntimeError(f'Invalid parameter "output_mode" with value: {self.p.output_mode}')

        self._reset() 
开发者ID:verybadsoldier,项目名称:backtrader_plotting,代码行数:23,代码来源:bokeh.py

示例10: __init__

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def __init__(self,title="Fig",xlabel='',ylabel='',height=600,width=1000):
        #set figure number, and increment for each instance
        self.figNum = figure.numFig
        figure.numFig = figure.numFig + 1

        #if title has not been changed, add figure number
        if title=="Fig":
            self.title = title+str(self.figNum)
        else:
            self.title = title

        self.fname = self.title+'.html'

        self.xlabel = xlabel
        self.ylabel = ylabel
        #for sizing plot
        self.height = height
        self.width = width

        #Set by the chart methods, can be printed out or exported to file.
        self.javascript = 'No chart created yet. Use a chart method'

    # Get the full HTML of the file. 
开发者ID:Dfenestrator,项目名称:GooPyCharts,代码行数:25,代码来源:gpcharts.py

示例11: to_html

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def to_html(self, indent=0):
        """Get information in a HTML formatted string

        Parameters
        ----------
        indent : int
            Amount of indent
            Default value 0

        Returns
        -------
        str

        """

        return self.to_string(ui=FancyHTMLStringifier(), indent=indent) 
开发者ID:DCASE-REPO,项目名称:dcase_util,代码行数:18,代码来源:callbacks.py

示例12: to_html

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def to_html(self, indent=0):
        """Get container information in a HTML formatted string

        Parameters
        ----------
        indent : int
            Amount of indent
            Default value 0

        Returns
        -------
        str

        """

        return self.to_string(ui=FancyHTMLStringifier(), indent=indent) 
开发者ID:DCASE-REPO,项目名称:dcase_util,代码行数:18,代码来源:mixins.py

示例13: sub_header

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def sub_header(self, text='', indent=0, tag='h3'):
        """Sub header

        Parameters
        ----------
        text : str, optional
            Footer text

        indent : int
            Amount of indention used for the line
            Default value 0

        tag : str
            HTML tag used for the title
            Default value "h3"

        Returns
        -------
        str

        """

        return '<' + tag + self.get_margin(indent=indent) + '>' + text + '</' + tag + '>' + '\n' 
开发者ID:DCASE-REPO,项目名称:dcase_util,代码行数:25,代码来源:ui.py

示例14: display_ipynb

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def display_ipynb(content):
    """Render HTML content to an IPython notebook cell display"""
    from IPython.core.display import display, HTML
    display(HTML(content)) 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:6,代码来源:workspace.py

示例15: display

# 需要导入模块: from IPython.core import display [as 别名]
# 或者: from IPython.core.display import HTML [as 别名]
def display(self):
        """
        Display this switchboard within an iPython notebook.

        Calling this function requires that you are in an
        iPython environment, and really only makes sense
        within a notebook.

        Returns
        -------
        None
        """
        if not in_ipython_notebook():
            raise ValueError('Only run `display` from inside an IPython Notebook.')

        #if self.widget is None:
        #    self.widget = _widgets.HTMLMath(value="?",
        #                                placeholder='Switch HTML',
        #                                description='Switch HTML',
        #                                disabled=False)
        out = self.render("html")
        content = "<script>\n" + \
                  "require(['jquery','jquery-UI'],function($,ui) {" + \
                  out['js'] + " });</script>" + out['html']
        #self.widget.value = content
        display_ipynb(content)  # self.widget) 
开发者ID:pyGSTio,项目名称:pyGSTi,代码行数:28,代码来源:workspace.py


注:本文中的IPython.core.display.HTML属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。