partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | ElementPlot._plot_properties | Returns a dictionary of plot properties. | holoviews/plotting/bokeh/element.py | def _plot_properties(self, key, element):
"""
Returns a dictionary of plot properties.
"""
init = 'plot' not in self.handles
size_multiplier = self.renderer.size/100.
options = self._traverse_options(element, 'plot', ['width', 'height'], defaults=False)
logger = ... | def _plot_properties(self, key, element):
"""
Returns a dictionary of plot properties.
"""
init = 'plot' not in self.handles
size_multiplier = self.renderer.size/100.
options = self._traverse_options(element, 'plot', ['width', 'height'], defaults=False)
logger = ... | [
"Returns",
"a",
"dictionary",
"of",
"plot",
"properties",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L470-L513 | [
"def",
"_plot_properties",
"(",
"self",
",",
"key",
",",
"element",
")",
":",
"init",
"=",
"'plot'",
"not",
"in",
"self",
".",
"handles",
"size_multiplier",
"=",
"self",
".",
"renderer",
".",
"size",
"/",
"100.",
"options",
"=",
"self",
".",
"_traverse_o... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._set_active_tools | Activates the list of active tools | holoviews/plotting/bokeh/element.py | def _set_active_tools(self, plot):
"Activates the list of active tools"
for tool in self.active_tools:
if isinstance(tool, util.basestring):
tool_type = TOOL_TYPES[tool]
matching = [t for t in plot.toolbar.tools
if isinstance(t, too... | def _set_active_tools(self, plot):
"Activates the list of active tools"
for tool in self.active_tools:
if isinstance(tool, util.basestring):
tool_type = TOOL_TYPES[tool]
matching = [t for t in plot.toolbar.tools
if isinstance(t, too... | [
"Activates",
"the",
"list",
"of",
"active",
"tools"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L519-L539 | [
"def",
"_set_active_tools",
"(",
"self",
",",
"plot",
")",
":",
"for",
"tool",
"in",
"self",
".",
"active_tools",
":",
"if",
"isinstance",
"(",
"tool",
",",
"util",
".",
"basestring",
")",
":",
"tool_type",
"=",
"TOOL_TYPES",
"[",
"tool",
"]",
"matching"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._axis_properties | Returns a dictionary of axis properties depending
on the specified axis. | holoviews/plotting/bokeh/element.py | def _axis_properties(self, axis, key, plot, dimension=None,
ax_mapping={'x': 0, 'y': 1}):
"""
Returns a dictionary of axis properties depending
on the specified axis.
"""
# need to copy dictionary by calling dict() on it
axis_props = dict(theme_at... | def _axis_properties(self, axis, key, plot, dimension=None,
ax_mapping={'x': 0, 'y': 1}):
"""
Returns a dictionary of axis properties depending
on the specified axis.
"""
# need to copy dictionary by calling dict() on it
axis_props = dict(theme_at... | [
"Returns",
"a",
"dictionary",
"of",
"axis",
"properties",
"depending",
"on",
"the",
"specified",
"axis",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L576-L677 | [
"def",
"_axis_properties",
"(",
"self",
",",
"axis",
",",
"key",
",",
"plot",
",",
"dimension",
"=",
"None",
",",
"ax_mapping",
"=",
"{",
"'x'",
":",
"0",
",",
"'y'",
":",
"1",
"}",
")",
":",
"# need to copy dictionary by calling dict() on it",
"axis_props",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._update_plot | Updates plot parameters on every frame | holoviews/plotting/bokeh/element.py | def _update_plot(self, key, plot, element=None):
"""
Updates plot parameters on every frame
"""
plot.update(**self._plot_properties(key, element))
self._update_labels(key, plot, element)
self._update_title(key, plot, element)
self._update_grid(plot) | def _update_plot(self, key, plot, element=None):
"""
Updates plot parameters on every frame
"""
plot.update(**self._plot_properties(key, element))
self._update_labels(key, plot, element)
self._update_title(key, plot, element)
self._update_grid(plot) | [
"Updates",
"plot",
"parameters",
"on",
"every",
"frame"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L680-L687 | [
"def",
"_update_plot",
"(",
"self",
",",
"key",
",",
"plot",
",",
"element",
"=",
"None",
")",
":",
"plot",
".",
"update",
"(",
"*",
"*",
"self",
".",
"_plot_properties",
"(",
"key",
",",
"element",
")",
")",
"self",
".",
"_update_labels",
"(",
"key"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._categorize_data | Transforms non-string or integer types in datasource if the
axis to be plotted on is categorical. Accepts the column data
source data, the columns corresponding to the axes and the
dimensions for each axis, changing the data inplace. | holoviews/plotting/bokeh/element.py | def _categorize_data(self, data, cols, dims):
"""
Transforms non-string or integer types in datasource if the
axis to be plotted on is categorical. Accepts the column data
source data, the columns corresponding to the axes and the
dimensions for each axis, changing the data inpla... | def _categorize_data(self, data, cols, dims):
"""
Transforms non-string or integer types in datasource if the
axis to be plotted on is categorical. Accepts the column data
source data, the columns corresponding to the axes and the
dimensions for each axis, changing the data inpla... | [
"Transforms",
"non",
"-",
"string",
"or",
"integer",
"types",
"in",
"datasource",
"if",
"the",
"axis",
"to",
"be",
"plotted",
"on",
"is",
"categorical",
".",
"Accepts",
"the",
"column",
"data",
"source",
"data",
"the",
"columns",
"corresponding",
"to",
"the"... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L879-L894 | [
"def",
"_categorize_data",
"(",
"self",
",",
"data",
",",
"cols",
",",
"dims",
")",
":",
"if",
"self",
".",
"invert_axes",
":",
"cols",
"=",
"cols",
"[",
":",
":",
"-",
"1",
"]",
"dims",
"=",
"dims",
"[",
":",
"2",
"]",
"[",
":",
":",
"-",
"1... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.get_aspect | Computes the aspect ratio of the plot | holoviews/plotting/bokeh/element.py | def get_aspect(self, xspan, yspan):
"""
Computes the aspect ratio of the plot
"""
if self.data_aspect:
return (yspan/xspan)*self.data_aspect
elif self.aspect == 'equal':
return xspan/yspan
elif self.aspect == 'square':
return 1
... | def get_aspect(self, xspan, yspan):
"""
Computes the aspect ratio of the plot
"""
if self.data_aspect:
return (yspan/xspan)*self.data_aspect
elif self.aspect == 'equal':
return xspan/yspan
elif self.aspect == 'square':
return 1
... | [
"Computes",
"the",
"aspect",
"ratio",
"of",
"the",
"plot"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L897-L912 | [
"def",
"get_aspect",
"(",
"self",
",",
"xspan",
",",
"yspan",
")",
":",
"if",
"self",
".",
"data_aspect",
":",
"return",
"(",
"yspan",
"/",
"xspan",
")",
"*",
"self",
".",
"data_aspect",
"elif",
"self",
".",
"aspect",
"==",
"'equal'",
":",
"return",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._get_factors | Get factors for categorical axes. | holoviews/plotting/bokeh/element.py | def _get_factors(self, element):
"""
Get factors for categorical axes.
"""
xdim, ydim = element.dimensions()[:2]
xvals, yvals = [element.dimension_values(i, False)
for i in range(2)]
coords = tuple([v if vals.dtype.kind in 'SU' else dim.pprint_valu... | def _get_factors(self, element):
"""
Get factors for categorical axes.
"""
xdim, ydim = element.dimensions()[:2]
xvals, yvals = [element.dimension_values(i, False)
for i in range(2)]
coords = tuple([v if vals.dtype.kind in 'SU' else dim.pprint_valu... | [
"Get",
"factors",
"for",
"categorical",
"axes",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L915-L925 | [
"def",
"_get_factors",
"(",
"self",
",",
"element",
")",
":",
"xdim",
",",
"ydim",
"=",
"element",
".",
"dimensions",
"(",
")",
"[",
":",
"2",
"]",
"xvals",
",",
"yvals",
"=",
"[",
"element",
".",
"dimension_values",
"(",
"i",
",",
"False",
")",
"f... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._process_legend | Disables legends if show_legend is disabled. | holoviews/plotting/bokeh/element.py | def _process_legend(self):
"""
Disables legends if show_legend is disabled.
"""
for l in self.handles['plot'].legend:
l.items[:] = []
l.border_line_alpha = 0
l.background_fill_alpha = 0 | def _process_legend(self):
"""
Disables legends if show_legend is disabled.
"""
for l in self.handles['plot'].legend:
l.items[:] = []
l.border_line_alpha = 0
l.background_fill_alpha = 0 | [
"Disables",
"legends",
"if",
"show_legend",
"is",
"disabled",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L928-L935 | [
"def",
"_process_legend",
"(",
"self",
")",
":",
"for",
"l",
"in",
"self",
".",
"handles",
"[",
"'plot'",
"]",
".",
"legend",
":",
"l",
".",
"items",
"[",
":",
"]",
"=",
"[",
"]",
"l",
".",
"border_line_alpha",
"=",
"0",
"l",
".",
"background_fill_... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._init_glyph | Returns a Bokeh glyph object. | holoviews/plotting/bokeh/element.py | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
plot_method = self._plot_methods.get('batched' if self.batched else 'single')
if isinstance(plot_method, tuple):
# Handle alternative ... | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
plot_method = self._plot_methods.get('batched' if self.batched else 'single')
if isinstance(plot_method, tuple):
# Handle alternative ... | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L938-L948 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
")",
":",
"properties",
"=",
"mpl_to_bokeh",
"(",
"properties",
")",
"plot_method",
"=",
"self",
".",
"_plot_methods",
".",
"get",
"(",
"'batched'",
"if",
"self",
".",
"batc... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot._postprocess_hover | Attaches renderer to hover tool and processes tooltips to
ensure datetime data is displayed correctly. | holoviews/plotting/bokeh/element.py | def _postprocess_hover(self, renderer, source):
"""
Attaches renderer to hover tool and processes tooltips to
ensure datetime data is displayed correctly.
"""
hover = self.handles.get('hover')
if hover is None:
return
if hover.renderers == 'auto':
... | def _postprocess_hover(self, renderer, source):
"""
Attaches renderer to hover tool and processes tooltips to
ensure datetime data is displayed correctly.
"""
hover = self.handles.get('hover')
if hover is None:
return
if hover.renderers == 'auto':
... | [
"Attaches",
"renderer",
"to",
"hover",
"tool",
"and",
"processes",
"tooltips",
"to",
"ensure",
"datetime",
"data",
"is",
"displayed",
"correctly",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1169-L1189 | [
"def",
"_postprocess_hover",
"(",
"self",
",",
"renderer",
",",
"source",
")",
":",
"hover",
"=",
"self",
".",
"handles",
".",
"get",
"(",
"'hover'",
")",
"if",
"hover",
"is",
"None",
":",
"return",
"if",
"hover",
".",
"renderers",
"==",
"'auto'",
":",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.initialize_plot | Initializes a new plot object with the last available frame. | holoviews/plotting/bokeh/element.py | def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
if self.batched:
element = [el for el in self.hmap.data.values() if el][-1]
... | def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
if self.batched:
element = [el for el in self.hmap.data.values() if el][-1]
... | [
"Initializes",
"a",
"new",
"plot",
"object",
"with",
"the",
"last",
"available",
"frame",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1227-L1269 | [
"def",
"initialize_plot",
"(",
"self",
",",
"ranges",
"=",
"None",
",",
"plot",
"=",
"None",
",",
"plots",
"=",
"None",
",",
"source",
"=",
"None",
")",
":",
"# Get element key and ranges for frame",
"if",
"self",
".",
"batched",
":",
"element",
"=",
"[",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.update_frame | Updates an existing plot with data corresponding
to the key. | holoviews/plotting/bokeh/element.py | def update_frame(self, key, ranges=None, plot=None, element=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
reused = isinstance(self.hmap, DynamicMap) and (self.overlaid or self.batched)
if not reused and element is None:
element = ... | def update_frame(self, key, ranges=None, plot=None, element=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
reused = isinstance(self.hmap, DynamicMap) and (self.overlaid or self.batched)
if not reused and element is None:
element = ... | [
"Updates",
"an",
"existing",
"plot",
"with",
"data",
"corresponding",
"to",
"the",
"key",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1303-L1350 | [
"def",
"update_frame",
"(",
"self",
",",
"key",
",",
"ranges",
"=",
"None",
",",
"plot",
"=",
"None",
",",
"element",
"=",
"None",
")",
":",
"reused",
"=",
"isinstance",
"(",
"self",
".",
"hmap",
",",
"DynamicMap",
")",
"and",
"(",
"self",
".",
"ov... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.model_changed | Determines if the bokeh model was just changed on the frontend.
Useful to suppress boomeranging events, e.g. when the frontend
just sent an update to the x_range this should not trigger an
update on the backend. | holoviews/plotting/bokeh/element.py | def model_changed(self, model):
"""
Determines if the bokeh model was just changed on the frontend.
Useful to suppress boomeranging events, e.g. when the frontend
just sent an update to the x_range this should not trigger an
update on the backend.
"""
callbacks = ... | def model_changed(self, model):
"""
Determines if the bokeh model was just changed on the frontend.
Useful to suppress boomeranging events, e.g. when the frontend
just sent an update to the x_range this should not trigger an
update on the backend.
"""
callbacks = ... | [
"Determines",
"if",
"the",
"bokeh",
"model",
"was",
"just",
"changed",
"on",
"the",
"frontend",
".",
"Useful",
"to",
"suppress",
"boomeranging",
"events",
"e",
".",
"g",
".",
"when",
"the",
"frontend",
"just",
"sent",
"an",
"update",
"to",
"the",
"x_range"... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1353-L1365 | [
"def",
"model_changed",
"(",
"self",
",",
"model",
")",
":",
"callbacks",
"=",
"[",
"cb",
"for",
"cbs",
"in",
"self",
".",
"traverse",
"(",
"lambda",
"x",
":",
"x",
".",
"callbacks",
")",
"for",
"cb",
"in",
"cbs",
"]",
"stream_metadata",
"=",
"[",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ElementPlot.framewise | Property to determine whether the current frame should have
framewise normalization enabled. Required for bokeh plotting
classes to determine whether to send updated ranges for each
frame. | holoviews/plotting/bokeh/element.py | def framewise(self):
"""
Property to determine whether the current frame should have
framewise normalization enabled. Required for bokeh plotting
classes to determine whether to send updated ranges for each
frame.
"""
current_frames = [el for f in self.traverse(la... | def framewise(self):
"""
Property to determine whether the current frame should have
framewise normalization enabled. Required for bokeh plotting
classes to determine whether to send updated ranges for each
frame.
"""
current_frames = [el for f in self.traverse(la... | [
"Property",
"to",
"determine",
"whether",
"the",
"current",
"frame",
"should",
"have",
"framewise",
"normalization",
"enabled",
".",
"Required",
"for",
"bokeh",
"plotting",
"classes",
"to",
"determine",
"whether",
"to",
"send",
"updated",
"ranges",
"for",
"each",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1369-L1381 | [
"def",
"framewise",
"(",
"self",
")",
":",
"current_frames",
"=",
"[",
"el",
"for",
"f",
"in",
"self",
".",
"traverse",
"(",
"lambda",
"x",
":",
"x",
".",
"current_frame",
")",
"for",
"el",
"in",
"(",
"f",
".",
"traverse",
"(",
"lambda",
"x",
":",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | CompositeElementPlot._init_glyph | Returns a Bokeh glyph object. | holoviews/plotting/bokeh/element.py | def _init_glyph(self, plot, mapping, properties, key):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
plot_method = '_'.join(key.split('_')[:-1])
renderer = getattr(plot, plot_method)(**dict(properties, **mapping))
return renderer, ren... | def _init_glyph(self, plot, mapping, properties, key):
"""
Returns a Bokeh glyph object.
"""
properties = mpl_to_bokeh(properties)
plot_method = '_'.join(key.split('_')[:-1])
renderer = getattr(plot, plot_method)(**dict(properties, **mapping))
return renderer, ren... | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1492-L1499 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
",",
"key",
")",
":",
"properties",
"=",
"mpl_to_bokeh",
"(",
"properties",
")",
"plot_method",
"=",
"'_'",
".",
"join",
"(",
"key",
".",
"split",
"(",
"'_'",
")",
"[",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ColorbarPlot._init_glyph | Returns a Bokeh glyph object and optionally creates a colorbar. | holoviews/plotting/bokeh/element.py | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object and optionally creates a colorbar.
"""
ret = super(ColorbarPlot, self)._init_glyph(plot, mapping, properties)
if self.colorbar:
for k, v in list(self.handles.items()):
i... | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object and optionally creates a colorbar.
"""
ret = super(ColorbarPlot, self)._init_glyph(plot, mapping, properties)
if self.colorbar:
for k, v in list(self.handles.items()):
i... | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"and",
"optionally",
"creates",
"a",
"colorbar",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1759-L1769 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
")",
":",
"ret",
"=",
"super",
"(",
"ColorbarPlot",
",",
"self",
")",
".",
"_init_glyph",
"(",
"plot",
",",
"mapping",
",",
"properties",
")",
"if",
"self",
".",
"colorb... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OverlayPlot._init_tools | Processes the list of tools to be supplied to the plot. | holoviews/plotting/bokeh/element.py | def _init_tools(self, element, callbacks=[]):
"""
Processes the list of tools to be supplied to the plot.
"""
hover_tools = {}
init_tools, tool_types = [], []
for key, subplot in self.subplots.items():
el = element.get(key)
if el is not None:
... | def _init_tools(self, element, callbacks=[]):
"""
Processes the list of tools to be supplied to the plot.
"""
hover_tools = {}
init_tools, tool_types = [], []
for key, subplot in self.subplots.items():
el = element.get(key)
if el is not None:
... | [
"Processes",
"the",
"list",
"of",
"tools",
"to",
"be",
"supplied",
"to",
"the",
"plot",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1967-L1994 | [
"def",
"_init_tools",
"(",
"self",
",",
"element",
",",
"callbacks",
"=",
"[",
"]",
")",
":",
"hover_tools",
"=",
"{",
"}",
"init_tools",
",",
"tool_types",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"key",
",",
"subplot",
"in",
"self",
".",
"subplots",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OverlayPlot._merge_tools | Merges tools on the overlay with those on the subplots. | holoviews/plotting/bokeh/element.py | def _merge_tools(self, subplot):
"""
Merges tools on the overlay with those on the subplots.
"""
if self.batched and 'hover' in subplot.handles:
self.handles['hover'] = subplot.handles['hover']
elif 'hover' in subplot.handles and 'hover_tools' in self.handles:
... | def _merge_tools(self, subplot):
"""
Merges tools on the overlay with those on the subplots.
"""
if self.batched and 'hover' in subplot.handles:
self.handles['hover'] = subplot.handles['hover']
elif 'hover' in subplot.handles and 'hover_tools' in self.handles:
... | [
"Merges",
"tools",
"on",
"the",
"overlay",
"with",
"those",
"on",
"the",
"subplots",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L1997-L2019 | [
"def",
"_merge_tools",
"(",
"self",
",",
"subplot",
")",
":",
"if",
"self",
".",
"batched",
"and",
"'hover'",
"in",
"subplot",
".",
"handles",
":",
"self",
".",
"handles",
"[",
"'hover'",
"]",
"=",
"subplot",
".",
"handles",
"[",
"'hover'",
"]",
"elif"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OverlayPlot.update_frame | Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state. | holoviews/plotting/bokeh/element.py | def update_frame(self, key, ranges=None, element=None):
"""
Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state.
"""
reused = isinstance(self.hmap, DynamicMap) and self.overlaid
if not reused... | def update_frame(self, key, ranges=None, element=None):
"""
Update the internal state of the Plot to represent the given
key tuple (where integers represent frames). Returns this
state.
"""
reused = isinstance(self.hmap, DynamicMap) and self.overlaid
if not reused... | [
"Update",
"the",
"internal",
"state",
"of",
"the",
"Plot",
"to",
"represent",
"the",
"given",
"key",
"tuple",
"(",
"where",
"integers",
"represent",
"frames",
")",
".",
"Returns",
"this",
"state",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/element.py#L2106-L2180 | [
"def",
"update_frame",
"(",
"self",
",",
"key",
",",
"ranges",
"=",
"None",
",",
"element",
"=",
"None",
")",
":",
"reused",
"=",
"isinstance",
"(",
"self",
".",
"hmap",
",",
"DynamicMap",
")",
"and",
"self",
".",
"overlaid",
"if",
"not",
"reused",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | list_formats | Returns list of supported formats for a particular
backend. | holoviews/util/settings.py | def list_formats(format_type, backend=None):
"""
Returns list of supported formats for a particular
backend.
"""
if backend is None:
backend = Store.current_backend
mode = Store.renderers[backend].mode if backend in Store.renderers else None
else:
split = backend.split(':... | def list_formats(format_type, backend=None):
"""
Returns list of supported formats for a particular
backend.
"""
if backend is None:
backend = Store.current_backend
mode = Store.renderers[backend].mode if backend in Store.renderers else None
else:
split = backend.split(':... | [
"Returns",
"list",
"of",
"supported",
"formats",
"for",
"a",
"particular",
"backend",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L118-L133 | [
"def",
"list_formats",
"(",
"format_type",
",",
"backend",
"=",
"None",
")",
":",
"if",
"backend",
"is",
"None",
":",
"backend",
"=",
"Store",
".",
"current_backend",
"mode",
"=",
"Store",
".",
"renderers",
"[",
"backend",
"]",
".",
"mode",
"if",
"backen... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | KeywordSettings.get_options | Given a keyword specification, validate and compute options | holoviews/util/settings.py | def get_options(cls, items, options, warnfn):
"Given a keyword specification, validate and compute options"
options = cls.update_options(options, items)
for keyword in cls.defaults:
if keyword in items:
value = items[keyword]
allowed = cls.allowed[keyw... | def get_options(cls, items, options, warnfn):
"Given a keyword specification, validate and compute options"
options = cls.update_options(options, items)
for keyword in cls.defaults:
if keyword in items:
value = items[keyword]
allowed = cls.allowed[keyw... | [
"Given",
"a",
"keyword",
"specification",
"validate",
"and",
"compute",
"options"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L33-L67 | [
"def",
"get_options",
"(",
"cls",
",",
"items",
",",
"options",
",",
"warnfn",
")",
":",
"options",
"=",
"cls",
".",
"update_options",
"(",
"options",
",",
"items",
")",
"for",
"keyword",
"in",
"cls",
".",
"defaults",
":",
"if",
"keyword",
"in",
"items... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | KeywordSettings.extract_keywords | Given the keyword string, parse a dictionary of options. | holoviews/util/settings.py | def extract_keywords(cls, line, items):
"""
Given the keyword string, parse a dictionary of options.
"""
unprocessed = list(reversed(line.split('=')))
while unprocessed:
chunk = unprocessed.pop()
key = None
if chunk.strip() in cls.allowed:
... | def extract_keywords(cls, line, items):
"""
Given the keyword string, parse a dictionary of options.
"""
unprocessed = list(reversed(line.split('=')))
while unprocessed:
chunk = unprocessed.pop()
key = None
if chunk.strip() in cls.allowed:
... | [
"Given",
"the",
"keyword",
"string",
"parse",
"a",
"dictionary",
"of",
"options",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L76-L104 | [
"def",
"extract_keywords",
"(",
"cls",
",",
"line",
",",
"items",
")",
":",
"unprocessed",
"=",
"list",
"(",
"reversed",
"(",
"line",
".",
"split",
"(",
"'='",
")",
")",
")",
"while",
"unprocessed",
":",
"chunk",
"=",
"unprocessed",
".",
"pop",
"(",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OutputSettings._validate | Validation of edge cases and incompatible options | holoviews/util/settings.py | def _validate(cls, options, items, warnfn):
"Validation of edge cases and incompatible options"
if 'html' in Store.display_formats:
pass
elif 'fig' in items and items['fig'] not in Store.display_formats:
msg = ("Requesting output figure format %r " % items['fig']
... | def _validate(cls, options, items, warnfn):
"Validation of edge cases and incompatible options"
if 'html' in Store.display_formats:
pass
elif 'fig' in items and items['fig'] not in Store.display_formats:
msg = ("Requesting output figure format %r " % items['fig']
... | [
"Validation",
"of",
"edge",
"cases",
"and",
"incompatible",
"options"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L234-L248 | [
"def",
"_validate",
"(",
"cls",
",",
"options",
",",
"items",
",",
"warnfn",
")",
":",
"if",
"'html'",
"in",
"Store",
".",
"display_formats",
":",
"pass",
"elif",
"'fig'",
"in",
"items",
"and",
"items",
"[",
"'fig'",
"]",
"not",
"in",
"Store",
".",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OutputSettings.update_options | Switch default options and backend if new backend is supplied in
items. | holoviews/util/settings.py | def update_options(cls, options, items):
"""
Switch default options and backend if new backend is supplied in
items.
"""
# Get new backend
backend_spec = items.get('backend', Store.current_backend)
split = backend_spec.split(':')
backend, mode = split if l... | def update_options(cls, options, items):
"""
Switch default options and backend if new backend is supplied in
items.
"""
# Get new backend
backend_spec = items.get('backend', Store.current_backend)
split = backend_spec.split(':')
backend, mode = split if l... | [
"Switch",
"default",
"options",
"and",
"backend",
"if",
"new",
"backend",
"is",
"supplied",
"in",
"items",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L309-L358 | [
"def",
"update_options",
"(",
"cls",
",",
"options",
",",
"items",
")",
":",
"# Get new backend",
"backend_spec",
"=",
"items",
".",
"get",
"(",
"'backend'",
",",
"Store",
".",
"current_backend",
")",
"split",
"=",
"backend_spec",
".",
"split",
"(",
"':'",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | OutputSettings._set_render_options | Set options on current Renderer. | holoviews/util/settings.py | def _set_render_options(cls, options, backend=None):
"""
Set options on current Renderer.
"""
if backend:
backend = backend.split(':')[0]
else:
backend = Store.current_backend
cls.set_backend(backend)
if 'widgets' in options:
o... | def _set_render_options(cls, options, backend=None):
"""
Set options on current Renderer.
"""
if backend:
backend = backend.split(':')[0]
else:
backend = Store.current_backend
cls.set_backend(backend)
if 'widgets' in options:
o... | [
"Set",
"options",
"on",
"current",
"Renderer",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/util/settings.py#L380-L394 | [
"def",
"_set_render_options",
"(",
"cls",
",",
"options",
",",
"backend",
"=",
"None",
")",
":",
"if",
"backend",
":",
"backend",
"=",
"backend",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
"else",
":",
"backend",
"=",
"Store",
".",
"current_backend"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | help | Extended version of the built-in help that supports parameterized
functions and objects. A pattern (regular expression) may be used to
filter the output and if recursive is set to True, documentation for
the supplied object is shown. Note that the recursive option will
only work with an object instance ... | holoviews/__init__.py | def help(obj, visualization=True, ansi=True, backend=None,
recursive=False, pattern=None):
"""
Extended version of the built-in help that supports parameterized
functions and objects. A pattern (regular expression) may be used to
filter the output and if recursive is set to True, documentation ... | def help(obj, visualization=True, ansi=True, backend=None,
recursive=False, pattern=None):
"""
Extended version of the built-in help that supports parameterized
functions and objects. A pattern (regular expression) may be used to
filter the output and if recursive is set to True, documentation ... | [
"Extended",
"version",
"of",
"the",
"built",
"-",
"in",
"help",
"that",
"supports",
"parameterized",
"functions",
"and",
"objects",
".",
"A",
"pattern",
"(",
"regular",
"expression",
")",
"may",
"be",
"used",
"to",
"filter",
"the",
"output",
"and",
"if",
"... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/__init__.py#L66-L88 | [
"def",
"help",
"(",
"obj",
",",
"visualization",
"=",
"True",
",",
"ansi",
"=",
"True",
",",
"backend",
"=",
"None",
",",
"recursive",
"=",
"False",
",",
"pattern",
"=",
"None",
")",
":",
"backend",
"=",
"backend",
"if",
"backend",
"else",
"Store",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | LineAnnotationPlot._init_glyph | Returns a Bokeh glyph object. | holoviews/plotting/bokeh/annotation.py | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
box = Span(level=properties.get('level', 'glyph'), **mapping)
plot.renderers.append(box)
return None, box | def _init_glyph(self, plot, mapping, properties):
"""
Returns a Bokeh glyph object.
"""
box = Span(level=properties.get('level', 'glyph'), **mapping)
plot.renderers.append(box)
return None, box | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/annotation.py#L147-L153 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
")",
":",
"box",
"=",
"Span",
"(",
"level",
"=",
"properties",
".",
"get",
"(",
"'level'",
",",
"'glyph'",
")",
",",
"*",
"*",
"mapping",
")",
"plot",
".",
"renderers"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | ArrowPlot._init_glyph | Returns a Bokeh glyph object. | holoviews/plotting/bokeh/annotation.py | def _init_glyph(self, plot, mapping, properties, key):
"""
Returns a Bokeh glyph object.
"""
properties.pop('legend', None)
if key == 'arrow':
properties.pop('source')
arrow_end = mapping.pop('arrow_end')
arrow_start = mapping.pop('arrow_start'... | def _init_glyph(self, plot, mapping, properties, key):
"""
Returns a Bokeh glyph object.
"""
properties.pop('legend', None)
if key == 'arrow':
properties.pop('source')
arrow_end = mapping.pop('arrow_end')
arrow_start = mapping.pop('arrow_start'... | [
"Returns",
"a",
"Bokeh",
"glyph",
"object",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/annotation.py#L239-L258 | [
"def",
"_init_glyph",
"(",
"self",
",",
"plot",
",",
"mapping",
",",
"properties",
",",
"key",
")",
":",
"properties",
".",
"pop",
"(",
"'legend'",
",",
"None",
")",
"if",
"key",
"==",
"'arrow'",
":",
"properties",
".",
"pop",
"(",
"'source'",
")",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DivPlot.initialize_plot | Initializes a new plot object with the last available frame. | holoviews/plotting/bokeh/annotation.py | def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
element = self.hmap.last
key = self.keys[-1]
self.current_frame = element
... | def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
"""
Initializes a new plot object with the last available frame.
"""
# Get element key and ranges for frame
element = self.hmap.last
key = self.keys[-1]
self.current_frame = element
... | [
"Initializes",
"a",
"new",
"plot",
"object",
"with",
"the",
"last",
"available",
"frame",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/annotation.py#L291-L306 | [
"def",
"initialize_plot",
"(",
"self",
",",
"ranges",
"=",
"None",
",",
"plot",
"=",
"None",
",",
"plots",
"=",
"None",
",",
"source",
"=",
"None",
")",
":",
"# Get element key and ranges for frame",
"element",
"=",
"self",
".",
"hmap",
".",
"last",
"key",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DivPlot.update_frame | Updates an existing plot with data corresponding
to the key. | holoviews/plotting/bokeh/annotation.py | def update_frame(self, key, ranges=None, plot=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
element = self._get_frame(key)
text, _, _ = self.get_data(element, ranges, {})
self.handles['plot'].text = text | def update_frame(self, key, ranges=None, plot=None):
"""
Updates an existing plot with data corresponding
to the key.
"""
element = self._get_frame(key)
text, _, _ = self.get_data(element, ranges, {})
self.handles['plot'].text = text | [
"Updates",
"an",
"existing",
"plot",
"with",
"data",
"corresponding",
"to",
"the",
"key",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/annotation.py#L309-L316 | [
"def",
"update_frame",
"(",
"self",
",",
"key",
",",
"ranges",
"=",
"None",
",",
"plot",
"=",
"None",
")",
":",
"element",
"=",
"self",
".",
"_get_frame",
"(",
"key",
")",
"text",
",",
"_",
",",
"_",
"=",
"self",
".",
"get_data",
"(",
"element",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | split_dataframe | Splits a dataframe of paths separated by NaNs into individual
dataframes. | holoviews/operation/datashader.py | def split_dataframe(path_df):
"""
Splits a dataframe of paths separated by NaNs into individual
dataframes.
"""
splits = np.where(path_df.iloc[:, 0].isnull())[0]+1
return [df for df in np.split(path_df, splits) if len(df) > 1] | def split_dataframe(path_df):
"""
Splits a dataframe of paths separated by NaNs into individual
dataframes.
"""
splits = np.where(path_df.iloc[:, 0].isnull())[0]+1
return [df for df in np.split(path_df, splits) if len(df) > 1] | [
"Splits",
"a",
"dataframe",
"of",
"paths",
"separated",
"by",
"NaNs",
"into",
"individual",
"dataframes",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/operation/datashader.py#L1201-L1207 | [
"def",
"split_dataframe",
"(",
"path_df",
")",
":",
"splits",
"=",
"np",
".",
"where",
"(",
"path_df",
".",
"iloc",
"[",
":",
",",
"0",
"]",
".",
"isnull",
"(",
")",
")",
"[",
"0",
"]",
"+",
"1",
"return",
"[",
"df",
"for",
"df",
"in",
"np",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | aggregate.get_agg_data | Reduces any Overlay or NdOverlay of Elements into a single
xarray Dataset that can be aggregated. | holoviews/operation/datashader.py | def get_agg_data(cls, obj, category=None):
"""
Reduces any Overlay or NdOverlay of Elements into a single
xarray Dataset that can be aggregated.
"""
paths = []
if isinstance(obj, Graph):
obj = obj.edgepaths
kdims = list(obj.kdims)
vdims = list(... | def get_agg_data(cls, obj, category=None):
"""
Reduces any Overlay or NdOverlay of Elements into a single
xarray Dataset that can be aggregated.
"""
paths = []
if isinstance(obj, Graph):
obj = obj.edgepaths
kdims = list(obj.kdims)
vdims = list(... | [
"Reduces",
"any",
"Overlay",
"or",
"NdOverlay",
"of",
"Elements",
"into",
"a",
"single",
"xarray",
"Dataset",
"that",
"can",
"be",
"aggregated",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/operation/datashader.py#L270-L340 | [
"def",
"get_agg_data",
"(",
"cls",
",",
"obj",
",",
"category",
"=",
"None",
")",
":",
"paths",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"obj",
",",
"Graph",
")",
":",
"obj",
"=",
"obj",
".",
"edgepaths",
"kdims",
"=",
"list",
"(",
"obj",
".",
"kd... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | aggregate._aggregate_ndoverlay | Optimized aggregation for NdOverlay objects by aggregating each
Element in an NdOverlay individually avoiding having to concatenate
items in the NdOverlay. Works by summing sum and count aggregates and
applying appropriate masking for NaN values. Mean aggregation
is also supported by div... | holoviews/operation/datashader.py | def _aggregate_ndoverlay(self, element, agg_fn):
"""
Optimized aggregation for NdOverlay objects by aggregating each
Element in an NdOverlay individually avoiding having to concatenate
items in the NdOverlay. Works by summing sum and count aggregates and
applying appropriate mask... | def _aggregate_ndoverlay(self, element, agg_fn):
"""
Optimized aggregation for NdOverlay objects by aggregating each
Element in an NdOverlay individually avoiding having to concatenate
items in the NdOverlay. Works by summing sum and count aggregates and
applying appropriate mask... | [
"Optimized",
"aggregation",
"for",
"NdOverlay",
"objects",
"by",
"aggregating",
"each",
"Element",
"in",
"an",
"NdOverlay",
"individually",
"avoiding",
"having",
"to",
"concatenate",
"items",
"in",
"the",
"NdOverlay",
".",
"Works",
"by",
"summing",
"sum",
"and",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/operation/datashader.py#L343-L423 | [
"def",
"_aggregate_ndoverlay",
"(",
"self",
",",
"element",
",",
"agg_fn",
")",
":",
"# Compute overall bounds",
"x",
",",
"y",
"=",
"element",
".",
"last",
".",
"dimensions",
"(",
")",
"[",
"0",
":",
"2",
"]",
"info",
"=",
"self",
".",
"_get_sampling",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | shade.concatenate | Concatenates an NdOverlay of Image types into a single 3D
xarray Dataset. | holoviews/operation/datashader.py | def concatenate(cls, overlay):
"""
Concatenates an NdOverlay of Image types into a single 3D
xarray Dataset.
"""
if not isinstance(overlay, NdOverlay):
raise ValueError('Only NdOverlays can be concatenated')
xarr = xr.concat([v.data.transpose() for v in overla... | def concatenate(cls, overlay):
"""
Concatenates an NdOverlay of Image types into a single 3D
xarray Dataset.
"""
if not isinstance(overlay, NdOverlay):
raise ValueError('Only NdOverlays can be concatenated')
xarr = xr.concat([v.data.transpose() for v in overla... | [
"Concatenates",
"an",
"NdOverlay",
"of",
"Image",
"types",
"into",
"a",
"single",
"3D",
"xarray",
"Dataset",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/operation/datashader.py#L916-L928 | [
"def",
"concatenate",
"(",
"cls",
",",
"overlay",
")",
":",
"if",
"not",
"isinstance",
"(",
"overlay",
",",
"NdOverlay",
")",
":",
"raise",
"ValueError",
"(",
"'Only NdOverlays can be concatenated'",
")",
"xarr",
"=",
"xr",
".",
"concat",
"(",
"[",
"v",
".... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | shade.uint32_to_uint8 | Cast uint32 RGB image to 4 uint8 channels. | holoviews/operation/datashader.py | def uint32_to_uint8(cls, img):
"""
Cast uint32 RGB image to 4 uint8 channels.
"""
return np.flipud(img.view(dtype=np.uint8).reshape(img.shape + (4,))) | def uint32_to_uint8(cls, img):
"""
Cast uint32 RGB image to 4 uint8 channels.
"""
return np.flipud(img.view(dtype=np.uint8).reshape(img.shape + (4,))) | [
"Cast",
"uint32",
"RGB",
"image",
"to",
"4",
"uint8",
"channels",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/operation/datashader.py#L932-L936 | [
"def",
"uint32_to_uint8",
"(",
"cls",
",",
"img",
")",
":",
"return",
"np",
".",
"flipud",
"(",
"img",
".",
"view",
"(",
"dtype",
"=",
"np",
".",
"uint8",
")",
".",
"reshape",
"(",
"img",
".",
"shape",
"+",
"(",
"4",
",",
")",
")",
")"
] | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | embed_version | Autover is purely a build time dependency in all cases (conda and
pip) except for when you use pip's remote git support [git+url] as
1) you need a dynamically changing version and 2) the environment
starts off clean with zero dependencies installed.
This function acts as a fallback to make Version avail... | setup.py | def embed_version(basepath, ref='v0.2.2'):
"""
Autover is purely a build time dependency in all cases (conda and
pip) except for when you use pip's remote git support [git+url] as
1) you need a dynamically changing version and 2) the environment
starts off clean with zero dependencies installed.
... | def embed_version(basepath, ref='v0.2.2'):
"""
Autover is purely a build time dependency in all cases (conda and
pip) except for when you use pip's remote git support [git+url] as
1) you need a dynamically changing version and 2) the environment
starts off clean with zero dependencies installed.
... | [
"Autover",
"is",
"purely",
"a",
"build",
"time",
"dependency",
"in",
"all",
"cases",
"(",
"conda",
"and",
"pip",
")",
"except",
"for",
"when",
"you",
"use",
"pip",
"s",
"remote",
"git",
"support",
"[",
"git",
"+",
"url",
"]",
"as",
"1",
")",
"you",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L55-L77 | [
"def",
"embed_version",
"(",
"basepath",
",",
"ref",
"=",
"'v0.2.2'",
")",
":",
"import",
"io",
",",
"zipfile",
",",
"importlib",
"try",
":",
"from",
"urllib",
".",
"request",
"import",
"urlopen",
"except",
":",
"from",
"urllib",
"import",
"urlopen",
"try"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | get_setup_version | Helper to get the current version from either git describe or the
.version file (if available). | setup.py | def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
import json
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import versi... | def get_setup_version(reponame):
"""
Helper to get the current version from either git describe or the
.version file (if available).
"""
import json
basepath = os.path.split(__file__)[0]
version_file_path = os.path.join(basepath, reponame, '.version')
try:
from param import versi... | [
"Helper",
"to",
"get",
"the",
"current",
"version",
"from",
"either",
"git",
"describe",
"or",
"the",
".",
"version",
"file",
"(",
"if",
"available",
")",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L79-L98 | [
"def",
"get_setup_version",
"(",
"reponame",
")",
":",
"import",
"json",
"basepath",
"=",
"os",
".",
"path",
".",
"split",
"(",
"__file__",
")",
"[",
"0",
"]",
"version_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"basepath",
",",
"reponame",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | check_pseudo_package | Verifies that a fake subpackage path for assets (notebooks, svgs,
pngs etc) both exists and is populated with files. | setup.py | def check_pseudo_package(path):
"""
Verifies that a fake subpackage path for assets (notebooks, svgs,
pngs etc) both exists and is populated with files.
"""
if not os.path.isdir(path):
raise Exception("Please make sure pseudo-package %s exists." % path)
else:
assets = os.listdir(... | def check_pseudo_package(path):
"""
Verifies that a fake subpackage path for assets (notebooks, svgs,
pngs etc) both exists and is populated with files.
"""
if not os.path.isdir(path):
raise Exception("Please make sure pseudo-package %s exists." % path)
else:
assets = os.listdir(... | [
"Verifies",
"that",
"a",
"fake",
"subpackage",
"path",
"for",
"assets",
"(",
"notebooks",
"svgs",
"pngs",
"etc",
")",
"both",
"exists",
"and",
"is",
"populated",
"with",
"files",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L166-L176 | [
"def",
"check_pseudo_package",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"raise",
"Exception",
"(",
"\"Please make sure pseudo-package %s exists.\"",
"%",
"path",
")",
"else",
":",
"assets",
"=",
"os",
".",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | walker | Walks a directory and records all packages and file extensions. | setup.py | def walker(top, names):
"""
Walks a directory and records all packages and file extensions.
"""
global packages, extensions
if any(exc in top for exc in excludes):
return
package = top[top.rfind('holoviews'):].replace(os.path.sep, '.')
packages.append(package)
for name in names:
... | def walker(top, names):
"""
Walks a directory and records all packages and file extensions.
"""
global packages, extensions
if any(exc in top for exc in excludes):
return
package = top[top.rfind('holoviews'):].replace(os.path.sep, '.')
packages.append(package)
for name in names:
... | [
"Walks",
"a",
"directory",
"and",
"records",
"all",
"packages",
"and",
"file",
"extensions",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L183-L196 | [
"def",
"walker",
"(",
"top",
",",
"names",
")",
":",
"global",
"packages",
",",
"extensions",
"if",
"any",
"(",
"exc",
"in",
"top",
"for",
"exc",
"in",
"excludes",
")",
":",
"return",
"package",
"=",
"top",
"[",
"top",
".",
"rfind",
"(",
"'holoviews'... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | examples | Copies the notebooks to the supplied path. | setup.py | def examples(path='holoviews-examples', verbose=False, force=False, root=__file__):
"""
Copies the notebooks to the supplied path.
"""
filepath = os.path.abspath(os.path.dirname(root))
example_dir = os.path.join(filepath, './examples')
if not os.path.exists(example_dir):
example_dir = os... | def examples(path='holoviews-examples', verbose=False, force=False, root=__file__):
"""
Copies the notebooks to the supplied path.
"""
filepath = os.path.abspath(os.path.dirname(root))
example_dir = os.path.join(filepath, './examples')
if not os.path.exists(example_dir):
example_dir = os... | [
"Copies",
"the",
"notebooks",
"to",
"the",
"supplied",
"path",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L201-L219 | [
"def",
"examples",
"(",
"path",
"=",
"'holoviews-examples'",
",",
"verbose",
"=",
"False",
",",
"force",
"=",
"False",
",",
"root",
"=",
"__file__",
")",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | package_assets | Generates pseudo-packages for the examples directory. | setup.py | def package_assets(example_path):
"""
Generates pseudo-packages for the examples directory.
"""
examples(example_path, force=True, root=__file__)
for root, dirs, files in os.walk(example_path):
walker(root, dirs+files)
setup_args['packages'] += packages
for p, exts in extensions.item... | def package_assets(example_path):
"""
Generates pseudo-packages for the examples directory.
"""
examples(example_path, force=True, root=__file__)
for root, dirs, files in os.walk(example_path):
walker(root, dirs+files)
setup_args['packages'] += packages
for p, exts in extensions.item... | [
"Generates",
"pseudo",
"-",
"packages",
"for",
"the",
"examples",
"directory",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/setup.py#L223-L233 | [
"def",
"package_assets",
"(",
"example_path",
")",
":",
"examples",
"(",
"example_path",
",",
"force",
"=",
"True",
",",
"root",
"=",
"__file__",
")",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"example_path",
")",
":",
"wa... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Graph.select | Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally selection_specs (taking the form of a list
of type.group.label strings, types or functions) ... | holoviews/element/graphs.py | def select(self, selection_specs=None, selection_mode='edges', **selection):
"""
Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally sel... | def select(self, selection_specs=None, selection_mode='edges', **selection):
"""
Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally sel... | [
"Allows",
"selecting",
"data",
"by",
"the",
"slices",
"sets",
"and",
"scalar",
"values",
"along",
"a",
"particular",
"dimension",
".",
"The",
"indices",
"should",
"be",
"supplied",
"as",
"keywords",
"mapping",
"between",
"the",
"selected",
"dimension",
"and",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L254-L325 | [
"def",
"select",
"(",
"self",
",",
"selection_specs",
"=",
"None",
",",
"selection_mode",
"=",
"'edges'",
",",
"*",
"*",
"selection",
")",
":",
"selection",
"=",
"{",
"dim",
":",
"sel",
"for",
"dim",
",",
"sel",
"in",
"selection",
".",
"items",
"(",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Graph.nodes | Computes the node positions the first time they are requested
if no explicit node information was supplied. | holoviews/element/graphs.py | def nodes(self):
"""
Computes the node positions the first time they are requested
if no explicit node information was supplied.
"""
if self._nodes is None:
self._nodes = layout_nodes(self, only_nodes=True)
return self._nodes | def nodes(self):
"""
Computes the node positions the first time they are requested
if no explicit node information was supplied.
"""
if self._nodes is None:
self._nodes = layout_nodes(self, only_nodes=True)
return self._nodes | [
"Computes",
"the",
"node",
"positions",
"the",
"first",
"time",
"they",
"are",
"requested",
"if",
"no",
"explicit",
"node",
"information",
"was",
"supplied",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L362-L369 | [
"def",
"nodes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_nodes",
"is",
"None",
":",
"self",
".",
"_nodes",
"=",
"layout_nodes",
"(",
"self",
",",
"only_nodes",
"=",
"True",
")",
"return",
"self",
".",
"_nodes"
] | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Graph.edgepaths | Returns the fixed EdgePaths or computes direct connections
between supplied nodes. | holoviews/element/graphs.py | def edgepaths(self):
"""
Returns the fixed EdgePaths or computes direct connections
between supplied nodes.
"""
if self._edgepaths:
return self._edgepaths
if pd is None:
paths = connect_edges(self)
else:
paths = connect_edges_pd... | def edgepaths(self):
"""
Returns the fixed EdgePaths or computes direct connections
between supplied nodes.
"""
if self._edgepaths:
return self._edgepaths
if pd is None:
paths = connect_edges(self)
else:
paths = connect_edges_pd... | [
"Returns",
"the",
"fixed",
"EdgePaths",
"or",
"computes",
"direct",
"connections",
"between",
"supplied",
"nodes",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L373-L384 | [
"def",
"edgepaths",
"(",
"self",
")",
":",
"if",
"self",
".",
"_edgepaths",
":",
"return",
"self",
".",
"_edgepaths",
"if",
"pd",
"is",
"None",
":",
"paths",
"=",
"connect_edges",
"(",
"self",
")",
"else",
":",
"paths",
"=",
"connect_edges_pd",
"(",
"s... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Graph.from_networkx | Generate a HoloViews Graph from a networkx.Graph object and
networkx layout function or dictionary of node positions.
Any keyword arguments will be passed to the layout
function. By default it will extract all node and edge
attributes from the networkx.Graph but explicit node
inf... | holoviews/element/graphs.py | def from_networkx(cls, G, positions, nodes=None, **kwargs):
"""
Generate a HoloViews Graph from a networkx.Graph object and
networkx layout function or dictionary of node positions.
Any keyword arguments will be passed to the layout
function. By default it will extract all node a... | def from_networkx(cls, G, positions, nodes=None, **kwargs):
"""
Generate a HoloViews Graph from a networkx.Graph object and
networkx layout function or dictionary of node positions.
Any keyword arguments will be passed to the layout
function. By default it will extract all node a... | [
"Generate",
"a",
"HoloViews",
"Graph",
"from",
"a",
"networkx",
".",
"Graph",
"object",
"and",
"networkx",
"layout",
"function",
"or",
"dictionary",
"of",
"node",
"positions",
".",
"Any",
"keyword",
"arguments",
"will",
"be",
"passed",
"to",
"the",
"layout",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L388-L479 | [
"def",
"from_networkx",
"(",
"cls",
",",
"G",
",",
"positions",
",",
"nodes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"isinstance",
"(",
"positions",
",",
"dict",
")",
":",
"positions",
"=",
"positions",
"(",
"G",
",",
"*",
"*"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | TriMesh.from_vertices | Uses Delauney triangulation to compute triangle simplices for
each point. | holoviews/element/graphs.py | def from_vertices(cls, data):
"""
Uses Delauney triangulation to compute triangle simplices for
each point.
"""
try:
from scipy.spatial import Delaunay
except:
raise ImportError("Generating triangles from points requires, "
... | def from_vertices(cls, data):
"""
Uses Delauney triangulation to compute triangle simplices for
each point.
"""
try:
from scipy.spatial import Delaunay
except:
raise ImportError("Generating triangles from points requires, "
... | [
"Uses",
"Delauney",
"triangulation",
"to",
"compute",
"triangle",
"simplices",
"for",
"each",
"point",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L544-L559 | [
"def",
"from_vertices",
"(",
"cls",
",",
"data",
")",
":",
"try",
":",
"from",
"scipy",
".",
"spatial",
"import",
"Delaunay",
"except",
":",
"raise",
"ImportError",
"(",
"\"Generating triangles from points requires, \"",
"\"SciPy to be installed.\"",
")",
"if",
"not... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | TriMesh.edgepaths | Returns the EdgePaths by generating a triangle for each simplex. | holoviews/element/graphs.py | def edgepaths(self):
"""
Returns the EdgePaths by generating a triangle for each simplex.
"""
if self._edgepaths:
return self._edgepaths
elif not len(self):
edgepaths = self.edge_type([], kdims=self.nodes.kdims[:2])
self._edgepaths = edgepaths
... | def edgepaths(self):
"""
Returns the EdgePaths by generating a triangle for each simplex.
"""
if self._edgepaths:
return self._edgepaths
elif not len(self):
edgepaths = self.edge_type([], kdims=self.nodes.kdims[:2])
self._edgepaths = edgepaths
... | [
"Returns",
"the",
"EdgePaths",
"by",
"generating",
"a",
"triangle",
"for",
"each",
"simplex",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L562-L583 | [
"def",
"edgepaths",
"(",
"self",
")",
":",
"if",
"self",
".",
"_edgepaths",
":",
"return",
"self",
".",
"_edgepaths",
"elif",
"not",
"len",
"(",
"self",
")",
":",
"edgepaths",
"=",
"self",
".",
"edge_type",
"(",
"[",
"]",
",",
"kdims",
"=",
"self",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | TriMesh.select | Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally selection_specs (taking the form of a list
of type.group.label strings, types or functions) ... | holoviews/element/graphs.py | def select(self, selection_specs=None, **selection):
"""
Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally selection_specs (taking the... | def select(self, selection_specs=None, **selection):
"""
Allows selecting data by the slices, sets and scalar values
along a particular dimension. The indices should be supplied as
keywords mapping between the selected dimension and
value. Additionally selection_specs (taking the... | [
"Allows",
"selecting",
"data",
"by",
"the",
"slices",
"sets",
"and",
"scalar",
"values",
"along",
"a",
"particular",
"dimension",
".",
"The",
"indices",
"should",
"be",
"supplied",
"as",
"keywords",
"mapping",
"between",
"the",
"selected",
"dimension",
"and",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/graphs.py#L585-L599 | [
"def",
"select",
"(",
"self",
",",
"selection_specs",
"=",
"None",
",",
"*",
"*",
"selection",
")",
":",
"# Ensure that edgepaths are initialized so they can be selected on",
"self",
".",
"edgepaths",
"return",
"super",
"(",
"TriMesh",
",",
"self",
")",
".",
"sele... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Plot3D._finalize_axis | Extends the ElementPlot _finalize_axis method to set appropriate
labels, and axes options for 3D Plots. | holoviews/plotting/mpl/chart3d.py | def _finalize_axis(self, key, **kwargs):
"""
Extends the ElementPlot _finalize_axis method to set appropriate
labels, and axes options for 3D Plots.
"""
axis = self.handles['axis']
self.handles['fig'].set_frameon(False)
axis.grid(self.show_grid)
axis.view_... | def _finalize_axis(self, key, **kwargs):
"""
Extends the ElementPlot _finalize_axis method to set appropriate
labels, and axes options for 3D Plots.
"""
axis = self.handles['axis']
self.handles['fig'].set_frameon(False)
axis.grid(self.show_grid)
axis.view_... | [
"Extends",
"the",
"ElementPlot",
"_finalize_axis",
"method",
"to",
"set",
"appropriate",
"labels",
"and",
"axes",
"options",
"for",
"3D",
"Plots",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart3d.py#L60-L87 | [
"def",
"_finalize_axis",
"(",
"self",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"axis",
"=",
"self",
".",
"handles",
"[",
"'axis'",
"]",
"self",
".",
"handles",
"[",
"'fig'",
"]",
".",
"set_frameon",
"(",
"False",
")",
"axis",
".",
"grid",
"("... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DaskInterface.select_mask | Given a Dataset object and a dictionary with dimension keys and
selection keys (i.e tuple ranges, slices, sets, lists or literals)
return a boolean mask over the rows in the Dataset object that
have been selected. | holoviews/core/data/dask.py | def select_mask(cls, dataset, selection):
"""
Given a Dataset object and a dictionary with dimension keys and
selection keys (i.e tuple ranges, slices, sets, lists or literals)
return a boolean mask over the rows in the Dataset object that
have been selected.
"""
... | def select_mask(cls, dataset, selection):
"""
Given a Dataset object and a dictionary with dimension keys and
selection keys (i.e tuple ranges, slices, sets, lists or literals)
return a boolean mask over the rows in the Dataset object that
have been selected.
"""
... | [
"Given",
"a",
"Dataset",
"object",
"and",
"a",
"dictionary",
"with",
"dimension",
"keys",
"and",
"selection",
"keys",
"(",
"i",
".",
"e",
"tuple",
"ranges",
"slices",
"sets",
"lists",
"or",
"literals",
")",
"return",
"a",
"boolean",
"mask",
"over",
"the",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/dask.py#L101-L141 | [
"def",
"select_mask",
"(",
"cls",
",",
"dataset",
",",
"selection",
")",
":",
"select_mask",
"=",
"None",
"for",
"dim",
",",
"k",
"in",
"selection",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"k",
",",
"tuple",
")",
":",
"k",
"=",
"slice... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DaskInterface.unpack_scalar | Given a dataset object and data in the appropriate format for
the interface, return a simple scalar. | holoviews/core/data/dask.py | def unpack_scalar(cls, dataset, data):
"""
Given a dataset object and data in the appropriate format for
the interface, return a simple scalar.
"""
import dask.dataframe as dd
if len(data.columns) > 1 or len(data) != 1:
return data
if isinstance(data, ... | def unpack_scalar(cls, dataset, data):
"""
Given a dataset object and data in the appropriate format for
the interface, return a simple scalar.
"""
import dask.dataframe as dd
if len(data.columns) > 1 or len(data) != 1:
return data
if isinstance(data, ... | [
"Given",
"a",
"dataset",
"object",
"and",
"data",
"in",
"the",
"appropriate",
"format",
"for",
"the",
"interface",
"return",
"a",
"simple",
"scalar",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/dask.py#L228-L238 | [
"def",
"unpack_scalar",
"(",
"cls",
",",
"dataset",
",",
"data",
")",
":",
"import",
"dask",
".",
"dataframe",
"as",
"dd",
"if",
"len",
"(",
"data",
".",
"columns",
")",
">",
"1",
"or",
"len",
"(",
"data",
")",
"!=",
"1",
":",
"return",
"data",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DaskInterface.iloc | Dask does not support iloc, therefore iloc will execute
the call graph and lose the laziness of the operation. | holoviews/core/data/dask.py | def iloc(cls, dataset, index):
"""
Dask does not support iloc, therefore iloc will execute
the call graph and lose the laziness of the operation.
"""
rows, cols = index
scalar = False
if isinstance(cols, slice):
cols = [d.name for d in dataset.dimensio... | def iloc(cls, dataset, index):
"""
Dask does not support iloc, therefore iloc will execute
the call graph and lose the laziness of the operation.
"""
rows, cols = index
scalar = False
if isinstance(cols, slice):
cols = [d.name for d in dataset.dimensio... | [
"Dask",
"does",
"not",
"support",
"iloc",
"therefore",
"iloc",
"will",
"execute",
"the",
"call",
"graph",
"and",
"lose",
"the",
"laziness",
"of",
"the",
"operation",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/dask.py#L289-L311 | [
"def",
"iloc",
"(",
"cls",
",",
"dataset",
",",
"index",
")",
":",
"rows",
",",
"cols",
"=",
"index",
"scalar",
"=",
"False",
"if",
"isinstance",
"(",
"cols",
",",
"slice",
")",
":",
"cols",
"=",
"[",
"d",
".",
"name",
"for",
"d",
"in",
"dataset"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _layout_sankey.computeNodeLinks | Populate the sourceLinks and targetLinks for each node.
Also, if the source and target are not objects, assume they are indices. | holoviews/element/sankey.py | def computeNodeLinks(cls, element, graph):
"""
Populate the sourceLinks and targetLinks for each node.
Also, if the source and target are not objects, assume they are indices.
"""
index = element.nodes.kdims[-1]
node_map = {}
if element.nodes.vdims:
va... | def computeNodeLinks(cls, element, graph):
"""
Populate the sourceLinks and targetLinks for each node.
Also, if the source and target are not objects, assume they are indices.
"""
index = element.nodes.kdims[-1]
node_map = {}
if element.nodes.vdims:
va... | [
"Populate",
"the",
"sourceLinks",
"and",
"targetLinks",
"for",
"each",
"node",
".",
"Also",
"if",
"the",
"source",
"and",
"target",
"are",
"not",
"objects",
"assume",
"they",
"are",
"indices",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/sankey.py#L121-L144 | [
"def",
"computeNodeLinks",
"(",
"cls",
",",
"element",
",",
"graph",
")",
":",
"index",
"=",
"element",
".",
"nodes",
".",
"kdims",
"[",
"-",
"1",
"]",
"node_map",
"=",
"{",
"}",
"if",
"element",
".",
"nodes",
".",
"vdims",
":",
"values",
"=",
"zip... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _layout_sankey.computeNodeValues | Compute the value (size) of each node by summing the associated links. | holoviews/element/sankey.py | def computeNodeValues(cls, graph):
"""
Compute the value (size) of each node by summing the associated links.
"""
for node in graph['nodes']:
source_val = np.sum([l['value'] for l in node['sourceLinks']])
target_val = np.sum([l['value'] for l in node['targetLinks'... | def computeNodeValues(cls, graph):
"""
Compute the value (size) of each node by summing the associated links.
"""
for node in graph['nodes']:
source_val = np.sum([l['value'] for l in node['sourceLinks']])
target_val = np.sum([l['value'] for l in node['targetLinks'... | [
"Compute",
"the",
"value",
"(",
"size",
")",
"of",
"each",
"node",
"by",
"summing",
"the",
"associated",
"links",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/sankey.py#L147-L154 | [
"def",
"computeNodeValues",
"(",
"cls",
",",
"graph",
")",
":",
"for",
"node",
"in",
"graph",
"[",
"'nodes'",
"]",
":",
"source_val",
"=",
"np",
".",
"sum",
"(",
"[",
"l",
"[",
"'value'",
"]",
"for",
"l",
"in",
"node",
"[",
"'sourceLinks'",
"]",
"]... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _layout_sankey.computeNodeDepths | Iteratively assign the depth (x-position) for each node.
Nodes are assigned the maximum depth of incoming neighbors plus one;
nodes with no incoming links are assigned depth zero, while
nodes with no outgoing links are assigned the maximum depth. | holoviews/element/sankey.py | def computeNodeDepths(self, graph):
"""
Iteratively assign the depth (x-position) for each node.
Nodes are assigned the maximum depth of incoming neighbors plus one;
nodes with no incoming links are assigned depth zero, while
nodes with no outgoing links are assigned the maximum ... | def computeNodeDepths(self, graph):
"""
Iteratively assign the depth (x-position) for each node.
Nodes are assigned the maximum depth of incoming neighbors plus one;
nodes with no incoming links are assigned depth zero, while
nodes with no outgoing links are assigned the maximum ... | [
"Iteratively",
"assign",
"the",
"depth",
"(",
"x",
"-",
"position",
")",
"for",
"each",
"node",
".",
"Nodes",
"are",
"assigned",
"the",
"maximum",
"depth",
"of",
"incoming",
"neighbors",
"plus",
"one",
";",
"nodes",
"with",
"no",
"incoming",
"links",
"are"... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/sankey.py#L156-L197 | [
"def",
"computeNodeDepths",
"(",
"self",
",",
"graph",
")",
":",
"nodes",
"=",
"graph",
"[",
"'nodes'",
"]",
"depth",
"=",
"0",
"while",
"nodes",
":",
"next_nodes",
"=",
"[",
"]",
"for",
"node",
"in",
"nodes",
":",
"node",
"[",
"'depth'",
"]",
"=",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | HistogramPlot._process_hist | Get data from histogram, including bin_ranges and values. | holoviews/plotting/mpl/chart.py | def _process_hist(self, hist):
"""
Get data from histogram, including bin_ranges and values.
"""
self.cyclic = hist.get_dimension(0).cyclic
x = hist.kdims[0]
edges = hist.interface.coords(hist, x, edges=True)
values = hist.dimension_values(1)
hist_vals = n... | def _process_hist(self, hist):
"""
Get data from histogram, including bin_ranges and values.
"""
self.cyclic = hist.get_dimension(0).cyclic
x = hist.kdims[0]
edges = hist.interface.coords(hist, x, edges=True)
values = hist.dimension_values(1)
hist_vals = n... | [
"Get",
"data",
"from",
"histogram",
"including",
"bin_ranges",
"and",
"values",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L373-L390 | [
"def",
"_process_hist",
"(",
"self",
",",
"hist",
")",
":",
"self",
".",
"cyclic",
"=",
"hist",
".",
"get_dimension",
"(",
"0",
")",
".",
"cyclic",
"x",
"=",
"hist",
".",
"kdims",
"[",
"0",
"]",
"edges",
"=",
"hist",
".",
"interface",
".",
"coords"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | HistogramPlot._compute_ticks | Compute the ticks either as cyclic values in degrees or as roughly
evenly spaced bin centers. | holoviews/plotting/mpl/chart.py | def _compute_ticks(self, element, edges, widths, lims):
"""
Compute the ticks either as cyclic values in degrees or as roughly
evenly spaced bin centers.
"""
if self.xticks is None or not isinstance(self.xticks, int):
return None
if self.cyclic:
x0... | def _compute_ticks(self, element, edges, widths, lims):
"""
Compute the ticks either as cyclic values in degrees or as roughly
evenly spaced bin centers.
"""
if self.xticks is None or not isinstance(self.xticks, int):
return None
if self.cyclic:
x0... | [
"Compute",
"the",
"ticks",
"either",
"as",
"cyclic",
"values",
"in",
"degrees",
"or",
"as",
"roughly",
"evenly",
"spaced",
"bin",
"centers",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L393-L410 | [
"def",
"_compute_ticks",
"(",
"self",
",",
"element",
",",
"edges",
",",
"widths",
",",
"lims",
")",
":",
"if",
"self",
".",
"xticks",
"is",
"None",
"or",
"not",
"isinstance",
"(",
"self",
".",
"xticks",
",",
"int",
")",
":",
"return",
"None",
"if",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | HistogramPlot._process_axsettings | Get axis settings options including ticks, x- and y-labels
and limits. | holoviews/plotting/mpl/chart.py | def _process_axsettings(self, hist, lims, ticks):
"""
Get axis settings options including ticks, x- and y-labels
and limits.
"""
axis_settings = dict(zip(self.axis_settings, [None, None, (None if self.overlaid else ticks)]))
return axis_settings | def _process_axsettings(self, hist, lims, ticks):
"""
Get axis settings options including ticks, x- and y-labels
and limits.
"""
axis_settings = dict(zip(self.axis_settings, [None, None, (None if self.overlaid else ticks)]))
return axis_settings | [
"Get",
"axis",
"settings",
"options",
"including",
"ticks",
"x",
"-",
"and",
"y",
"-",
"labels",
"and",
"limits",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L422-L428 | [
"def",
"_process_axsettings",
"(",
"self",
",",
"hist",
",",
"lims",
",",
"ticks",
")",
":",
"axis_settings",
"=",
"dict",
"(",
"zip",
"(",
"self",
".",
"axis_settings",
",",
"[",
"None",
",",
"None",
",",
"(",
"None",
"if",
"self",
".",
"overlaid",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | HistogramPlot._update_artists | Update all the artists in the histogram. Subclassable to
allow updating of further artists. | holoviews/plotting/mpl/chart.py | def _update_artists(self, key, hist, edges, hvals, widths, lims, ranges):
"""
Update all the artists in the histogram. Subclassable to
allow updating of further artists.
"""
plot_vals = zip(self.handles['artist'], edges, hvals, widths)
for bar, edge, height, width in plot... | def _update_artists(self, key, hist, edges, hvals, widths, lims, ranges):
"""
Update all the artists in the histogram. Subclassable to
allow updating of further artists.
"""
plot_vals = zip(self.handles['artist'], edges, hvals, widths)
for bar, edge, height, width in plot... | [
"Update",
"all",
"the",
"artists",
"in",
"the",
"histogram",
".",
"Subclassable",
"to",
"allow",
"updating",
"of",
"further",
"artists",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L439-L453 | [
"def",
"_update_artists",
"(",
"self",
",",
"key",
",",
"hist",
",",
"edges",
",",
"hvals",
",",
"widths",
",",
"lims",
",",
"ranges",
")",
":",
"plot_vals",
"=",
"zip",
"(",
"self",
".",
"handles",
"[",
"'artist'",
"]",
",",
"edges",
",",
"hvals",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | SideHistogramPlot._process_hist | Subclassed to offset histogram by defined amount. | holoviews/plotting/mpl/chart.py | def _process_hist(self, hist):
"""
Subclassed to offset histogram by defined amount.
"""
edges, hvals, widths, lims, isdatetime = super(SideHistogramPlot, self)._process_hist(hist)
offset = self.offset * lims[3]
hvals *= 1-self.offset
hvals += offset
lims ... | def _process_hist(self, hist):
"""
Subclassed to offset histogram by defined amount.
"""
edges, hvals, widths, lims, isdatetime = super(SideHistogramPlot, self)._process_hist(hist)
offset = self.offset * lims[3]
hvals *= 1-self.offset
hvals += offset
lims ... | [
"Subclassed",
"to",
"offset",
"histogram",
"by",
"defined",
"amount",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L478-L487 | [
"def",
"_process_hist",
"(",
"self",
",",
"hist",
")",
":",
"edges",
",",
"hvals",
",",
"widths",
",",
"lims",
",",
"isdatetime",
"=",
"super",
"(",
"SideHistogramPlot",
",",
"self",
")",
".",
"_process_hist",
"(",
"hist",
")",
"offset",
"=",
"self",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | SideHistogramPlot._update_plot | Process the bars and draw the offset line as necessary. If a
color map is set in the style of the 'main' ViewableElement object, color
the bars appropriately, respecting the required normalization
settings. | holoviews/plotting/mpl/chart.py | def _update_plot(self, key, element, bars, lims, ranges):
"""
Process the bars and draw the offset line as necessary. If a
color map is set in the style of the 'main' ViewableElement object, color
the bars appropriately, respecting the required normalization
settings.
"""... | def _update_plot(self, key, element, bars, lims, ranges):
"""
Process the bars and draw the offset line as necessary. If a
color map is set in the style of the 'main' ViewableElement object, color
the bars appropriately, respecting the required normalization
settings.
"""... | [
"Process",
"the",
"bars",
"and",
"draw",
"the",
"offset",
"line",
"as",
"necessary",
".",
"If",
"a",
"color",
"map",
"is",
"set",
"in",
"the",
"style",
"of",
"the",
"main",
"ViewableElement",
"object",
"color",
"the",
"bars",
"appropriately",
"respecting",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L495-L540 | [
"def",
"_update_plot",
"(",
"self",
",",
"key",
",",
"element",
",",
"bars",
",",
"lims",
",",
"ranges",
")",
":",
"main",
"=",
"self",
".",
"adjoined",
".",
"main",
"_",
",",
"y1",
"=",
"element",
".",
"range",
"(",
"1",
")",
"offset",
"=",
"sel... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | SideHistogramPlot._colorize_bars | Use the given cmap to color the bars, applying the correct
color ranges as necessary. | holoviews/plotting/mpl/chart.py | def _colorize_bars(self, cmap, bars, element, main_range, dim):
"""
Use the given cmap to color the bars, applying the correct
color ranges as necessary.
"""
cmap_range = main_range[1] - main_range[0]
lower_bound = main_range[0]
colors = np.array(element.dimension... | def _colorize_bars(self, cmap, bars, element, main_range, dim):
"""
Use the given cmap to color the bars, applying the correct
color ranges as necessary.
"""
cmap_range = main_range[1] - main_range[0]
lower_bound = main_range[0]
colors = np.array(element.dimension... | [
"Use",
"the",
"given",
"cmap",
"to",
"color",
"the",
"bars",
"applying",
"the",
"correct",
"color",
"ranges",
"as",
"necessary",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L543-L554 | [
"def",
"_colorize_bars",
"(",
"self",
",",
"cmap",
",",
"bars",
",",
"element",
",",
"main_range",
",",
"dim",
")",
":",
"cmap_range",
"=",
"main_range",
"[",
"1",
"]",
"-",
"main_range",
"[",
"0",
"]",
"lower_bound",
"=",
"main_range",
"[",
"0",
"]",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | SideHistogramPlot._update_separator | Compute colorbar offset and update separator line
if map is non-zero. | holoviews/plotting/mpl/chart.py | def _update_separator(self, offset):
"""
Compute colorbar offset and update separator line
if map is non-zero.
"""
offset_line = self.handles['offset_line']
if offset == 0:
offset_line.set_visible(False)
else:
offset_line.set_visible(True)
... | def _update_separator(self, offset):
"""
Compute colorbar offset and update separator line
if map is non-zero.
"""
offset_line = self.handles['offset_line']
if offset == 0:
offset_line.set_visible(False)
else:
offset_line.set_visible(True)
... | [
"Compute",
"colorbar",
"offset",
"and",
"update",
"separator",
"line",
"if",
"map",
"is",
"non",
"-",
"zero",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L557-L570 | [
"def",
"_update_separator",
"(",
"self",
",",
"offset",
")",
":",
"offset_line",
"=",
"self",
".",
"handles",
"[",
"'offset_line'",
"]",
"if",
"offset",
"==",
"0",
":",
"offset_line",
".",
"set_visible",
"(",
"False",
")",
"else",
":",
"offset_line",
".",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | BarPlot._get_values | Get unique index value for each bar | holoviews/plotting/mpl/chart.py | def _get_values(self):
"""
Get unique index value for each bar
"""
(gi, _), (ci, _), (si, _) = self._get_dims(self.hmap.last)
ndims = self.hmap.last.ndims
dims = self.hmap.last.kdims
dimensions = []
values = {}
for vidx, vtype in zip([gi, ci, si], ... | def _get_values(self):
"""
Get unique index value for each bar
"""
(gi, _), (ci, _), (si, _) = self._get_dims(self.hmap.last)
ndims = self.hmap.last.ndims
dims = self.hmap.last.kdims
dimensions = []
values = {}
for vidx, vtype in zip([gi, ci, si], ... | [
"Get",
"unique",
"index",
"value",
"for",
"each",
"bar"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L897-L915 | [
"def",
"_get_values",
"(",
"self",
")",
":",
"(",
"gi",
",",
"_",
")",
",",
"(",
"ci",
",",
"_",
")",
",",
"(",
"si",
",",
"_",
")",
"=",
"self",
".",
"_get_dims",
"(",
"self",
".",
"hmap",
".",
"last",
")",
"ndims",
"=",
"self",
".",
"hmap... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | BarPlot._compute_styles | Computes color and hatch combinations by
any combination of the 'group', 'category'
and 'stack'. | holoviews/plotting/mpl/chart.py | def _compute_styles(self, element, style_groups):
"""
Computes color and hatch combinations by
any combination of the 'group', 'category'
and 'stack'.
"""
style = self.lookup_options(element, 'style')[0]
sopts = []
for sopt in ['color', 'hatch']:
... | def _compute_styles(self, element, style_groups):
"""
Computes color and hatch combinations by
any combination of the 'group', 'category'
and 'stack'.
"""
style = self.lookup_options(element, 'style')[0]
sopts = []
for sopt in ['color', 'hatch']:
... | [
"Computes",
"color",
"and",
"hatch",
"combinations",
"by",
"any",
"combination",
"of",
"the",
"group",
"category",
"and",
"stack",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L918-L938 | [
"def",
"_compute_styles",
"(",
"self",
",",
"element",
",",
"style_groups",
")",
":",
"style",
"=",
"self",
".",
"lookup_options",
"(",
"element",
",",
"'style'",
")",
"[",
"0",
"]",
"sopts",
"=",
"[",
"]",
"for",
"sopt",
"in",
"[",
"'color'",
",",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | BarPlot._finalize_ticks | Apply ticks with appropriate offsets. | holoviews/plotting/mpl/chart.py | def _finalize_ticks(self, axis, element, xticks, yticks, zticks):
"""
Apply ticks with appropriate offsets.
"""
yalignments = None
if xticks is not None:
ticks, labels, yalignments = zip(*sorted(xticks, key=lambda x: x[0]))
xticks = (list(ticks), list(labe... | def _finalize_ticks(self, axis, element, xticks, yticks, zticks):
"""
Apply ticks with appropriate offsets.
"""
yalignments = None
if xticks is not None:
ticks, labels, yalignments = zip(*sorted(xticks, key=lambda x: x[0]))
xticks = (list(ticks), list(labe... | [
"Apply",
"ticks",
"with",
"appropriate",
"offsets",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/chart.py#L966-L977 | [
"def",
"_finalize_ticks",
"(",
"self",
",",
"axis",
",",
"element",
",",
"xticks",
",",
"yticks",
",",
"zticks",
")",
":",
"yalignments",
"=",
"None",
"if",
"xticks",
"is",
"not",
"None",
":",
"ticks",
",",
"labels",
",",
"yalignments",
"=",
"zip",
"("... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | AdjointLayout.group | Group inherited from main element | holoviews/core/layout.py | def group(self):
"Group inherited from main element"
if self.main and self.main.group != type(self.main).__name__:
return self.main.group
else:
return 'AdjointLayout' | def group(self):
"Group inherited from main element"
if self.main and self.main.group != type(self.main).__name__:
return self.main.group
else:
return 'AdjointLayout' | [
"Group",
"inherited",
"from",
"main",
"element"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L148-L153 | [
"def",
"group",
"(",
"self",
")",
":",
"if",
"self",
".",
"main",
"and",
"self",
".",
"main",
".",
"group",
"!=",
"type",
"(",
"self",
".",
"main",
")",
".",
"__name__",
":",
"return",
"self",
".",
"main",
".",
"group",
"else",
":",
"return",
"'A... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | AdjointLayout.relabel | Clone object and apply new group and/or label.
Applies relabeling to child up to the supplied depth.
Args:
label (str, optional): New label to apply to returned object
group (str, optional): New group to apply to returned object
depth (int, optional): Depth to which... | holoviews/core/layout.py | def relabel(self, label=None, group=None, depth=1):
"""Clone object and apply new group and/or label.
Applies relabeling to child up to the supplied depth.
Args:
label (str, optional): New label to apply to returned object
group (str, optional): New group to apply to re... | def relabel(self, label=None, group=None, depth=1):
"""Clone object and apply new group and/or label.
Applies relabeling to child up to the supplied depth.
Args:
label (str, optional): New label to apply to returned object
group (str, optional): New group to apply to re... | [
"Clone",
"object",
"and",
"apply",
"new",
"group",
"and",
"/",
"or",
"label",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L168-L183 | [
"def",
"relabel",
"(",
"self",
",",
"label",
"=",
"None",
",",
"group",
"=",
"None",
",",
"depth",
"=",
"1",
")",
":",
"return",
"super",
"(",
"AdjointLayout",
",",
"self",
")",
".",
"relabel",
"(",
"label",
"=",
"label",
",",
"group",
"=",
"group"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | AdjointLayout.dimension_values | Return the values along the requested dimension.
Applies to the main object in the AdjointLayout.
Args:
dimension: The dimension to return values for
expanded (bool, optional): Whether to expand values
Whether to return the expanded values, behavior depends
... | holoviews/core/layout.py | def dimension_values(self, dimension, expanded=True, flat=True):
"""Return the values along the requested dimension.
Applies to the main object in the AdjointLayout.
Args:
dimension: The dimension to return values for
expanded (bool, optional): Whether to expand values
... | def dimension_values(self, dimension, expanded=True, flat=True):
"""Return the values along the requested dimension.
Applies to the main object in the AdjointLayout.
Args:
dimension: The dimension to return values for
expanded (bool, optional): Whether to expand values
... | [
"Return",
"the",
"values",
"along",
"the",
"requested",
"dimension",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L201-L220 | [
"def",
"dimension_values",
"(",
"self",
",",
"dimension",
",",
"expanded",
"=",
"True",
",",
"flat",
"=",
"True",
")",
":",
"dimension",
"=",
"self",
".",
"get_dimension",
"(",
"dimension",
",",
"strict",
"=",
"True",
")",
".",
"name",
"return",
"self",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NdLayout.grid_items | Compute a dict of {(row,column): (key, value)} elements from the
current set of items and specified number of columns. | holoviews/core/layout.py | def grid_items(self):
"""
Compute a dict of {(row,column): (key, value)} elements from the
current set of items and specified number of columns.
"""
if list(self.keys()) == []: return {}
cols = self._max_cols
return {(idx // cols, idx % cols): (key, item)
... | def grid_items(self):
"""
Compute a dict of {(row,column): (key, value)} elements from the
current set of items and specified number of columns.
"""
if list(self.keys()) == []: return {}
cols = self._max_cols
return {(idx // cols, idx % cols): (key, item)
... | [
"Compute",
"a",
"dict",
"of",
"{",
"(",
"row",
"column",
")",
":",
"(",
"key",
"value",
")",
"}",
"elements",
"from",
"the",
"current",
"set",
"of",
"items",
"and",
"specified",
"number",
"of",
"columns",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L352-L360 | [
"def",
"grid_items",
"(",
"self",
")",
":",
"if",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"==",
"[",
"]",
":",
"return",
"{",
"}",
"cols",
"=",
"self",
".",
"_max_cols",
"return",
"{",
"(",
"idx",
"//",
"cols",
",",
"idx",
"%",
"cols",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NdLayout.last | Returns another NdLayout constituted of the last views of the
individual elements (if they are maps). | holoviews/core/layout.py | def last(self):
"""
Returns another NdLayout constituted of the last views of the
individual elements (if they are maps).
"""
last_items = []
for (k, v) in self.items():
if isinstance(v, NdMapping):
item = (k, v.clone((v.last_key, v.last)))
... | def last(self):
"""
Returns another NdLayout constituted of the last views of the
individual elements (if they are maps).
"""
last_items = []
for (k, v) in self.items():
if isinstance(v, NdMapping):
item = (k, v.clone((v.last_key, v.last)))
... | [
"Returns",
"another",
"NdLayout",
"constituted",
"of",
"the",
"last",
"views",
"of",
"the",
"individual",
"elements",
"(",
"if",
"they",
"are",
"maps",
")",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L383-L397 | [
"def",
"last",
"(",
"self",
")",
":",
"last_items",
"=",
"[",
"]",
"for",
"(",
"k",
",",
"v",
")",
"in",
"self",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"NdMapping",
")",
":",
"item",
"=",
"(",
"k",
",",
"v",
".",
"c... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | NdLayout.clone | Clones the NdLayout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Additional arguments to pass to constructor
... | holoviews/core/layout.py | def clone(self, *args, **overrides):
"""Clones the NdLayout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Add... | def clone(self, *args, **overrides):
"""Clones the NdLayout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Add... | [
"Clones",
"the",
"NdLayout",
"overriding",
"data",
"and",
"parameters",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L400-L416 | [
"def",
"clone",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"overrides",
")",
":",
"clone",
"=",
"super",
"(",
"NdLayout",
",",
"self",
")",
".",
"clone",
"(",
"*",
"args",
",",
"*",
"*",
"overrides",
")",
"clone",
".",
"_max_cols",
"=",
"self"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Layout.shape | Tuple indicating the number of rows and columns in the Layout. | holoviews/core/layout.py | def shape(self):
"Tuple indicating the number of rows and columns in the Layout."
num = len(self)
if num <= self._max_cols:
return (1, num)
nrows = num // self._max_cols
last_row_cols = num % self._max_cols
return nrows+(1 if last_row_cols else 0), min(num, se... | def shape(self):
"Tuple indicating the number of rows and columns in the Layout."
num = len(self)
if num <= self._max_cols:
return (1, num)
nrows = num // self._max_cols
last_row_cols = num % self._max_cols
return nrows+(1 if last_row_cols else 0), min(num, se... | [
"Tuple",
"indicating",
"the",
"number",
"of",
"rows",
"and",
"columns",
"in",
"the",
"Layout",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L440-L447 | [
"def",
"shape",
"(",
"self",
")",
":",
"num",
"=",
"len",
"(",
"self",
")",
"if",
"num",
"<=",
"self",
".",
"_max_cols",
":",
"return",
"(",
"1",
",",
"num",
")",
"nrows",
"=",
"num",
"//",
"self",
".",
"_max_cols",
"last_row_cols",
"=",
"num",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Layout.clone | Clones the Layout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Additional arguments to pass to constructor
... | holoviews/core/layout.py | def clone(self, *args, **overrides):
"""Clones the Layout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Addit... | def clone(self, *args, **overrides):
"""Clones the Layout, overriding data and parameters.
Args:
data: New data replacing the existing data
shared_data (bool, optional): Whether to use existing data
new_type (optional): Type to cast object to
*args: Addit... | [
"Clones",
"the",
"Layout",
"overriding",
"data",
"and",
"parameters",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/layout.py#L470-L485 | [
"def",
"clone",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"overrides",
")",
":",
"clone",
"=",
"super",
"(",
"Layout",
",",
"self",
")",
".",
"clone",
"(",
"*",
"args",
",",
"*",
"*",
"overrides",
")",
"clone",
".",
"_max_cols",
"=",
"self",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | PlotlyRenderer.diff | Returns a json diff required to update an existing plot with
the latest plot data. | holoviews/plotting/plotly/renderer.py | def diff(self, plot, serialize=True):
"""
Returns a json diff required to update an existing plot with
the latest plot data.
"""
diff = plot.state
if serialize:
return json.dumps(diff, cls=utils.PlotlyJSONEncoder)
else:
return diff | def diff(self, plot, serialize=True):
"""
Returns a json diff required to update an existing plot with
the latest plot data.
"""
diff = plot.state
if serialize:
return json.dumps(diff, cls=utils.PlotlyJSONEncoder)
else:
return diff | [
"Returns",
"a",
"json",
"diff",
"required",
"to",
"update",
"an",
"existing",
"plot",
"with",
"the",
"latest",
"plot",
"data",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/renderer.py#L65-L74 | [
"def",
"diff",
"(",
"self",
",",
"plot",
",",
"serialize",
"=",
"True",
")",
":",
"diff",
"=",
"plot",
".",
"state",
"if",
"serialize",
":",
"return",
"json",
".",
"dumps",
"(",
"diff",
",",
"cls",
"=",
"utils",
".",
"PlotlyJSONEncoder",
")",
"else",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | PlotlyRenderer.load_nb | Loads the plotly notebook resources. | holoviews/plotting/plotly/renderer.py | def load_nb(cls, inline=True):
"""
Loads the plotly notebook resources.
"""
from IPython.display import publish_display_data
cls._loaded = True
init_notebook_mode(connected=not inline)
publish_display_data(data={MIME_TYPES['jlab-hv-load']:
... | def load_nb(cls, inline=True):
"""
Loads the plotly notebook resources.
"""
from IPython.display import publish_display_data
cls._loaded = True
init_notebook_mode(connected=not inline)
publish_display_data(data={MIME_TYPES['jlab-hv-load']:
... | [
"Loads",
"the",
"plotly",
"notebook",
"resources",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/renderer.py#L149-L157 | [
"def",
"load_nb",
"(",
"cls",
",",
"inline",
"=",
"True",
")",
":",
"from",
"IPython",
".",
"display",
"import",
"publish_display_data",
"cls",
".",
"_loaded",
"=",
"True",
"init_notebook_mode",
"(",
"connected",
"=",
"not",
"inline",
")",
"publish_display_dat... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | DictInterface.unpack_scalar | Given a dataset object and data in the appropriate format for
the interface, return a simple scalar. | holoviews/core/data/dictionary.py | def unpack_scalar(cls, dataset, data):
"""
Given a dataset object and data in the appropriate format for
the interface, return a simple scalar.
"""
if len(data) != 1:
return data
key = list(data.keys())[0]
if len(data[key]) == 1 and key in dataset.vdi... | def unpack_scalar(cls, dataset, data):
"""
Given a dataset object and data in the appropriate format for
the interface, return a simple scalar.
"""
if len(data) != 1:
return data
key = list(data.keys())[0]
if len(data[key]) == 1 and key in dataset.vdi... | [
"Given",
"a",
"dataset",
"object",
"and",
"data",
"in",
"the",
"appropriate",
"format",
"for",
"the",
"interface",
"return",
"a",
"simple",
"scalar",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/dictionary.py#L143-L155 | [
"def",
"unpack_scalar",
"(",
"cls",
",",
"dataset",
",",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"!=",
"1",
":",
"return",
"data",
"key",
"=",
"list",
"(",
"data",
".",
"keys",
"(",
")",
")",
"[",
"0",
"]",
"if",
"len",
"(",
"data",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | comment_out_magics | Utility used to make sure AST parser does not choke on unrecognized
magics. | holoviews/ipython/preprocessors.py | def comment_out_magics(source):
"""
Utility used to make sure AST parser does not choke on unrecognized
magics.
"""
filtered = []
for line in source.splitlines():
if line.strip().startswith('%'):
filtered.append('# ' + line)
else:
filtered.append(line)
... | def comment_out_magics(source):
"""
Utility used to make sure AST parser does not choke on unrecognized
magics.
"""
filtered = []
for line in source.splitlines():
if line.strip().startswith('%'):
filtered.append('# ' + line)
else:
filtered.append(line)
... | [
"Utility",
"used",
"to",
"make",
"sure",
"AST",
"parser",
"does",
"not",
"choke",
"on",
"unrecognized",
"magics",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L10-L21 | [
"def",
"comment_out_magics",
"(",
"source",
")",
":",
"filtered",
"=",
"[",
"]",
"for",
"line",
"in",
"source",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"strip",
"(",
")",
".",
"startswith",
"(",
"'%'",
")",
":",
"filtered",
".",
"append"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | wrap_cell_expression | If a cell ends in an expression that could be displaying a HoloViews
object (as determined using the AST), wrap it with a given prefix
and suffix string.
If the cell doesn't end in an expression, return the source unchanged. | holoviews/ipython/preprocessors.py | def wrap_cell_expression(source, template='{expr}'):
"""
If a cell ends in an expression that could be displaying a HoloViews
object (as determined using the AST), wrap it with a given prefix
and suffix string.
If the cell doesn't end in an expression, return the source unchanged.
"""
cell_... | def wrap_cell_expression(source, template='{expr}'):
"""
If a cell ends in an expression that could be displaying a HoloViews
object (as determined using the AST), wrap it with a given prefix
and suffix string.
If the cell doesn't end in an expression, return the source unchanged.
"""
cell_... | [
"If",
"a",
"cell",
"ends",
"in",
"an",
"expression",
"that",
"could",
"be",
"displaying",
"a",
"HoloViews",
"object",
"(",
"as",
"determined",
"using",
"the",
"AST",
")",
"wrap",
"it",
"with",
"a",
"given",
"prefix",
"and",
"suffix",
"string",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L24-L53 | [
"def",
"wrap_cell_expression",
"(",
"source",
",",
"template",
"=",
"'{expr}'",
")",
":",
"cell_output_types",
"=",
"(",
"ast",
".",
"IfExp",
",",
"ast",
".",
"BoolOp",
",",
"ast",
".",
"BinOp",
",",
"ast",
".",
"Call",
",",
"ast",
".",
"Name",
",",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | filter_magic | Given the source of a cell, filter out the given magic and collect
the lines using the magic into a list.
If strip is True, the IPython syntax part of the magic (e.g %magic
or %%magic) is stripped from the returned lines. | holoviews/ipython/preprocessors.py | def filter_magic(source, magic, strip=True):
"""
Given the source of a cell, filter out the given magic and collect
the lines using the magic into a list.
If strip is True, the IPython syntax part of the magic (e.g %magic
or %%magic) is stripped from the returned lines.
"""
filtered, magic_... | def filter_magic(source, magic, strip=True):
"""
Given the source of a cell, filter out the given magic and collect
the lines using the magic into a list.
If strip is True, the IPython syntax part of the magic (e.g %magic
or %%magic) is stripped from the returned lines.
"""
filtered, magic_... | [
"Given",
"the",
"source",
"of",
"a",
"cell",
"filter",
"out",
"the",
"given",
"magic",
"and",
"collect",
"the",
"lines",
"using",
"the",
"magic",
"into",
"a",
"list",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L56-L72 | [
"def",
"filter_magic",
"(",
"source",
",",
"magic",
",",
"strip",
"=",
"True",
")",
":",
"filtered",
",",
"magic_lines",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"line",
"in",
"source",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"strip",
"(",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | strip_magics | Given the source of a cell, filter out all cell and line magics. | holoviews/ipython/preprocessors.py | def strip_magics(source):
"""
Given the source of a cell, filter out all cell and line magics.
"""
filtered=[]
for line in source.splitlines():
if not line.startswith('%') or line.startswith('%%'):
filtered.append(line)
return '\n'.join(filtered) | def strip_magics(source):
"""
Given the source of a cell, filter out all cell and line magics.
"""
filtered=[]
for line in source.splitlines():
if not line.startswith('%') or line.startswith('%%'):
filtered.append(line)
return '\n'.join(filtered) | [
"Given",
"the",
"source",
"of",
"a",
"cell",
"filter",
"out",
"all",
"cell",
"and",
"line",
"magics",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L75-L83 | [
"def",
"strip_magics",
"(",
"source",
")",
":",
"filtered",
"=",
"[",
"]",
"for",
"line",
"in",
"source",
".",
"splitlines",
"(",
")",
":",
"if",
"not",
"line",
".",
"startswith",
"(",
"'%'",
")",
"or",
"line",
".",
"startswith",
"(",
"'%%'",
")",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | replace_line_magic | Given a cell's source, replace line magics using a formatting
template, where {line} is the string that follows the magic. | holoviews/ipython/preprocessors.py | def replace_line_magic(source, magic, template='{line}'):
"""
Given a cell's source, replace line magics using a formatting
template, where {line} is the string that follows the magic.
"""
filtered = []
for line in source.splitlines():
if line.strip().startswith(magic):
subst... | def replace_line_magic(source, magic, template='{line}'):
"""
Given a cell's source, replace line magics using a formatting
template, where {line} is the string that follows the magic.
"""
filtered = []
for line in source.splitlines():
if line.strip().startswith(magic):
subst... | [
"Given",
"a",
"cell",
"s",
"source",
"replace",
"line",
"magics",
"using",
"a",
"formatting",
"template",
"where",
"{",
"line",
"}",
"is",
"the",
"string",
"that",
"follows",
"the",
"magic",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L86-L98 | [
"def",
"replace_line_magic",
"(",
"source",
",",
"magic",
",",
"template",
"=",
"'{line}'",
")",
":",
"filtered",
"=",
"[",
"]",
"for",
"line",
"in",
"source",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"strip",
"(",
")",
".",
"startswith",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Substitute.replace | Given some source html substitute and annotated as applicable | holoviews/ipython/preprocessors.py | def replace(self, src):
"Given some source html substitute and annotated as applicable"
for html in self.substitutions.keys():
if src == html:
annotation = self.annotation % self.substitutions[src][1]
return annotation + self.substitutions[src][0]
retu... | def replace(self, src):
"Given some source html substitute and annotated as applicable"
for html in self.substitutions.keys():
if src == html:
annotation = self.annotation % self.substitutions[src][1]
return annotation + self.substitutions[src][0]
retu... | [
"Given",
"some",
"source",
"html",
"substitute",
"and",
"annotated",
"as",
"applicable"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/preprocessors.py#L184-L190 | [
"def",
"replace",
"(",
"self",
",",
"src",
")",
":",
"for",
"html",
"in",
"self",
".",
"substitutions",
".",
"keys",
"(",
")",
":",
"if",
"src",
"==",
"html",
":",
"annotation",
"=",
"self",
".",
"annotation",
"%",
"self",
".",
"substitutions",
"[",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _get_subplot_number | Extract the subplot number from a subplot value string.
'x3' -> 3
'polar2' -> 2
'scene' -> 1
'y' -> 1
Note: the absence of a subplot number (e.g. 'y') is treated by plotly as
a subplot number of 1
Parameters
----------
subplot_val: str
Subplot string value (e.g. 'scene4')
... | holoviews/plotting/plotly/util.py | def _get_subplot_number(subplot_val):
"""
Extract the subplot number from a subplot value string.
'x3' -> 3
'polar2' -> 2
'scene' -> 1
'y' -> 1
Note: the absence of a subplot number (e.g. 'y') is treated by plotly as
a subplot number of 1
Parameters
----------
subplot_val:... | def _get_subplot_number(subplot_val):
"""
Extract the subplot number from a subplot value string.
'x3' -> 3
'polar2' -> 2
'scene' -> 1
'y' -> 1
Note: the absence of a subplot number (e.g. 'y') is treated by plotly as
a subplot number of 1
Parameters
----------
subplot_val:... | [
"Extract",
"the",
"subplot",
"number",
"from",
"a",
"subplot",
"value",
"string",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L120-L146 | [
"def",
"_get_subplot_number",
"(",
"subplot_val",
")",
":",
"match",
"=",
"_subplot_re",
".",
"match",
"(",
"subplot_val",
")",
"if",
"match",
":",
"subplot_number",
"=",
"int",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
"else",
":",
"subplot_number",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _normalize_subplot_ids | Make sure a layout subplot property is initialized for every subplot that
is referenced by a trace in the figure.
For example, if a figure contains a `scatterpolar` trace with the `subplot`
property set to `polar3`, this function will make sure the figure's layout
has a `polar3` property, and will init... | holoviews/plotting/plotly/util.py | def _normalize_subplot_ids(fig):
"""
Make sure a layout subplot property is initialized for every subplot that
is referenced by a trace in the figure.
For example, if a figure contains a `scatterpolar` trace with the `subplot`
property set to `polar3`, this function will make sure the figure's layo... | def _normalize_subplot_ids(fig):
"""
Make sure a layout subplot property is initialized for every subplot that
is referenced by a trace in the figure.
For example, if a figure contains a `scatterpolar` trace with the `subplot`
property set to `polar3`, this function will make sure the figure's layo... | [
"Make",
"sure",
"a",
"layout",
"subplot",
"property",
"is",
"initialized",
"for",
"every",
"subplot",
"that",
"is",
"referenced",
"by",
"a",
"trace",
"in",
"the",
"figure",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L206-L243 | [
"def",
"_normalize_subplot_ids",
"(",
"fig",
")",
":",
"layout",
"=",
"fig",
".",
"setdefault",
"(",
"'layout'",
",",
"{",
"}",
")",
"for",
"trace",
"in",
"fig",
".",
"get",
"(",
"'data'",
",",
"None",
")",
":",
"trace_type",
"=",
"trace",
".",
"get"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _get_max_subplot_ids | Given an input figure, return a dict containing the max subplot number
for each subplot type in the figure
Parameters
----------
fig: dict
A plotly figure dict
Returns
-------
dict
A dict from subplot type strings to integers indicating the largest
subplot number in... | holoviews/plotting/plotly/util.py | def _get_max_subplot_ids(fig):
"""
Given an input figure, return a dict containing the max subplot number
for each subplot type in the figure
Parameters
----------
fig: dict
A plotly figure dict
Returns
-------
dict
A dict from subplot type strings to integers indic... | def _get_max_subplot_ids(fig):
"""
Given an input figure, return a dict containing the max subplot number
for each subplot type in the figure
Parameters
----------
fig: dict
A plotly figure dict
Returns
-------
dict
A dict from subplot type strings to integers indic... | [
"Given",
"an",
"input",
"figure",
"return",
"a",
"dict",
"containing",
"the",
"max",
"subplot",
"number",
"for",
"each",
"subplot",
"type",
"in",
"the",
"figure"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L246-L282 | [
"def",
"_get_max_subplot_ids",
"(",
"fig",
")",
":",
"max_subplot_ids",
"=",
"{",
"subplot_type",
":",
"0",
"for",
"subplot_type",
"in",
"_subplot_types",
"}",
"max_subplot_ids",
"[",
"'xaxis'",
"]",
"=",
"0",
"max_subplot_ids",
"[",
"'yaxis'",
"]",
"=",
"0",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _offset_subplot_ids | Apply offsets to the subplot id numbers in a figure.
Note: This function mutates the input figure dict
Note: This function assumes that the normalize_subplot_ids function has
already been run on the figure, so that all layout subplot properties in
use are explicitly present in the figure's layout.
... | holoviews/plotting/plotly/util.py | def _offset_subplot_ids(fig, offsets):
"""
Apply offsets to the subplot id numbers in a figure.
Note: This function mutates the input figure dict
Note: This function assumes that the normalize_subplot_ids function has
already been run on the figure, so that all layout subplot properties in
use... | def _offset_subplot_ids(fig, offsets):
"""
Apply offsets to the subplot id numbers in a figure.
Note: This function mutates the input figure dict
Note: This function assumes that the normalize_subplot_ids function has
already been run on the figure, so that all layout subplot properties in
use... | [
"Apply",
"offsets",
"to",
"the",
"subplot",
"id",
"numbers",
"in",
"a",
"figure",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L285-L379 | [
"def",
"_offset_subplot_ids",
"(",
"fig",
",",
"offsets",
")",
":",
"# Offset traces",
"for",
"trace",
"in",
"fig",
".",
"get",
"(",
"'data'",
",",
"None",
")",
":",
"trace_type",
"=",
"trace",
".",
"get",
"(",
"'type'",
",",
"'scatter'",
")",
"subplot_t... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _scale_translate | Scale a figure and translate it to sub-region of the original
figure canvas.
Note: If the input figure has a title, this title is converted into an
annotation and scaled along with the rest of the figure.
Note: This function mutates the input fig dict
Note: This function assumes that the normaliz... | holoviews/plotting/plotly/util.py | def _scale_translate(fig, scale_x, scale_y, translate_x, translate_y):
"""
Scale a figure and translate it to sub-region of the original
figure canvas.
Note: If the input figure has a title, this title is converted into an
annotation and scaled along with the rest of the figure.
Note: This fun... | def _scale_translate(fig, scale_x, scale_y, translate_x, translate_y):
"""
Scale a figure and translate it to sub-region of the original
figure canvas.
Note: If the input figure has a title, this title is converted into an
annotation and scaled along with the rest of the figure.
Note: This fun... | [
"Scale",
"a",
"figure",
"and",
"translate",
"it",
"to",
"sub",
"-",
"region",
"of",
"the",
"original",
"figure",
"canvas",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L382-L484 | [
"def",
"_scale_translate",
"(",
"fig",
",",
"scale_x",
",",
"scale_y",
",",
"translate_x",
",",
"translate_y",
")",
":",
"data",
"=",
"fig",
".",
"setdefault",
"(",
"'data'",
",",
"[",
"]",
")",
"layout",
"=",
"fig",
".",
"setdefault",
"(",
"'layout'",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | merge_figure | Merge a sub-figure into a parent figure
Note: This function mutates the input fig dict, but it does not mutate
the subfig dict
Parameters
----------
fig: dict
The plotly figure dict into which the sub figure will be merged
subfig: dict
The plotly figure dict that will be copied... | holoviews/plotting/plotly/util.py | def merge_figure(fig, subfig):
"""
Merge a sub-figure into a parent figure
Note: This function mutates the input fig dict, but it does not mutate
the subfig dict
Parameters
----------
fig: dict
The plotly figure dict into which the sub figure will be merged
subfig: dict
... | def merge_figure(fig, subfig):
"""
Merge a sub-figure into a parent figure
Note: This function mutates the input fig dict, but it does not mutate
the subfig dict
Parameters
----------
fig: dict
The plotly figure dict into which the sub figure will be merged
subfig: dict
... | [
"Merge",
"a",
"sub",
"-",
"figure",
"into",
"a",
"parent",
"figure"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L487-L508 | [
"def",
"merge_figure",
"(",
"fig",
",",
"subfig",
")",
":",
"# traces",
"data",
"=",
"fig",
".",
"setdefault",
"(",
"'data'",
",",
"[",
"]",
")",
"data",
".",
"extend",
"(",
"copy",
".",
"deepcopy",
"(",
"subfig",
".",
"get",
"(",
"'data'",
",",
"[... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _merge_layout_objs | Merge layout objects recursively
Note: This function mutates the input obj dict, but it does not mutate
the subobj dict
Parameters
----------
obj: dict
dict into which the sub-figure dict will be merged
subobj: dict
dict that sill be copied and merged into `obj` | holoviews/plotting/plotly/util.py | def _merge_layout_objs(obj, subobj):
"""
Merge layout objects recursively
Note: This function mutates the input obj dict, but it does not mutate
the subobj dict
Parameters
----------
obj: dict
dict into which the sub-figure dict will be merged
subobj: dict
dict that sil... | def _merge_layout_objs(obj, subobj):
"""
Merge layout objects recursively
Note: This function mutates the input obj dict, but it does not mutate
the subobj dict
Parameters
----------
obj: dict
dict into which the sub-figure dict will be merged
subobj: dict
dict that sil... | [
"Merge",
"layout",
"objects",
"recursively"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L511-L537 | [
"def",
"_merge_layout_objs",
"(",
"obj",
",",
"subobj",
")",
":",
"for",
"prop",
",",
"val",
"in",
"subobj",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"dict",
")",
"and",
"prop",
"in",
"obj",
":",
"# recursion",
"_merge_layout_o... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | _compute_subplot_domains | Compute normalized domain tuples for a list of widths and a subplot
spacing value
Parameters
----------
widths: list of float
List of the desired withs of each subplot. The length of this list
is also the specification of the number of desired subplots
spacing: float
Spacing... | holoviews/plotting/plotly/util.py | def _compute_subplot_domains(widths, spacing):
"""
Compute normalized domain tuples for a list of widths and a subplot
spacing value
Parameters
----------
widths: list of float
List of the desired withs of each subplot. The length of this list
is also the specification of the nu... | def _compute_subplot_domains(widths, spacing):
"""
Compute normalized domain tuples for a list of widths and a subplot
spacing value
Parameters
----------
widths: list of float
List of the desired withs of each subplot. The length of this list
is also the specification of the nu... | [
"Compute",
"normalized",
"domain",
"tuples",
"for",
"a",
"list",
"of",
"widths",
"and",
"a",
"subplot",
"spacing",
"value"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L540-L568 | [
"def",
"_compute_subplot_domains",
"(",
"widths",
",",
"spacing",
")",
":",
"# normalize widths",
"widths_sum",
"=",
"float",
"(",
"sum",
"(",
"widths",
")",
")",
"total_spacing",
"=",
"(",
"len",
"(",
"widths",
")",
"-",
"1",
")",
"*",
"spacing",
"widths"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | figure_grid | Construct a figure from a 2D grid of sub-figures
Parameters
----------
figures_grid: list of list of (dict or None)
2D list of plotly figure dicts that will be combined in a grid to
produce the resulting figure. None values maybe used to leave empty
grid cells
row_heights: list... | holoviews/plotting/plotly/util.py | def figure_grid(figures_grid,
row_heights=None,
column_widths=None,
row_spacing=0.15,
column_spacing=0.15,
share_xaxis=False,
share_yaxis=False):
"""
Construct a figure from a 2D grid of sub-figures
Parameters
... | def figure_grid(figures_grid,
row_heights=None,
column_widths=None,
row_spacing=0.15,
column_spacing=0.15,
share_xaxis=False,
share_yaxis=False):
"""
Construct a figure from a 2D grid of sub-figures
Parameters
... | [
"Construct",
"a",
"figure",
"from",
"a",
"2D",
"grid",
"of",
"sub",
"-",
"figures"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L571-L659 | [
"def",
"figure_grid",
"(",
"figures_grid",
",",
"row_heights",
"=",
"None",
",",
"column_widths",
"=",
"None",
",",
"row_spacing",
"=",
"0.15",
",",
"column_spacing",
"=",
"0.15",
",",
"share_xaxis",
"=",
"False",
",",
"share_yaxis",
"=",
"False",
")",
":",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | get_colorscale | Converts a cmap spec to a plotly colorscale
Args:
cmap: A recognized colormap by name or list of colors
levels: A list or integer declaring the color-levels
cmin: The lower bound of the color range
cmax: The upper bound of the color range
Returns:
A valid plotly colorsc... | holoviews/plotting/plotly/util.py | def get_colorscale(cmap, levels=None, cmin=None, cmax=None):
"""Converts a cmap spec to a plotly colorscale
Args:
cmap: A recognized colormap by name or list of colors
levels: A list or integer declaring the color-levels
cmin: The lower bound of the color range
cmax: The upper b... | def get_colorscale(cmap, levels=None, cmin=None, cmax=None):
"""Converts a cmap spec to a plotly colorscale
Args:
cmap: A recognized colormap by name or list of colors
levels: A list or integer declaring the color-levels
cmin: The lower bound of the color range
cmax: The upper b... | [
"Converts",
"a",
"cmap",
"spec",
"to",
"a",
"plotly",
"colorscale"
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plotly/util.py#L662-L705 | [
"def",
"get_colorscale",
"(",
"cmap",
",",
"levels",
"=",
"None",
",",
"cmin",
"=",
"None",
",",
"cmax",
"=",
"None",
")",
":",
"ncolors",
"=",
"levels",
"if",
"isinstance",
"(",
"levels",
",",
"int",
")",
"else",
"None",
"if",
"isinstance",
"(",
"le... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer.get_plot | Given a HoloViews Viewable return a corresponding plot instance. | holoviews/plotting/renderer.py | def get_plot(self_or_cls, obj, renderer=None, **kwargs):
"""
Given a HoloViews Viewable return a corresponding plot instance.
"""
if isinstance(obj, DynamicMap) and obj.unbounded:
dims = ', '.join('%r' % dim for dim in obj.unbounded)
msg = ('DynamicMap cannot be d... | def get_plot(self_or_cls, obj, renderer=None, **kwargs):
"""
Given a HoloViews Viewable return a corresponding plot instance.
"""
if isinstance(obj, DynamicMap) and obj.unbounded:
dims = ', '.join('%r' % dim for dim in obj.unbounded)
msg = ('DynamicMap cannot be d... | [
"Given",
"a",
"HoloViews",
"Viewable",
"return",
"a",
"corresponding",
"plot",
"instance",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L173-L210 | [
"def",
"get_plot",
"(",
"self_or_cls",
",",
"obj",
",",
"renderer",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"DynamicMap",
")",
"and",
"obj",
".",
"unbounded",
":",
"dims",
"=",
"', '",
".",
"join",
"(",
... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer._validate | Helper method to be used in the __call__ method to get a
suitable plot or widget object and the appropriate format. | holoviews/plotting/renderer.py | def _validate(self, obj, fmt, **kwargs):
"""
Helper method to be used in the __call__ method to get a
suitable plot or widget object and the appropriate format.
"""
if isinstance(obj, tuple(self.widgets.values())):
return obj, 'html'
plot = self.get_plot(obj, ... | def _validate(self, obj, fmt, **kwargs):
"""
Helper method to be used in the __call__ method to get a
suitable plot or widget object and the appropriate format.
"""
if isinstance(obj, tuple(self.widgets.values())):
return obj, 'html'
plot = self.get_plot(obj, ... | [
"Helper",
"method",
"to",
"be",
"used",
"in",
"the",
"__call__",
"method",
"to",
"get",
"a",
"suitable",
"plot",
"or",
"widget",
"object",
"and",
"the",
"appropriate",
"format",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L213-L243 | [
"def",
"_validate",
"(",
"self",
",",
"obj",
",",
"fmt",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"tuple",
"(",
"self",
".",
"widgets",
".",
"values",
"(",
")",
")",
")",
":",
"return",
"obj",
",",
"'html'",
"plot",... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer._apply_post_render_hooks | Apply the post-render hooks to the data. | holoviews/plotting/renderer.py | def _apply_post_render_hooks(self, data, obj, fmt):
"""
Apply the post-render hooks to the data.
"""
hooks = self.post_render_hooks.get(fmt,[])
for hook in hooks:
try:
data = hook(data, obj)
except Exception as e:
self.param... | def _apply_post_render_hooks(self, data, obj, fmt):
"""
Apply the post-render hooks to the data.
"""
hooks = self.post_render_hooks.get(fmt,[])
for hook in hooks:
try:
data = hook(data, obj)
except Exception as e:
self.param... | [
"Apply",
"the",
"post",
"-",
"render",
"hooks",
"to",
"the",
"data",
"."
] | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L264-L275 | [
"def",
"_apply_post_render_hooks",
"(",
"self",
",",
"data",
",",
"obj",
",",
"fmt",
")",
":",
"hooks",
"=",
"self",
".",
"post_render_hooks",
".",
"get",
"(",
"fmt",
",",
"[",
"]",
")",
"for",
"hook",
"in",
"hooks",
":",
"try",
":",
"data",
"=",
"... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer.html | Renders plot or data structure and wraps the output in HTML.
The comm argument defines whether the HTML output includes
code to initialize a Comm, if the plot supplies one. | holoviews/plotting/renderer.py | def html(self, obj, fmt=None, css=None, **kwargs):
"""
Renders plot or data structure and wraps the output in HTML.
The comm argument defines whether the HTML output includes
code to initialize a Comm, if the plot supplies one.
"""
plot, fmt = self._validate(obj, fmt)
... | def html(self, obj, fmt=None, css=None, **kwargs):
"""
Renders plot or data structure and wraps the output in HTML.
The comm argument defines whether the HTML output includes
code to initialize a Comm, if the plot supplies one.
"""
plot, fmt = self._validate(obj, fmt)
... | [
"Renders",
"plot",
"or",
"data",
"structure",
"and",
"wraps",
"the",
"output",
"in",
"HTML",
".",
"The",
"comm",
"argument",
"defines",
"whether",
"the",
"HTML",
"output",
"includes",
"code",
"to",
"initialize",
"a",
"Comm",
"if",
"the",
"plot",
"supplies",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L278-L306 | [
"def",
"html",
"(",
"self",
",",
"obj",
",",
"fmt",
"=",
"None",
",",
"css",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"plot",
",",
"fmt",
"=",
"self",
".",
"_validate",
"(",
"obj",
",",
"fmt",
")",
"figdata",
",",
"_",
"=",
"self",
"("... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer.components | Returns data and metadata dictionaries containing HTML and JS
components to include render in app, notebook, or standalone
document. Depending on the backend the fmt defines the format
embedded in the HTML, e.g. png or svg. If comm is enabled the
JS code will set up a Websocket comm chan... | holoviews/plotting/renderer.py | def components(self, obj, fmt=None, comm=True, **kwargs):
"""
Returns data and metadata dictionaries containing HTML and JS
components to include render in app, notebook, or standalone
document. Depending on the backend the fmt defines the format
embedded in the HTML, e.g. png or... | def components(self, obj, fmt=None, comm=True, **kwargs):
"""
Returns data and metadata dictionaries containing HTML and JS
components to include render in app, notebook, or standalone
document. Depending on the backend the fmt defines the format
embedded in the HTML, e.g. png or... | [
"Returns",
"data",
"and",
"metadata",
"dictionaries",
"containing",
"HTML",
"and",
"JS",
"components",
"to",
"include",
"render",
"in",
"app",
"notebook",
"or",
"standalone",
"document",
".",
"Depending",
"on",
"the",
"backend",
"the",
"fmt",
"defines",
"the",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L309-L350 | [
"def",
"components",
"(",
"self",
",",
"obj",
",",
"fmt",
"=",
"None",
",",
"comm",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"(",
"Plot",
",",
"NdWidget",
")",
")",
":",
"plot",
"=",
"obj",
"else",
":... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer.static_html | Generates a static HTML with the rendered object in the
supplied format. Allows supplying a template formatting string
with fields to interpolate 'js', 'css' and the main 'html'. | holoviews/plotting/renderer.py | def static_html(self, obj, fmt=None, template=None):
"""
Generates a static HTML with the rendered object in the
supplied format. Allows supplying a template formatting string
with fields to interpolate 'js', 'css' and the main 'html'.
"""
js_html, css_html = self.html_as... | def static_html(self, obj, fmt=None, template=None):
"""
Generates a static HTML with the rendered object in the
supplied format. Allows supplying a template formatting string
with fields to interpolate 'js', 'css' and the main 'html'.
"""
js_html, css_html = self.html_as... | [
"Generates",
"a",
"static",
"HTML",
"with",
"the",
"rendered",
"object",
"in",
"the",
"supplied",
"format",
".",
"Allows",
"supplying",
"a",
"template",
"formatting",
"string",
"with",
"fields",
"to",
"interpolate",
"js",
"css",
"and",
"the",
"main",
"html",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L353-L362 | [
"def",
"static_html",
"(",
"self",
",",
"obj",
",",
"fmt",
"=",
"None",
",",
"template",
"=",
"None",
")",
":",
"js_html",
",",
"css_html",
"=",
"self",
".",
"html_assets",
"(",
")",
"if",
"template",
"is",
"None",
":",
"template",
"=",
"static_templat... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
train | Renderer.export_widgets | Render and export object as a widget to a static HTML
file. Allows supplying a custom template formatting string
with fields to interpolate 'js', 'css' and the main 'html'
containing the widget. Also provides options to export widget
data to a json file in the supplied json_path (default... | holoviews/plotting/renderer.py | def export_widgets(self_or_cls, obj, filename, fmt=None, template=None,
json=False, json_path='', **kwargs):
"""
Render and export object as a widget to a static HTML
file. Allows supplying a custom template formatting string
with fields to interpolate 'js', 'css' ... | def export_widgets(self_or_cls, obj, filename, fmt=None, template=None,
json=False, json_path='', **kwargs):
"""
Render and export object as a widget to a static HTML
file. Allows supplying a custom template formatting string
with fields to interpolate 'js', 'css' ... | [
"Render",
"and",
"export",
"object",
"as",
"a",
"widget",
"to",
"a",
"static",
"HTML",
"file",
".",
"Allows",
"supplying",
"a",
"custom",
"template",
"formatting",
"string",
"with",
"fields",
"to",
"interpolate",
"js",
"css",
"and",
"the",
"main",
"html",
... | pyviz/holoviews | python | https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/renderer.py#L394-L430 | [
"def",
"export_widgets",
"(",
"self_or_cls",
",",
"obj",
",",
"filename",
",",
"fmt",
"=",
"None",
",",
"template",
"=",
"None",
",",
"json",
"=",
"False",
",",
"json_path",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"fmt",
"not",
"in",
"l... | ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.