本文整理汇总了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!
示例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))
示例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)
示例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))
示例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
示例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
示例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 #
##################
示例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(<txnId1>, <txnId2>) - compares two transactions with id txnId1 vs txnId2<br>
usage 2: diff(<List of txns>, <List of txns>) - compares stats for the first list of txns vs the second.<br>
"""
)))
示例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()
示例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.
示例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)
示例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)
示例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'
示例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))
示例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)