當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。