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
LayoutPlot._create_subplots
Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplots with correct options and styles and hide any empty axes as necessary.
holoviews/plotting/bokeh/plot.py
def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0): """ Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplot...
def _create_subplots(self, layout, positions, layout_dimensions, ranges, num=0): """ Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplot...
[ "Plot", "all", "the", "views", "contained", "in", "the", "AdjointLayout", "Object", "using", "axes", "appropriate", "to", "the", "layout", "configuration", ".", "All", "the", "axes", "are", "supplied", "by", "LayoutPlot", "-", "the", "purpose", "of", "the", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/plot.py#L860-L931
[ "def", "_create_subplots", "(", "self", ",", "layout", ",", "positions", ",", "layout_dimensions", ",", "ranges", ",", "num", "=", "0", ")", ":", "subplots", "=", "{", "}", "adjoint_clone", "=", "layout", ".", "clone", "(", "shared_data", "=", "False", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
LayoutPlot._compute_grid
Computes an empty grid to position the plots on by expanding any AdjointLayouts into multiple rows and columns.
holoviews/plotting/bokeh/plot.py
def _compute_grid(self): """ Computes an empty grid to position the plots on by expanding any AdjointLayouts into multiple rows and columns. """ widths = [] for c in range(self.cols): c_widths = [] for r in range(self.rows): subplot...
def _compute_grid(self): """ Computes an empty grid to position the plots on by expanding any AdjointLayouts into multiple rows and columns. """ widths = [] for c in range(self.cols): c_widths = [] for r in range(self.rows): subplot...
[ "Computes", "an", "empty", "grid", "to", "position", "the", "plots", "on", "by", "expanding", "any", "AdjointLayouts", "into", "multiple", "rows", "and", "columns", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/plot.py#L934-L962
[ "def", "_compute_grid", "(", "self", ")", ":", "widths", "=", "[", "]", "for", "c", "in", "range", "(", "self", ".", "cols", ")", ":", "c_widths", "=", "[", "]", "for", "r", "in", "range", "(", "self", ".", "rows", ")", ":", "subplot", "=", "se...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
LayoutPlot.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/plot.py
def update_frame(self, key, ranges=None): """ Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state. """ ranges = self.compute_ranges(self.layout, key, ranges) for r, c in self.coords: ...
def update_frame(self, key, ranges=None): """ Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state. """ ranges = self.compute_ranges(self.layout, key, ranges) for r, c in self.coords: ...
[ "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/plot.py#L1061-L1074
[ "def", "update_frame", "(", "self", ",", "key", ",", "ranges", "=", "None", ")", ":", "ranges", "=", "self", ".", "compute_ranges", "(", "self", ".", "layout", ",", "key", ",", "ranges", ")", "for", "r", ",", "c", "in", "self", ".", "coords", ":", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AdjointLayoutPlot.initialize_plot
Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplots with correct options and styles and hide any empty axes as necessary.
holoviews/plotting/bokeh/plot.py
def initialize_plot(self, ranges=None, plots=[]): """ Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplots with correct options and styl...
def initialize_plot(self, ranges=None, plots=[]): """ Plot all the views contained in the AdjointLayout Object using axes appropriate to the layout configuration. All the axes are supplied by LayoutPlot - the purpose of the call is to invoke subplots with correct options and styl...
[ "Plot", "all", "the", "views", "contained", "in", "the", "AdjointLayout", "Object", "using", "axes", "appropriate", "to", "the", "layout", "configuration", ".", "All", "the", "axes", "are", "supplied", "by", "LayoutPlot", "-", "the", "purpose", "of", "the", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/plot.py#L1097-L1118
[ "def", "initialize_plot", "(", "self", ",", "ranges", "=", "None", ",", "plots", "=", "[", "]", ")", ":", "if", "plots", "is", "None", ":", "plots", "=", "[", "]", "adjoined_plots", "=", "[", "]", "for", "pos", "in", "self", ".", "view_positions", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.get_plot
Given a HoloViews Viewable return a corresponding plot instance. Allows supplying a document attach the plot to, useful when combining the bokeh model with another plot.
holoviews/plotting/bokeh/renderer.py
def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs): """ Given a HoloViews Viewable return a corresponding plot instance. Allows supplying a document attach the plot to, useful when combining the bokeh model with another plot. """ if doc is None: ...
def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs): """ Given a HoloViews Viewable return a corresponding plot instance. Allows supplying a document attach the plot to, useful when combining the bokeh model with another plot. """ if doc is None: ...
[ "Given", "a", "HoloViews", "Viewable", "return", "a", "corresponding", "plot", "instance", ".", "Allows", "supplying", "a", "document", "attach", "the", "plot", "to", "useful", "when", "combining", "the", "bokeh", "model", "with", "another", "plot", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L123-L137
[ "def", "get_plot", "(", "self_or_cls", ",", "obj", ",", "doc", "=", "None", ",", "renderer", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "doc", "is", "None", ":", "doc", "=", "Document", "(", ")", "if", "self_or_cls", ".", "notebook_context...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.app
Creates a bokeh app from a HoloViews object or plot. By default simply attaches the plot to bokeh's curdoc and returns the Document, if show option is supplied creates an Application instance and displays it either in a browser window or inline if notebook extension has been loaded. Usi...
holoviews/plotting/bokeh/renderer.py
def app(self_or_cls, plot, show=False, new_window=False, websocket_origin=None, port=0): """ Creates a bokeh app from a HoloViews object or plot. By default simply attaches the plot to bokeh's curdoc and returns the Document, if show option is supplied creates an Application inst...
def app(self_or_cls, plot, show=False, new_window=False, websocket_origin=None, port=0): """ Creates a bokeh app from a HoloViews object or plot. By default simply attaches the plot to bokeh's curdoc and returns the Document, if show option is supplied creates an Application inst...
[ "Creates", "a", "bokeh", "app", "from", "a", "HoloViews", "object", "or", "plot", ".", "By", "default", "simply", "attaches", "the", "plot", "to", "bokeh", "s", "curdoc", "and", "returns", "the", "Document", "if", "show", "option", "is", "supplied", "creat...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L151-L214
[ "def", "app", "(", "self_or_cls", ",", "plot", ",", "show", "=", "False", ",", "new_window", "=", "False", ",", "websocket_origin", "=", "None", ",", "port", "=", "0", ")", ":", "if", "not", "isinstance", "(", "self_or_cls", ",", "BokehRenderer", ")", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.server_doc
Get a bokeh Document with the plot attached. May supply an existing doc, otherwise bokeh.io.curdoc() is used to attach the plot to the global document instance.
holoviews/plotting/bokeh/renderer.py
def server_doc(self_or_cls, obj, doc=None): """ Get a bokeh Document with the plot attached. May supply an existing doc, otherwise bokeh.io.curdoc() is used to attach the plot to the global document instance. """ if not isinstance(obj, (Plot, BokehServerWidgets)): ...
def server_doc(self_or_cls, obj, doc=None): """ Get a bokeh Document with the plot attached. May supply an existing doc, otherwise bokeh.io.curdoc() is used to attach the plot to the global document instance. """ if not isinstance(obj, (Plot, BokehServerWidgets)): ...
[ "Get", "a", "bokeh", "Document", "with", "the", "plot", "attached", ".", "May", "supply", "an", "existing", "doc", "otherwise", "bokeh", ".", "io", ".", "curdoc", "()", "is", "used", "to", "attach", "the", "plot", "to", "the", "global", "document", "inst...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L218-L244
[ "def", "server_doc", "(", "self_or_cls", ",", "obj", ",", "doc", "=", "None", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "(", "Plot", ",", "BokehServerWidgets", ")", ")", ":", "if", "not", "isinstance", "(", "self_or_cls", ",", "BokehRenderer"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer._figure_data
Given a plot instance, an output format and an optional bokeh document, return the corresponding data. If as_script is True, the content will be split in an HTML and a JS component.
holoviews/plotting/bokeh/renderer.py
def _figure_data(self, plot, fmt='html', doc=None, as_script=False, **kwargs): """ Given a plot instance, an output format and an optional bokeh document, return the corresponding data. If as_script is True, the content will be split in an HTML and a JS component. """ mod...
def _figure_data(self, plot, fmt='html', doc=None, as_script=False, **kwargs): """ Given a plot instance, an output format and an optional bokeh document, return the corresponding data. If as_script is True, the content will be split in an HTML and a JS component. """ mod...
[ "Given", "a", "plot", "instance", "an", "output", "format", "and", "an", "optional", "bokeh", "document", "return", "the", "corresponding", "data", ".", "If", "as_script", "is", "True", "the", "content", "will", "be", "split", "in", "an", "HTML", "and", "a...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L253-L303
[ "def", "_figure_data", "(", "self", ",", "plot", ",", "fmt", "=", "'html'", ",", "doc", "=", "None", ",", "as_script", "=", "False", ",", "*", "*", "kwargs", ")", ":", "model", "=", "plot", ".", "state", "if", "doc", "is", "None", ":", "doc", "="...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.diff
Returns a json diff required to update an existing plot with the latest plot data.
holoviews/plotting/bokeh/renderer.py
def diff(self, plot, binary=True): """ Returns a json diff required to update an existing plot with the latest plot data. """ events = list(plot.document._held_events) if not events: return None msg = Protocol("1.0").create("PATCH-DOC", events, use_buf...
def diff(self, plot, binary=True): """ Returns a json diff required to update an existing plot with the latest plot data. """ events = list(plot.document._held_events) if not events: return None msg = Protocol("1.0").create("PATCH-DOC", events, use_buf...
[ "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/bokeh/renderer.py#L306-L316
[ "def", "diff", "(", "self", ",", "plot", ",", "binary", "=", "True", ")", ":", "events", "=", "list", "(", "plot", ".", "document", ".", "_held_events", ")", "if", "not", "events", ":", "return", "None", "msg", "=", "Protocol", "(", "\"1.0\"", ")", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.plot_options
Given a holoviews object and a percentage size, apply heuristics to compute a suitable figure size. For instance, scaling layouts and grids linearly can result in unwieldy figure sizes when there are a large number of elements. As ad hoc heuristics are used, this functionality is kept se...
holoviews/plotting/bokeh/renderer.py
def plot_options(cls, obj, percent_size): """ Given a holoviews object and a percentage size, apply heuristics to compute a suitable figure size. For instance, scaling layouts and grids linearly can result in unwieldy figure sizes when there are a large number of elements. As ad ...
def plot_options(cls, obj, percent_size): """ Given a holoviews object and a percentage size, apply heuristics to compute a suitable figure size. For instance, scaling layouts and grids linearly can result in unwieldy figure sizes when there are a large number of elements. As ad ...
[ "Given", "a", "holoviews", "object", "and", "a", "percentage", "size", "apply", "heuristics", "to", "compute", "a", "suitable", "figure", "size", ".", "For", "instance", "scaling", "layouts", "and", "grids", "linearly", "can", "result", "in", "unwieldy", "figu...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L320-L345
[ "def", "plot_options", "(", "cls", ",", "obj", ",", "percent_size", ")", ":", "obj", "=", "obj", ".", "last", "if", "isinstance", "(", "obj", ",", "HoloMap", ")", "else", "obj", "plot", "=", "Store", ".", "registry", "[", "cls", ".", "backend", "]", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.get_size
Return the display size associated with a plot before rendering to any particular format. Used to generate appropriate HTML display. Returns a tuple of (width, height) in pixels.
holoviews/plotting/bokeh/renderer.py
def get_size(self_or_cls, plot): """ Return the display size associated with a plot before rendering to any particular format. Used to generate appropriate HTML display. Returns a tuple of (width, height) in pixels. """ if isinstance(plot, Plot): plot...
def get_size(self_or_cls, plot): """ Return the display size associated with a plot before rendering to any particular format. Used to generate appropriate HTML display. Returns a tuple of (width, height) in pixels. """ if isinstance(plot, Plot): plot...
[ "Return", "the", "display", "size", "associated", "with", "a", "plot", "before", "rendering", "to", "any", "particular", "format", ".", "Used", "to", "generate", "appropriate", "HTML", "display", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L349-L362
[ "def", "get_size", "(", "self_or_cls", ",", "plot", ")", ":", "if", "isinstance", "(", "plot", ",", "Plot", ")", ":", "plot", "=", "plot", ".", "state", "elif", "not", "isinstance", "(", "plot", ",", "Model", ")", ":", "raise", "ValueError", "(", "'C...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BokehRenderer.load_nb
Loads the bokeh notebook resources.
holoviews/plotting/bokeh/renderer.py
def load_nb(cls, inline=True): """ Loads the bokeh notebook resources. """ LOAD_MIME_TYPE = bokeh.io.notebook.LOAD_MIME_TYPE bokeh.io.notebook.LOAD_MIME_TYPE = MIME_TYPES['jlab-hv-load'] load_notebook(hide_banner=True, resources=INLINE if inline else CDN) bokeh.io...
def load_nb(cls, inline=True): """ Loads the bokeh notebook resources. """ LOAD_MIME_TYPE = bokeh.io.notebook.LOAD_MIME_TYPE bokeh.io.notebook.LOAD_MIME_TYPE = MIME_TYPES['jlab-hv-load'] load_notebook(hide_banner=True, resources=INLINE if inline else CDN) bokeh.io...
[ "Loads", "the", "bokeh", "notebook", "resources", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/renderer.py#L366-L374
[ "def", "load_nb", "(", "cls", ",", "inline", "=", "True", ")", ":", "LOAD_MIME_TYPE", "=", "bokeh", ".", "io", ".", "notebook", ".", "LOAD_MIME_TYPE", "bokeh", ".", "io", ".", "notebook", ".", "LOAD_MIME_TYPE", "=", "MIME_TYPES", "[", "'jlab-hv-load'", "]"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
merge_option_dicts
Update the old_opts option dictionary with the options defined in new_opts. Instead of a shallow update as would be performed by calling old_opts.update(new_opts), this updates the dictionaries of all option types separately. Given two dictionaries old_opts = {'a': {'x': 'old', 'y': 'old'}} ...
holoviews/core/util.py
def merge_option_dicts(old_opts, new_opts): """ Update the old_opts option dictionary with the options defined in new_opts. Instead of a shallow update as would be performed by calling old_opts.update(new_opts), this updates the dictionaries of all option types separately. Given two dictionarie...
def merge_option_dicts(old_opts, new_opts): """ Update the old_opts option dictionary with the options defined in new_opts. Instead of a shallow update as would be performed by calling old_opts.update(new_opts), this updates the dictionaries of all option types separately. Given two dictionarie...
[ "Update", "the", "old_opts", "option", "dictionary", "with", "the", "options", "defined", "in", "new_opts", ".", "Instead", "of", "a", "shallow", "update", "as", "would", "be", "performed", "by", "calling", "old_opts", ".", "update", "(", "new_opts", ")", "t...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L195-L217
[ "def", "merge_option_dicts", "(", "old_opts", ",", "new_opts", ")", ":", "merged", "=", "dict", "(", "old_opts", ")", "for", "option_type", ",", "options", "in", "new_opts", ".", "items", "(", ")", ":", "if", "option_type", "not", "in", "merged", ":", "m...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
merge_options_to_dict
Given a collection of Option objects or partial option dictionaries, merge everything to a single dictionary.
holoviews/core/util.py
def merge_options_to_dict(options): """ Given a collection of Option objects or partial option dictionaries, merge everything to a single dictionary. """ merged_options = {} for obj in options: if isinstance(obj,dict): new_opts = obj else: new_opts = {obj....
def merge_options_to_dict(options): """ Given a collection of Option objects or partial option dictionaries, merge everything to a single dictionary. """ merged_options = {} for obj in options: if isinstance(obj,dict): new_opts = obj else: new_opts = {obj....
[ "Given", "a", "collection", "of", "Option", "objects", "or", "partial", "option", "dictionaries", "merge", "everything", "to", "a", "single", "dictionary", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L220-L233
[ "def", "merge_options_to_dict", "(", "options", ")", ":", "merged_options", "=", "{", "}", "for", "obj", "in", "options", ":", "if", "isinstance", "(", "obj", ",", "dict", ")", ":", "new_opts", "=", "obj", "else", ":", "new_opts", "=", "{", "obj", ".",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
deprecated_opts_signature
Utility to help with the deprecation of the old .opts method signature Returns whether opts.apply_groups should be used (as a bool) and the corresponding options.
holoviews/core/util.py
def deprecated_opts_signature(args, kwargs): """ Utility to help with the deprecation of the old .opts method signature Returns whether opts.apply_groups should be used (as a bool) and the corresponding options. """ from .options import Options groups = set(Options._option_groups) opts ...
def deprecated_opts_signature(args, kwargs): """ Utility to help with the deprecation of the old .opts method signature Returns whether opts.apply_groups should be used (as a bool) and the corresponding options. """ from .options import Options groups = set(Options._option_groups) opts ...
[ "Utility", "to", "help", "with", "the", "deprecation", "of", "the", "old", ".", "opts", "method", "signature" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L236-L266
[ "def", "deprecated_opts_signature", "(", "args", ",", "kwargs", ")", ":", "from", ".", "options", "import", "Options", "groups", "=", "set", "(", "Options", ".", "_option_groups", ")", "opts", "=", "{", "kw", "for", "kw", "in", "kwargs", "if", "kw", "!="...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
deephash
Given an object, return a hash using HashableJSON. This hash is not architecture, Python version or platform independent.
holoviews/core/util.py
def deephash(obj): """ Given an object, return a hash using HashableJSON. This hash is not architecture, Python version or platform independent. """ try: return hash(json.dumps(obj, cls=HashableJSON, sort_keys=True)) except: return None
def deephash(obj): """ Given an object, return a hash using HashableJSON. This hash is not architecture, Python version or platform independent. """ try: return hash(json.dumps(obj, cls=HashableJSON, sort_keys=True)) except: return None
[ "Given", "an", "object", "return", "a", "hash", "using", "HashableJSON", ".", "This", "hash", "is", "not", "architecture", "Python", "version", "or", "platform", "independent", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L340-L348
[ "def", "deephash", "(", "obj", ")", ":", "try", ":", "return", "hash", "(", "json", ".", "dumps", "(", "obj", ",", "cls", "=", "HashableJSON", ",", "sort_keys", "=", "True", ")", ")", "except", ":", "return", "None" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
tree_attribute
Predicate that returns True for custom attributes added to AttrTrees that are not methods, properties or internal attributes. These custom attributes start with a capitalized character when applicable (not applicable to underscore or certain unicode characters)
holoviews/core/util.py
def tree_attribute(identifier): """ Predicate that returns True for custom attributes added to AttrTrees that are not methods, properties or internal attributes. These custom attributes start with a capitalized character when applicable (not applicable to underscore or certain unicode characters) ...
def tree_attribute(identifier): """ Predicate that returns True for custom attributes added to AttrTrees that are not methods, properties or internal attributes. These custom attributes start with a capitalized character when applicable (not applicable to underscore or certain unicode characters) ...
[ "Predicate", "that", "returns", "True", "for", "custom", "attributes", "added", "to", "AttrTrees", "that", "are", "not", "methods", "properties", "or", "internal", "attributes", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L351-L362
[ "def", "tree_attribute", "(", "identifier", ")", ":", "if", "identifier", "[", "0", "]", ".", "upper", "(", ")", ".", "isupper", "(", ")", "is", "False", "and", "identifier", "[", "0", "]", "!=", "'_'", ":", "return", "True", "else", ":", "return", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
argspec
Returns an ArgSpec object for functions, staticmethods, instance methods, classmethods and partials. Note that the args list for instance and class methods are those as seen by the user. In other words, the first argument which is conventionally called 'self' or 'cls' is omitted in these cases.
holoviews/core/util.py
def argspec(callable_obj): """ Returns an ArgSpec object for functions, staticmethods, instance methods, classmethods and partials. Note that the args list for instance and class methods are those as seen by the user. In other words, the first argument which is conventionally called 'self' or '...
def argspec(callable_obj): """ Returns an ArgSpec object for functions, staticmethods, instance methods, classmethods and partials. Note that the args list for instance and class methods are those as seen by the user. In other words, the first argument which is conventionally called 'self' or '...
[ "Returns", "an", "ArgSpec", "object", "for", "functions", "staticmethods", "instance", "methods", "classmethods", "and", "partials", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L364-L394
[ "def", "argspec", "(", "callable_obj", ")", ":", "if", "(", "isinstance", "(", "callable_obj", ",", "type", ")", "and", "issubclass", "(", "callable_obj", ",", "param", ".", "ParameterizedFunction", ")", ")", ":", "# Parameterized function.__call__ considered functi...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
validate_dynamic_argspec
Utility used by DynamicMap to ensure the supplied callback has an appropriate signature. If validation succeeds, returns a list of strings to be zipped with the positional arguments i.e kdim values. The zipped values can then be merged with the stream values to pass everything to the Callable as ke...
holoviews/core/util.py
def validate_dynamic_argspec(callback, kdims, streams): """ Utility used by DynamicMap to ensure the supplied callback has an appropriate signature. If validation succeeds, returns a list of strings to be zipped with the positional arguments i.e kdim values. The zipped values can then be merged...
def validate_dynamic_argspec(callback, kdims, streams): """ Utility used by DynamicMap to ensure the supplied callback has an appropriate signature. If validation succeeds, returns a list of strings to be zipped with the positional arguments i.e kdim values. The zipped values can then be merged...
[ "Utility", "used", "by", "DynamicMap", "to", "ensure", "the", "supplied", "callback", "has", "an", "appropriate", "signature", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L398-L463
[ "def", "validate_dynamic_argspec", "(", "callback", ",", "kdims", ",", "streams", ")", ":", "argspec", "=", "callback", ".", "argspec", "name", "=", "callback", ".", "name", "kdims", "=", "[", "kdim", ".", "name", "for", "kdim", "in", "kdims", "]", "stre...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
callable_name
Attempt to return a meaningful name identifying a callable or generator
holoviews/core/util.py
def callable_name(callable_obj): """ Attempt to return a meaningful name identifying a callable or generator """ try: if (isinstance(callable_obj, type) and issubclass(callable_obj, param.ParameterizedFunction)): return callable_obj.__name__ elif (isinstance(calla...
def callable_name(callable_obj): """ Attempt to return a meaningful name identifying a callable or generator """ try: if (isinstance(callable_obj, type) and issubclass(callable_obj, param.ParameterizedFunction)): return callable_obj.__name__ elif (isinstance(calla...
[ "Attempt", "to", "return", "a", "meaningful", "name", "identifying", "a", "callable", "or", "generator" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L466-L495
[ "def", "callable_name", "(", "callable_obj", ")", ":", "try", ":", "if", "(", "isinstance", "(", "callable_obj", ",", "type", ")", "and", "issubclass", "(", "callable_obj", ",", "param", ".", "ParameterizedFunction", ")", ")", ":", "return", "callable_obj", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
process_ellipses
Helper function to pad a __getitem__ key with the right number of empty slices (i.e :) when the key contains an Ellipsis (...). If the vdim_selection flag is true, check if the end of the key contains strings or Dimension objects in obj. If so, extra padding will not be applied for the value dimensions...
holoviews/core/util.py
def process_ellipses(obj, key, vdim_selection=False): """ Helper function to pad a __getitem__ key with the right number of empty slices (i.e :) when the key contains an Ellipsis (...). If the vdim_selection flag is true, check if the end of the key contains strings or Dimension objects in obj. If ...
def process_ellipses(obj, key, vdim_selection=False): """ Helper function to pad a __getitem__ key with the right number of empty slices (i.e :) when the key contains an Ellipsis (...). If the vdim_selection flag is true, check if the end of the key contains strings or Dimension objects in obj. If ...
[ "Helper", "function", "to", "pad", "a", "__getitem__", "key", "with", "the", "right", "number", "of", "empty", "slices", "(", "i", ".", "e", ":", ")", "when", "the", "key", "contains", "an", "Ellipsis", "(", "...", ")", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L498-L526
[ "def", "process_ellipses", "(", "obj", ",", "key", ",", "vdim_selection", "=", "False", ")", ":", "if", "isinstance", "(", "key", ",", "np", ".", "ndarray", ")", "and", "key", ".", "dtype", ".", "kind", "==", "'b'", ":", "return", "key", "wrapped_key",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
capitalize_unicode_name
Turns a string such as 'capital delta' into the shortened, capitalized version, in this case simply 'Delta'. Used as a transform in sanitize_identifier.
holoviews/core/util.py
def capitalize_unicode_name(s): """ Turns a string such as 'capital delta' into the shortened, capitalized version, in this case simply 'Delta'. Used as a transform in sanitize_identifier. """ index = s.find('capital') if index == -1: return s tail = s[index:].replace('capital', '').stri...
def capitalize_unicode_name(s): """ Turns a string such as 'capital delta' into the shortened, capitalized version, in this case simply 'Delta'. Used as a transform in sanitize_identifier. """ index = s.find('capital') if index == -1: return s tail = s[index:].replace('capital', '').stri...
[ "Turns", "a", "string", "such", "as", "capital", "delta", "into", "the", "shortened", "capitalized", "version", "in", "this", "case", "simply", "Delta", ".", "Used", "as", "a", "transform", "in", "sanitize_identifier", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L545-L555
[ "def", "capitalize_unicode_name", "(", "s", ")", ":", "index", "=", "s", ".", "find", "(", "'capital'", ")", "if", "index", "==", "-", "1", ":", "return", "s", "tail", "=", "s", "[", "index", ":", "]", ".", "replace", "(", "'capital'", ",", "''", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
asarray
Converts arraylike objects to NumPy ndarray types. Errors if object is not arraylike and strict option is enabled.
holoviews/core/util.py
def asarray(arraylike, strict=True): """ Converts arraylike objects to NumPy ndarray types. Errors if object is not arraylike and strict option is enabled. """ if isinstance(arraylike, np.ndarray): return arraylike elif isinstance(arraylike, list): return np.asarray(arraylike, dt...
def asarray(arraylike, strict=True): """ Converts arraylike objects to NumPy ndarray types. Errors if object is not arraylike and strict option is enabled. """ if isinstance(arraylike, np.ndarray): return arraylike elif isinstance(arraylike, list): return np.asarray(arraylike, dt...
[ "Converts", "arraylike", "objects", "to", "NumPy", "ndarray", "types", ".", "Errors", "if", "object", "is", "not", "arraylike", "and", "strict", "option", "is", "enabled", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L808-L823
[ "def", "asarray", "(", "arraylike", ",", "strict", "=", "True", ")", ":", "if", "isinstance", "(", "arraylike", ",", "np", ".", "ndarray", ")", ":", "return", "arraylike", "elif", "isinstance", "(", "arraylike", ",", "list", ")", ":", "return", "np", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
isnat
Checks if the value is a NaT. Should only be called on datetimelike objects.
holoviews/core/util.py
def isnat(val): """ Checks if the value is a NaT. Should only be called on datetimelike objects. """ if (isinstance(val, (np.datetime64, np.timedelta64)) or (isinstance(val, np.ndarray) and val.dtype.kind == 'M')): if numpy_version >= '1.13': return np.isnat(val) else...
def isnat(val): """ Checks if the value is a NaT. Should only be called on datetimelike objects. """ if (isinstance(val, (np.datetime64, np.timedelta64)) or (isinstance(val, np.ndarray) and val.dtype.kind == 'M')): if numpy_version >= '1.13': return np.isnat(val) else...
[ "Checks", "if", "the", "value", "is", "a", "NaT", ".", "Should", "only", "be", "called", "on", "datetimelike", "objects", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L828-L843
[ "def", "isnat", "(", "val", ")", ":", "if", "(", "isinstance", "(", "val", ",", "(", "np", ".", "datetime64", ",", "np", ".", "timedelta64", ")", ")", "or", "(", "isinstance", "(", "val", ",", "np", ".", "ndarray", ")", "and", "val", ".", "dtype"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
isfinite
Helper function to determine if scalar or array value is finite extending np.isfinite with support for None, string, datetime types.
holoviews/core/util.py
def isfinite(val): """ Helper function to determine if scalar or array value is finite extending np.isfinite with support for None, string, datetime types. """ if not np.isscalar(val): val = asarray(val, strict=False) if val is None: return False elif isinstance(val, np.ndar...
def isfinite(val): """ Helper function to determine if scalar or array value is finite extending np.isfinite with support for None, string, datetime types. """ if not np.isscalar(val): val = asarray(val, strict=False) if val is None: return False elif isinstance(val, np.ndar...
[ "Helper", "function", "to", "determine", "if", "scalar", "or", "array", "value", "is", "finite", "extending", "np", ".", "isfinite", "with", "support", "for", "None", "string", "datetime", "types", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L846-L868
[ "def", "isfinite", "(", "val", ")", ":", "if", "not", "np", ".", "isscalar", "(", "val", ")", ":", "val", "=", "asarray", "(", "val", ",", "strict", "=", "False", ")", "if", "val", "is", "None", ":", "return", "False", "elif", "isinstance", "(", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
isdatetime
Whether the array or scalar is recognized datetime type.
holoviews/core/util.py
def isdatetime(value): """ Whether the array or scalar is recognized datetime type. """ if isinstance(value, np.ndarray): return (value.dtype.kind == "M" or (value.dtype.kind == "O" and len(value) and isinstance(value[0], datetime_types))) else: retur...
def isdatetime(value): """ Whether the array or scalar is recognized datetime type. """ if isinstance(value, np.ndarray): return (value.dtype.kind == "M" or (value.dtype.kind == "O" and len(value) and isinstance(value[0], datetime_types))) else: retur...
[ "Whether", "the", "array", "or", "scalar", "is", "recognized", "datetime", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L871-L880
[ "def", "isdatetime", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "np", ".", "ndarray", ")", ":", "return", "(", "value", ".", "dtype", ".", "kind", "==", "\"M\"", "or", "(", "value", ".", "dtype", ".", "kind", "==", "\"O\"", "and...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
find_minmax
Takes (a1, a2) and (b1, b2) as input and returns (np.nanmin(a1, b1), np.nanmax(a2, b2)). Used to calculate min and max values of a number of items.
holoviews/core/util.py
def find_minmax(lims, olims): """ Takes (a1, a2) and (b1, b2) as input and returns (np.nanmin(a1, b1), np.nanmax(a2, b2)). Used to calculate min and max values of a number of items. """ try: limzip = zip(list(lims), list(olims), [np.nanmin, np.nanmax]) limits = tuple([float(fn([l...
def find_minmax(lims, olims): """ Takes (a1, a2) and (b1, b2) as input and returns (np.nanmin(a1, b1), np.nanmax(a2, b2)). Used to calculate min and max values of a number of items. """ try: limzip = zip(list(lims), list(olims), [np.nanmin, np.nanmax]) limits = tuple([float(fn([l...
[ "Takes", "(", "a1", "a2", ")", "and", "(", "b1", "b2", ")", "as", "input", "and", "returns", "(", "np", ".", "nanmin", "(", "a1", "b1", ")", "np", ".", "nanmax", "(", "a2", "b2", "))", ".", "Used", "to", "calculate", "min", "and", "max", "value...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L883-L894
[ "def", "find_minmax", "(", "lims", ",", "olims", ")", ":", "try", ":", "limzip", "=", "zip", "(", "list", "(", "lims", ")", ",", "list", "(", "olims", ")", ",", "[", "np", ".", "nanmin", ",", "np", ".", "nanmax", "]", ")", "limits", "=", "tuple...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
find_range
Safely finds either the numerical min and max of a set of values, falling back to the first and the last value in the sorted list of values.
holoviews/core/util.py
def find_range(values, soft_range=[]): """ Safely finds either the numerical min and max of a set of values, falling back to the first and the last value in the sorted list of values. """ try: values = np.array(values) values = np.squeeze(values) if len(values.shape) > 1 else val...
def find_range(values, soft_range=[]): """ Safely finds either the numerical min and max of a set of values, falling back to the first and the last value in the sorted list of values. """ try: values = np.array(values) values = np.squeeze(values) if len(values.shape) > 1 else val...
[ "Safely", "finds", "either", "the", "numerical", "min", "and", "max", "of", "a", "set", "of", "values", "falling", "back", "to", "the", "first", "and", "the", "last", "value", "in", "the", "sorted", "list", "of", "values", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L897-L916
[ "def", "find_range", "(", "values", ",", "soft_range", "=", "[", "]", ")", ":", "try", ":", "values", "=", "np", ".", "array", "(", "values", ")", "values", "=", "np", ".", "squeeze", "(", "values", ")", "if", "len", "(", "values", ".", "shape", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
max_range
Computes the maximal lower and upper bounds from a list bounds. Args: ranges (list of tuples): A list of range tuples combined (boolean, optional): Whether to combine bounds Whether range should be computed on lower and upper bound independently or both at once Returns: ...
holoviews/core/util.py
def max_range(ranges, combined=True): """ Computes the maximal lower and upper bounds from a list bounds. Args: ranges (list of tuples): A list of range tuples combined (boolean, optional): Whether to combine bounds Whether range should be computed on lower and upper bound ...
def max_range(ranges, combined=True): """ Computes the maximal lower and upper bounds from a list bounds. Args: ranges (list of tuples): A list of range tuples combined (boolean, optional): Whether to combine bounds Whether range should be computed on lower and upper bound ...
[ "Computes", "the", "maximal", "lower", "and", "upper", "bounds", "from", "a", "list", "bounds", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L919-L963
[ "def", "max_range", "(", "ranges", ",", "combined", "=", "True", ")", ":", "try", ":", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "filterwarnings", "(", "'ignore'", ",", "r'All-NaN (slice|axis) encountered'", ")", "values", "=",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
range_pad
Pads the range by a fraction of the interval
holoviews/core/util.py
def range_pad(lower, upper, padding=None, log=False): """ Pads the range by a fraction of the interval """ if padding is not None and not isinstance(padding, tuple): padding = (padding, padding) if is_number(lower) and is_number(upper) and padding is not None: if not isinstance(lower...
def range_pad(lower, upper, padding=None, log=False): """ Pads the range by a fraction of the interval """ if padding is not None and not isinstance(padding, tuple): padding = (padding, padding) if is_number(lower) and is_number(upper) and padding is not None: if not isinstance(lower...
[ "Pads", "the", "range", "by", "a", "fraction", "of", "the", "interval" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L966-L993
[ "def", "range_pad", "(", "lower", ",", "upper", ",", "padding", "=", "None", ",", "log", "=", "False", ")", ":", "if", "padding", "is", "not", "None", "and", "not", "isinstance", "(", "padding", ",", "tuple", ")", ":", "padding", "=", "(", "padding",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dimension_range
Computes the range along a dimension by combining the data range with the Dimension soft_range and range.
holoviews/core/util.py
def dimension_range(lower, upper, hard_range, soft_range, padding=None, log=False): """ Computes the range along a dimension by combining the data range with the Dimension soft_range and range. """ lower, upper = range_pad(lower, upper, padding, log) lower = max_range([(lower, None), (soft_range...
def dimension_range(lower, upper, hard_range, soft_range, padding=None, log=False): """ Computes the range along a dimension by combining the data range with the Dimension soft_range and range. """ lower, upper = range_pad(lower, upper, padding, log) lower = max_range([(lower, None), (soft_range...
[ "Computes", "the", "range", "along", "a", "dimension", "by", "combining", "the", "data", "range", "with", "the", "Dimension", "soft_range", "and", "range", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L996-L1007
[ "def", "dimension_range", "(", "lower", ",", "upper", ",", "hard_range", ",", "soft_range", ",", "padding", "=", "None", ",", "log", "=", "False", ")", ":", "lower", ",", "upper", "=", "range_pad", "(", "lower", ",", "upper", ",", "padding", ",", "log"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
max_extents
Computes the maximal extent in 2D and 3D space from list of 4-tuples or 6-tuples. If zrange is enabled all extents are converted to 6-tuples to compute x-, y- and z-limits.
holoviews/core/util.py
def max_extents(extents, zrange=False): """ Computes the maximal extent in 2D and 3D space from list of 4-tuples or 6-tuples. If zrange is enabled all extents are converted to 6-tuples to compute x-, y- and z-limits. """ if zrange: num = 6 inds = [(0, 3), (1, 4), (2, 5)] ...
def max_extents(extents, zrange=False): """ Computes the maximal extent in 2D and 3D space from list of 4-tuples or 6-tuples. If zrange is enabled all extents are converted to 6-tuples to compute x-, y- and z-limits. """ if zrange: num = 6 inds = [(0, 3), (1, 4), (2, 5)] ...
[ "Computes", "the", "maximal", "extent", "in", "2D", "and", "3D", "space", "from", "list", "of", "4", "-", "tuples", "or", "6", "-", "tuples", ".", "If", "zrange", "is", "enabled", "all", "extents", "are", "converted", "to", "6", "-", "tuples", "to", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1010-L1047
[ "def", "max_extents", "(", "extents", ",", "zrange", "=", "False", ")", ":", "if", "zrange", ":", "num", "=", "6", "inds", "=", "[", "(", "0", ",", "3", ")", ",", "(", "1", ",", "4", ")", ",", "(", "2", ",", "5", ")", "]", "extents", "=", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
int_to_alpha
Generates alphanumeric labels of form A-Z, AA-ZZ etc.
holoviews/core/util.py
def int_to_alpha(n, upper=True): "Generates alphanumeric labels of form A-Z, AA-ZZ etc." casenum = 65 if upper else 97 label = '' count= 0 if n == 0: return str(chr(n + casenum)) while n >= 0: mod, div = n % 26, n for _ in range(count): div //= 26 div %= 26 ...
def int_to_alpha(n, upper=True): "Generates alphanumeric labels of form A-Z, AA-ZZ etc." casenum = 65 if upper else 97 label = '' count= 0 if n == 0: return str(chr(n + casenum)) while n >= 0: mod, div = n % 26, n for _ in range(count): div //= 26 div %= 26 ...
[ "Generates", "alphanumeric", "labels", "of", "form", "A", "-", "Z", "AA", "-", "ZZ", "etc", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1050-L1068
[ "def", "int_to_alpha", "(", "n", ",", "upper", "=", "True", ")", ":", "casenum", "=", "65", "if", "upper", "else", "97", "label", "=", "''", "count", "=", "0", "if", "n", "==", "0", ":", "return", "str", "(", "chr", "(", "n", "+", "casenum", ")...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
unique_iterator
Returns an iterator containing all non-duplicate elements in the input sequence.
holoviews/core/util.py
def unique_iterator(seq): """ Returns an iterator containing all non-duplicate elements in the input sequence. """ seen = set() for item in seq: if item not in seen: seen.add(item) yield item
def unique_iterator(seq): """ Returns an iterator containing all non-duplicate elements in the input sequence. """ seen = set() for item in seq: if item not in seen: seen.add(item) yield item
[ "Returns", "an", "iterator", "containing", "all", "non", "-", "duplicate", "elements", "in", "the", "input", "sequence", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1086-L1095
[ "def", "unique_iterator", "(", "seq", ")", ":", "seen", "=", "set", "(", ")", "for", "item", "in", "seq", ":", "if", "item", "not", "in", "seen", ":", "seen", ".", "add", "(", "item", ")", "yield", "item" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
unique_array
Returns an array of unique values in the input order. Args: arr (np.ndarray or list): The array to compute unique values on Returns: A new array of unique values
holoviews/core/util.py
def unique_array(arr): """ Returns an array of unique values in the input order. Args: arr (np.ndarray or list): The array to compute unique values on Returns: A new array of unique values """ if not len(arr): return np.asarray(arr) elif pd: if isinstance(arr,...
def unique_array(arr): """ Returns an array of unique values in the input order. Args: arr (np.ndarray or list): The array to compute unique values on Returns: A new array of unique values """ if not len(arr): return np.asarray(arr) elif pd: if isinstance(arr,...
[ "Returns", "an", "array", "of", "unique", "values", "in", "the", "input", "order", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1098-L1125
[ "def", "unique_array", "(", "arr", ")", ":", "if", "not", "len", "(", "arr", ")", ":", "return", "np", ".", "asarray", "(", "arr", ")", "elif", "pd", ":", "if", "isinstance", "(", "arr", ",", "np", ".", "ndarray", ")", "and", "arr", ".", "dtype",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
match_spec
Matches the group.label specification of the supplied element against the supplied specification dictionary returning the value of the best match.
holoviews/core/util.py
def match_spec(element, specification): """ Matches the group.label specification of the supplied element against the supplied specification dictionary returning the value of the best match. """ match_tuple = () match = specification.get((), {}) for spec in [type(element).__name__, ...
def match_spec(element, specification): """ Matches the group.label specification of the supplied element against the supplied specification dictionary returning the value of the best match. """ match_tuple = () match = specification.get((), {}) for spec in [type(element).__name__, ...
[ "Matches", "the", "group", ".", "label", "specification", "of", "the", "supplied", "element", "against", "the", "supplied", "specification", "dictionary", "returning", "the", "value", "of", "the", "best", "match", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1128-L1142
[ "def", "match_spec", "(", "element", ",", "specification", ")", ":", "match_tuple", "=", "(", ")", "match", "=", "specification", ".", "get", "(", "(", ")", ",", "{", "}", ")", "for", "spec", "in", "[", "type", "(", "element", ")", ".", "__name__", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
merge_dimensions
Merges lists of fully or partially overlapping dimensions by merging their values. >>> from holoviews import Dimension >>> dim_list = [[Dimension('A', values=[1, 2, 3]), Dimension('B')], ... [Dimension('A', values=[2, 3, 4])]] >>> dimensions = merge_dimensions(dim_list) >>> dimensio...
holoviews/core/util.py
def merge_dimensions(dimensions_list): """ Merges lists of fully or partially overlapping dimensions by merging their values. >>> from holoviews import Dimension >>> dim_list = [[Dimension('A', values=[1, 2, 3]), Dimension('B')], ... [Dimension('A', values=[2, 3, 4])]] >>> dimen...
def merge_dimensions(dimensions_list): """ Merges lists of fully or partially overlapping dimensions by merging their values. >>> from holoviews import Dimension >>> dim_list = [[Dimension('A', values=[1, 2, 3]), Dimension('B')], ... [Dimension('A', values=[2, 3, 4])]] >>> dimen...
[ "Merges", "lists", "of", "fully", "or", "partially", "overlapping", "dimensions", "by", "merging", "their", "values", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1164-L1187
[ "def", "merge_dimensions", "(", "dimensions_list", ")", ":", "dvalues", "=", "defaultdict", "(", "list", ")", "dimensions", "=", "[", "]", "for", "dims", "in", "dimensions_list", ":", "for", "d", "in", "dims", ":", "dvalues", "[", "d", ".", "name", "]", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dimension_sort
Sorts data by key using usual Python tuple sorting semantics or sorts in categorical order for any categorical Dimensions.
holoviews/core/util.py
def dimension_sort(odict, kdims, vdims, key_index): """ Sorts data by key using usual Python tuple sorting semantics or sorts in categorical order for any categorical Dimensions. """ sortkws = {} ndims = len(kdims) dimensions = kdims+vdims indexes = [(dimensions[i], int(i not in range(nd...
def dimension_sort(odict, kdims, vdims, key_index): """ Sorts data by key using usual Python tuple sorting semantics or sorts in categorical order for any categorical Dimensions. """ sortkws = {} ndims = len(kdims) dimensions = kdims+vdims indexes = [(dimensions[i], int(i not in range(nd...
[ "Sorts", "data", "by", "key", "using", "usual", "Python", "tuple", "sorting", "semantics", "or", "sorts", "in", "categorical", "order", "for", "any", "categorical", "Dimensions", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1190-L1212
[ "def", "dimension_sort", "(", "odict", ",", "kdims", ",", "vdims", ",", "key_index", ")", ":", "sortkws", "=", "{", "}", "ndims", "=", "len", "(", "kdims", ")", "dimensions", "=", "kdims", "+", "vdims", "indexes", "=", "[", "(", "dimensions", "[", "i...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sort_topologically
Stackless topological sorting. graph = { 3: [1], 5: [3], 4: [2], 6: [4], } sort_topologically(graph) [[1, 2], [3, 4], [5, 6]]
holoviews/core/util.py
def sort_topologically(graph): """ Stackless topological sorting. graph = { 3: [1], 5: [3], 4: [2], 6: [4], } sort_topologically(graph) [[1, 2], [3, 4], [5, 6]] """ levels_by_name = {} names_by_level = defaultdict(list) def add_level_to_name(nam...
def sort_topologically(graph): """ Stackless topological sorting. graph = { 3: [1], 5: [3], 4: [2], 6: [4], } sort_topologically(graph) [[1, 2], [3, 4], [5, 6]] """ levels_by_name = {} names_by_level = defaultdict(list) def add_level_to_name(nam...
[ "Stackless", "topological", "sorting", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1246-L1296
[ "def", "sort_topologically", "(", "graph", ")", ":", "levels_by_name", "=", "{", "}", "names_by_level", "=", "defaultdict", "(", "list", ")", "def", "add_level_to_name", "(", "name", ",", "level", ")", ":", "levels_by_name", "[", "name", "]", "=", "level", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
is_cyclic
Return True if the directed graph g has a cycle. The directed graph should be represented as a dictionary mapping of edges for each node.
holoviews/core/util.py
def is_cyclic(graph): """ Return True if the directed graph g has a cycle. The directed graph should be represented as a dictionary mapping of edges for each node. """ path = set() def visit(vertex): path.add(vertex) for neighbour in graph.get(vertex, ()): if neighbo...
def is_cyclic(graph): """ Return True if the directed graph g has a cycle. The directed graph should be represented as a dictionary mapping of edges for each node. """ path = set() def visit(vertex): path.add(vertex) for neighbour in graph.get(vertex, ()): if neighbo...
[ "Return", "True", "if", "the", "directed", "graph", "g", "has", "a", "cycle", ".", "The", "directed", "graph", "should", "be", "represented", "as", "a", "dictionary", "mapping", "of", "edges", "for", "each", "node", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1299-L1314
[ "def", "is_cyclic", "(", "graph", ")", ":", "path", "=", "set", "(", ")", "def", "visit", "(", "vertex", ")", ":", "path", ".", "add", "(", "vertex", ")", "for", "neighbour", "in", "graph", ".", "get", "(", "vertex", ",", "(", ")", ")", ":", "i...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
one_to_one
Return True if graph contains only one to one mappings. The directed graph should be represented as a dictionary mapping of edges for each node. Nodes should be passed a simple list.
holoviews/core/util.py
def one_to_one(graph, nodes): """ Return True if graph contains only one to one mappings. The directed graph should be represented as a dictionary mapping of edges for each node. Nodes should be passed a simple list. """ edges = itertools.chain.from_iterable(graph.values()) return len(graph)...
def one_to_one(graph, nodes): """ Return True if graph contains only one to one mappings. The directed graph should be represented as a dictionary mapping of edges for each node. Nodes should be passed a simple list. """ edges = itertools.chain.from_iterable(graph.values()) return len(graph)...
[ "Return", "True", "if", "graph", "contains", "only", "one", "to", "one", "mappings", ".", "The", "directed", "graph", "should", "be", "represented", "as", "a", "dictionary", "mapping", "of", "edges", "for", "each", "node", ".", "Nodes", "should", "be", "pa...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1317-L1324
[ "def", "one_to_one", "(", "graph", ",", "nodes", ")", ":", "edges", "=", "itertools", ".", "chain", ".", "from_iterable", "(", "graph", ".", "values", "(", ")", ")", "return", "len", "(", "graph", ")", "==", "len", "(", "nodes", ")", "and", "len", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
get_overlay_spec
Gets the type.group.label + key spec from an Element in an Overlay.
holoviews/core/util.py
def get_overlay_spec(o, k, v): """ Gets the type.group.label + key spec from an Element in an Overlay. """ k = wrap_tuple(k) return ((type(v).__name__, v.group, v.label) + k if len(o.kdims) else (type(v).__name__,) + k)
def get_overlay_spec(o, k, v): """ Gets the type.group.label + key spec from an Element in an Overlay. """ k = wrap_tuple(k) return ((type(v).__name__, v.group, v.label) + k if len(o.kdims) else (type(v).__name__,) + k)
[ "Gets", "the", "type", ".", "group", ".", "label", "+", "key", "spec", "from", "an", "Element", "in", "an", "Overlay", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1327-L1333
[ "def", "get_overlay_spec", "(", "o", ",", "k", ",", "v", ")", ":", "k", "=", "wrap_tuple", "(", "k", ")", "return", "(", "(", "type", "(", "v", ")", ".", "__name__", ",", "v", ".", "group", ",", "v", ".", "label", ")", "+", "k", "if", "len", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
layer_sort
Find a global ordering for layers in a HoloMap of CompositeOverlay types.
holoviews/core/util.py
def layer_sort(hmap): """ Find a global ordering for layers in a HoloMap of CompositeOverlay types. """ orderings = {} for o in hmap: okeys = [get_overlay_spec(o, k, v) for k, v in o.data.items()] if len(okeys) == 1 and not okeys[0] in orderings: orderings[okeys[0]] = [] els...
def layer_sort(hmap): """ Find a global ordering for layers in a HoloMap of CompositeOverlay types. """ orderings = {} for o in hmap: okeys = [get_overlay_spec(o, k, v) for k, v in o.data.items()] if len(okeys) == 1 and not okeys[0] in orderings: orderings[okeys[0]] = [] els...
[ "Find", "a", "global", "ordering", "for", "layers", "in", "a", "HoloMap", "of", "CompositeOverlay", "types", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1336-L1348
[ "def", "layer_sort", "(", "hmap", ")", ":", "orderings", "=", "{", "}", "for", "o", "in", "hmap", ":", "okeys", "=", "[", "get_overlay_spec", "(", "o", ",", "k", ",", "v", ")", "for", "k", ",", "v", "in", "o", ".", "data", ".", "items", "(", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
layer_groups
Splits a global ordering of Layers into groups based on a slice of the spec. The grouping behavior can be modified by changing the length of spec the entries are grouped by.
holoviews/core/util.py
def layer_groups(ordering, length=2): """ Splits a global ordering of Layers into groups based on a slice of the spec. The grouping behavior can be modified by changing the length of spec the entries are grouped by. """ group_orderings = defaultdict(list) for el in ordering: group_orderings[...
def layer_groups(ordering, length=2): """ Splits a global ordering of Layers into groups based on a slice of the spec. The grouping behavior can be modified by changing the length of spec the entries are grouped by. """ group_orderings = defaultdict(list) for el in ordering: group_orderings[...
[ "Splits", "a", "global", "ordering", "of", "Layers", "into", "groups", "based", "on", "a", "slice", "of", "the", "spec", ".", "The", "grouping", "behavior", "can", "be", "modified", "by", "changing", "the", "length", "of", "spec", "the", "entries", "are", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1351-L1360
[ "def", "layer_groups", "(", "ordering", ",", "length", "=", "2", ")", ":", "group_orderings", "=", "defaultdict", "(", "list", ")", "for", "el", "in", "ordering", ":", "group_orderings", "[", "el", "[", ":", "length", "]", "]", ".", "append", "(", "el"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
group_select
Given a list of key tuples to select, groups them into sensible chunks to avoid duplicating indexing operations.
holoviews/core/util.py
def group_select(selects, length=None, depth=None): """ Given a list of key tuples to select, groups them into sensible chunks to avoid duplicating indexing operations. """ if length == None and depth == None: length = depth = len(selects[0]) getter = operator.itemgetter(depth-length) ...
def group_select(selects, length=None, depth=None): """ Given a list of key tuples to select, groups them into sensible chunks to avoid duplicating indexing operations. """ if length == None and depth == None: length = depth = len(selects[0]) getter = operator.itemgetter(depth-length) ...
[ "Given", "a", "list", "of", "key", "tuples", "to", "select", "groups", "them", "into", "sensible", "chunks", "to", "avoid", "duplicating", "indexing", "operations", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1363-L1378
[ "def", "group_select", "(", "selects", ",", "length", "=", "None", ",", "depth", "=", "None", ")", ":", "if", "length", "==", "None", "and", "depth", "==", "None", ":", "length", "=", "depth", "=", "len", "(", "selects", "[", "0", "]", ")", "getter...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
iterative_select
Takes the output of group_select selecting subgroups iteratively, avoiding duplicating select operations.
holoviews/core/util.py
def iterative_select(obj, dimensions, selects, depth=None): """ Takes the output of group_select selecting subgroups iteratively, avoiding duplicating select operations. """ ndims = len(dimensions) depth = depth if depth is not None else ndims items = [] if isinstance(selects, dict): ...
def iterative_select(obj, dimensions, selects, depth=None): """ Takes the output of group_select selecting subgroups iteratively, avoiding duplicating select operations. """ ndims = len(dimensions) depth = depth if depth is not None else ndims items = [] if isinstance(selects, dict): ...
[ "Takes", "the", "output", "of", "group_select", "selecting", "subgroups", "iteratively", "avoiding", "duplicating", "select", "operations", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1381-L1396
[ "def", "iterative_select", "(", "obj", ",", "dimensions", ",", "selects", ",", "depth", "=", "None", ")", ":", "ndims", "=", "len", "(", "dimensions", ")", "depth", "=", "depth", "if", "depth", "is", "not", "None", "else", "ndims", "items", "=", "[", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
find_file
Find a file given folder and filename. If the filename can be resolved directly returns otherwise walks the supplied folder.
holoviews/core/util.py
def find_file(folder, filename): """ Find a file given folder and filename. If the filename can be resolved directly returns otherwise walks the supplied folder. """ matches = [] if os.path.isabs(filename) and os.path.isfile(filename): return filename for root, _, filenames in os.wal...
def find_file(folder, filename): """ Find a file given folder and filename. If the filename can be resolved directly returns otherwise walks the supplied folder. """ matches = [] if os.path.isabs(filename) and os.path.isfile(filename): return filename for root, _, filenames in os.wal...
[ "Find", "a", "file", "given", "folder", "and", "filename", ".", "If", "the", "filename", "can", "be", "resolved", "directly", "returns", "otherwise", "walks", "the", "supplied", "folder", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1407-L1420
[ "def", "find_file", "(", "folder", ",", "filename", ")", ":", "matches", "=", "[", "]", "if", "os", ".", "path", ".", "isabs", "(", "filename", ")", "and", "os", ".", "path", ".", "isfile", "(", "filename", ")", ":", "return", "filename", "for", "r...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
is_dataframe
Checks whether the supplied data is of DataFrame type.
holoviews/core/util.py
def is_dataframe(data): """ Checks whether the supplied data is of DataFrame type. """ dd = None if 'dask' in sys.modules and 'pandas' in sys.modules: import dask.dataframe as dd return((pd is not None and isinstance(data, pd.DataFrame)) or (dd is not None and isinstance(data, ...
def is_dataframe(data): """ Checks whether the supplied data is of DataFrame type. """ dd = None if 'dask' in sys.modules and 'pandas' in sys.modules: import dask.dataframe as dd return((pd is not None and isinstance(data, pd.DataFrame)) or (dd is not None and isinstance(data, ...
[ "Checks", "whether", "the", "supplied", "data", "is", "of", "DataFrame", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1423-L1431
[ "def", "is_dataframe", "(", "data", ")", ":", "dd", "=", "None", "if", "'dask'", "in", "sys", ".", "modules", "and", "'pandas'", "in", "sys", ".", "modules", ":", "import", "dask", ".", "dataframe", "as", "dd", "return", "(", "(", "pd", "is", "not", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
is_series
Checks whether the supplied data is of Series type.
holoviews/core/util.py
def is_series(data): """ Checks whether the supplied data is of Series type. """ dd = None if 'dask' in sys.modules: import dask.dataframe as dd return((pd is not None and isinstance(data, pd.Series)) or (dd is not None and isinstance(data, dd.Series)))
def is_series(data): """ Checks whether the supplied data is of Series type. """ dd = None if 'dask' in sys.modules: import dask.dataframe as dd return((pd is not None and isinstance(data, pd.Series)) or (dd is not None and isinstance(data, dd.Series)))
[ "Checks", "whether", "the", "supplied", "data", "is", "of", "Series", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1434-L1442
[ "def", "is_series", "(", "data", ")", ":", "dd", "=", "None", "if", "'dask'", "in", "sys", ".", "modules", ":", "import", "dask", ".", "dataframe", "as", "dd", "return", "(", "(", "pd", "is", "not", "None", "and", "isinstance", "(", "data", ",", "p...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
is_param_method
Whether the object is a method on a parameterized object. Args: obj: Object to check has_deps (boolean, optional): Check for dependencies Whether to also check whether the method has been annotated with param.depends Returns: A boolean value indicating whether the obje...
holoviews/core/util.py
def is_param_method(obj, has_deps=False): """Whether the object is a method on a parameterized object. Args: obj: Object to check has_deps (boolean, optional): Check for dependencies Whether to also check whether the method has been annotated with param.depends Returns: ...
def is_param_method(obj, has_deps=False): """Whether the object is a method on a parameterized object. Args: obj: Object to check has_deps (boolean, optional): Check for dependencies Whether to also check whether the method has been annotated with param.depends Returns: ...
[ "Whether", "the", "object", "is", "a", "method", "on", "a", "parameterized", "object", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1454-L1472
[ "def", "is_param_method", "(", "obj", ",", "has_deps", "=", "False", ")", ":", "parameterized", "=", "(", "inspect", ".", "ismethod", "(", "obj", ")", "and", "isinstance", "(", "get_method_owner", "(", "obj", ")", ",", "param", ".", "Parameterized", ")", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
disable_constant
Temporarily set parameters on Parameterized object to constant=False.
holoviews/core/util.py
def disable_constant(parameterized): """ Temporarily set parameters on Parameterized object to constant=False. """ params = parameterized.params().values() constants = [p.constant for p in params] for p in params: p.constant = False try: yield except: raise ...
def disable_constant(parameterized): """ Temporarily set parameters on Parameterized object to constant=False. """ params = parameterized.params().values() constants = [p.constant for p in params] for p in params: p.constant = False try: yield except: raise ...
[ "Temporarily", "set", "parameters", "on", "Parameterized", "object", "to", "constant", "=", "False", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1476-L1491
[ "def", "disable_constant", "(", "parameterized", ")", ":", "params", "=", "parameterized", ".", "params", "(", ")", ".", "values", "(", ")", "constants", "=", "[", "p", ".", "constant", "for", "p", "in", "params", "]", "for", "p", "in", "params", ":", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
get_ndmapping_label
Function to get the first non-auxiliary object label attribute from an NdMapping.
holoviews/core/util.py
def get_ndmapping_label(ndmapping, attr): """ Function to get the first non-auxiliary object label attribute from an NdMapping. """ label = None els = itervalues(ndmapping.data) while label is None: try: el = next(els) except StopIteration: return None...
def get_ndmapping_label(ndmapping, attr): """ Function to get the first non-auxiliary object label attribute from an NdMapping. """ label = None els = itervalues(ndmapping.data) while label is None: try: el = next(els) except StopIteration: return None...
[ "Function", "to", "get", "the", "first", "non", "-", "auxiliary", "object", "label", "attribute", "from", "an", "NdMapping", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1494-L1512
[ "def", "get_ndmapping_label", "(", "ndmapping", ",", "attr", ")", ":", "label", "=", "None", "els", "=", "itervalues", "(", "ndmapping", ".", "data", ")", "while", "label", "is", "None", ":", "try", ":", "el", "=", "next", "(", "els", ")", "except", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
stream_name_mapping
Return a complete dictionary mapping between stream parameter names to their applicable renames, excluding parameters listed in exclude_params. If reverse is True, the mapping is from the renamed strings to the original stream parameter names.
holoviews/core/util.py
def stream_name_mapping(stream, exclude_params=['name'], reverse=False): """ Return a complete dictionary mapping between stream parameter names to their applicable renames, excluding parameters listed in exclude_params. If reverse is True, the mapping is from the renamed strings to the origina...
def stream_name_mapping(stream, exclude_params=['name'], reverse=False): """ Return a complete dictionary mapping between stream parameter names to their applicable renames, excluding parameters listed in exclude_params. If reverse is True, the mapping is from the renamed strings to the origina...
[ "Return", "a", "complete", "dictionary", "mapping", "between", "stream", "parameter", "names", "to", "their", "applicable", "renames", "excluding", "parameters", "listed", "in", "exclude_params", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1520-L1534
[ "def", "stream_name_mapping", "(", "stream", ",", "exclude_params", "=", "[", "'name'", "]", ",", "reverse", "=", "False", ")", ":", "filtered", "=", "[", "k", "for", "k", "in", "stream", ".", "params", "(", ")", ".", "keys", "(", ")", "if", "k", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
rename_stream_kwargs
Given a stream and a kwargs dictionary of parameter values, map to the corresponding dictionary where the keys are substituted with the appropriately renamed string. If reverse, the output will be a dictionary using the original parameter names given a dictionary using the renamed equivalents.
holoviews/core/util.py
def rename_stream_kwargs(stream, kwargs, reverse=False): """ Given a stream and a kwargs dictionary of parameter values, map to the corresponding dictionary where the keys are substituted with the appropriately renamed string. If reverse, the output will be a dictionary using the original param...
def rename_stream_kwargs(stream, kwargs, reverse=False): """ Given a stream and a kwargs dictionary of parameter values, map to the corresponding dictionary where the keys are substituted with the appropriately renamed string. If reverse, the output will be a dictionary using the original param...
[ "Given", "a", "stream", "and", "a", "kwargs", "dictionary", "of", "parameter", "values", "map", "to", "the", "corresponding", "dictionary", "where", "the", "keys", "are", "substituted", "with", "the", "appropriately", "renamed", "string", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1536-L1553
[ "def", "rename_stream_kwargs", "(", "stream", ",", "kwargs", ",", "reverse", "=", "False", ")", ":", "mapped_kwargs", "=", "{", "}", "mapping", "=", "stream_name_mapping", "(", "stream", ",", "reverse", "=", "reverse", ")", "for", "k", ",", "v", "in", "k...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
stream_parameters
Given a list of streams, return a flat list of parameter name, excluding those listed in the exclude list. If no_duplicates is enabled, a KeyError will be raised if there are parameter name clashes across the streams.
holoviews/core/util.py
def stream_parameters(streams, no_duplicates=True, exclude=['name']): """ Given a list of streams, return a flat list of parameter name, excluding those listed in the exclude list. If no_duplicates is enabled, a KeyError will be raised if there are parameter name clashes across the streams. """...
def stream_parameters(streams, no_duplicates=True, exclude=['name']): """ Given a list of streams, return a flat list of parameter name, excluding those listed in the exclude list. If no_duplicates is enabled, a KeyError will be raised if there are parameter name clashes across the streams. """...
[ "Given", "a", "list", "of", "streams", "return", "a", "flat", "list", "of", "parameter", "name", "excluding", "those", "listed", "in", "the", "exclude", "list", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1556-L1584
[ "def", "stream_parameters", "(", "streams", ",", "no_duplicates", "=", "True", ",", "exclude", "=", "[", "'name'", "]", ")", ":", "param_groups", "=", "[", "]", "for", "s", "in", "streams", ":", "if", "not", "s", ".", "contents", "and", "isinstance", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dimensionless_contents
Return a list of stream parameters that have not been associated with any of the key dimensions.
holoviews/core/util.py
def dimensionless_contents(streams, kdims, no_duplicates=True): """ Return a list of stream parameters that have not been associated with any of the key dimensions. """ names = stream_parameters(streams, no_duplicates) return [name for name in names if name not in kdims]
def dimensionless_contents(streams, kdims, no_duplicates=True): """ Return a list of stream parameters that have not been associated with any of the key dimensions. """ names = stream_parameters(streams, no_duplicates) return [name for name in names if name not in kdims]
[ "Return", "a", "list", "of", "stream", "parameters", "that", "have", "not", "been", "associated", "with", "any", "of", "the", "key", "dimensions", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1587-L1593
[ "def", "dimensionless_contents", "(", "streams", ",", "kdims", ",", "no_duplicates", "=", "True", ")", ":", "names", "=", "stream_parameters", "(", "streams", ",", "no_duplicates", ")", "return", "[", "name", "for", "name", "in", "names", "if", "name", "not"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
unbound_dimensions
Return a list of dimensions that have not been associated with any streams.
holoviews/core/util.py
def unbound_dimensions(streams, kdims, no_duplicates=True): """ Return a list of dimensions that have not been associated with any streams. """ params = stream_parameters(streams, no_duplicates) return [d for d in kdims if d not in params]
def unbound_dimensions(streams, kdims, no_duplicates=True): """ Return a list of dimensions that have not been associated with any streams. """ params = stream_parameters(streams, no_duplicates) return [d for d in kdims if d not in params]
[ "Return", "a", "list", "of", "dimensions", "that", "have", "not", "been", "associated", "with", "any", "streams", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1596-L1602
[ "def", "unbound_dimensions", "(", "streams", ",", "kdims", ",", "no_duplicates", "=", "True", ")", ":", "params", "=", "stream_parameters", "(", "streams", ",", "no_duplicates", ")", "return", "[", "d", "for", "d", "in", "kdims", "if", "d", "not", "in", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
wrap_tuple_streams
Fills in tuple keys with dimensioned stream values as appropriate.
holoviews/core/util.py
def wrap_tuple_streams(unwrapped, kdims, streams): """ Fills in tuple keys with dimensioned stream values as appropriate. """ param_groups = [(s.contents.keys(), s) for s in streams] pairs = [(name,s) for (group, s) in param_groups for name in group] substituted = [] for pos,el in enumerate...
def wrap_tuple_streams(unwrapped, kdims, streams): """ Fills in tuple keys with dimensioned stream values as appropriate. """ param_groups = [(s.contents.keys(), s) for s in streams] pairs = [(name,s) for (group, s) in param_groups for name in group] substituted = [] for pos,el in enumerate...
[ "Fills", "in", "tuple", "keys", "with", "dimensioned", "stream", "values", "as", "appropriate", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1605-L1619
[ "def", "wrap_tuple_streams", "(", "unwrapped", ",", "kdims", ",", "streams", ")", ":", "param_groups", "=", "[", "(", "s", ".", "contents", ".", "keys", "(", ")", ",", "s", ")", "for", "s", "in", "streams", "]", "pairs", "=", "[", "(", "name", ",",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
drop_streams
Drop any dimensioned streams from the keys and kdims.
holoviews/core/util.py
def drop_streams(streams, kdims, keys): """ Drop any dimensioned streams from the keys and kdims. """ stream_params = stream_parameters(streams) inds, dims = zip(*[(ind, kdim) for ind, kdim in enumerate(kdims) if kdim not in stream_params]) get = operator.itemgetter(*inds)...
def drop_streams(streams, kdims, keys): """ Drop any dimensioned streams from the keys and kdims. """ stream_params = stream_parameters(streams) inds, dims = zip(*[(ind, kdim) for ind, kdim in enumerate(kdims) if kdim not in stream_params]) get = operator.itemgetter(*inds)...
[ "Drop", "any", "dimensioned", "streams", "from", "the", "keys", "and", "kdims", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1622-L1631
[ "def", "drop_streams", "(", "streams", ",", "kdims", ",", "keys", ")", ":", "stream_params", "=", "stream_parameters", "(", "streams", ")", "inds", ",", "dims", "=", "zip", "(", "*", "[", "(", "ind", ",", "kdim", ")", "for", "ind", ",", "kdim", "in",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
itervalues
Get value iterator from dictionary for Python 2 and 3
holoviews/core/util.py
def itervalues(obj): "Get value iterator from dictionary for Python 2 and 3" return iter(obj.values()) if sys.version_info.major == 3 else obj.itervalues()
def itervalues(obj): "Get value iterator from dictionary for Python 2 and 3" return iter(obj.values()) if sys.version_info.major == 3 else obj.itervalues()
[ "Get", "value", "iterator", "from", "dictionary", "for", "Python", "2", "and", "3" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1634-L1636
[ "def", "itervalues", "(", "obj", ")", ":", "return", "iter", "(", "obj", ".", "values", "(", ")", ")", "if", "sys", ".", "version_info", ".", "major", "==", "3", "else", "obj", ".", "itervalues", "(", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
iterkeys
Get key iterator from dictionary for Python 2 and 3
holoviews/core/util.py
def iterkeys(obj): "Get key iterator from dictionary for Python 2 and 3" return iter(obj.keys()) if sys.version_info.major == 3 else obj.iterkeys()
def iterkeys(obj): "Get key iterator from dictionary for Python 2 and 3" return iter(obj.keys()) if sys.version_info.major == 3 else obj.iterkeys()
[ "Get", "key", "iterator", "from", "dictionary", "for", "Python", "2", "and", "3" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1639-L1641
[ "def", "iterkeys", "(", "obj", ")", ":", "return", "iter", "(", "obj", ".", "keys", "(", ")", ")", "if", "sys", ".", "version_info", ".", "major", "==", "3", "else", "obj", ".", "iterkeys", "(", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
get_path
Gets a path from an Labelled object or from a tuple of an existing path and a labelled object. The path strings are sanitized and capitalized.
holoviews/core/util.py
def get_path(item): """ Gets a path from an Labelled object or from a tuple of an existing path and a labelled object. The path strings are sanitized and capitalized. """ sanitizers = [group_sanitizer, label_sanitizer] if isinstance(item, tuple): path, item = item if item.lab...
def get_path(item): """ Gets a path from an Labelled object or from a tuple of an existing path and a labelled object. The path strings are sanitized and capitalized. """ sanitizers = [group_sanitizer, label_sanitizer] if isinstance(item, tuple): path, item = item if item.lab...
[ "Gets", "a", "path", "from", "an", "Labelled", "object", "or", "from", "a", "tuple", "of", "an", "existing", "path", "and", "a", "labelled", "object", ".", "The", "path", "strings", "are", "sanitized", "and", "capitalized", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1668-L1686
[ "def", "get_path", "(", "item", ")", ":", "sanitizers", "=", "[", "group_sanitizer", ",", "label_sanitizer", "]", "if", "isinstance", "(", "item", ",", "tuple", ")", ":", "path", ",", "item", "=", "item", "if", "item", ".", "label", ":", "if", "len", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
make_path_unique
Given a path, a list of existing paths and counts for each of the existing paths.
holoviews/core/util.py
def make_path_unique(path, counts, new): """ Given a path, a list of existing paths and counts for each of the existing paths. """ added = False while any(path == c[:i] for c in counts for i in range(1, len(c)+1)): count = counts[path] counts[path] += 1 if (not new and le...
def make_path_unique(path, counts, new): """ Given a path, a list of existing paths and counts for each of the existing paths. """ added = False while any(path == c[:i] for c in counts for i in range(1, len(c)+1)): count = counts[path] counts[path] += 1 if (not new and le...
[ "Given", "a", "path", "a", "list", "of", "existing", "paths", "and", "counts", "for", "each", "of", "the", "existing", "paths", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1689-L1707
[ "def", "make_path_unique", "(", "path", ",", "counts", ",", "new", ")", ":", "added", "=", "False", "while", "any", "(", "path", "==", "c", "[", ":", "i", "]", "for", "c", "in", "counts", "for", "i", "in", "range", "(", "1", ",", "len", "(", "c...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
cartesian_product
Efficient cartesian product of a list of 1D arrays returning the expanded array views for each dimensions. By default arrays are flattened, which may be controlled with the flat flag. The array views can be turned into regular arrays with the copy flag.
holoviews/core/util.py
def cartesian_product(arrays, flat=True, copy=False): """ Efficient cartesian product of a list of 1D arrays returning the expanded array views for each dimensions. By default arrays are flattened, which may be controlled with the flat flag. The array views can be turned into regular arrays with the...
def cartesian_product(arrays, flat=True, copy=False): """ Efficient cartesian product of a list of 1D arrays returning the expanded array views for each dimensions. By default arrays are flattened, which may be controlled with the flat flag. The array views can be turned into regular arrays with the...
[ "Efficient", "cartesian", "product", "of", "a", "list", "of", "1D", "arrays", "returning", "the", "expanded", "array", "views", "for", "each", "dimensions", ".", "By", "default", "arrays", "are", "flattened", "which", "may", "be", "controlled", "with", "the", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1763-L1773
[ "def", "cartesian_product", "(", "arrays", ",", "flat", "=", "True", ",", "copy", "=", "False", ")", ":", "arrays", "=", "np", ".", "broadcast_arrays", "(", "*", "np", ".", "ix_", "(", "*", "arrays", ")", ")", "if", "flat", ":", "return", "tuple", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
cross_index
Allows efficiently indexing into a cartesian product without expanding it. The values should be defined as a list of iterables making up the cartesian product and a linear index, returning the cross product of the values at the supplied index.
holoviews/core/util.py
def cross_index(values, index): """ Allows efficiently indexing into a cartesian product without expanding it. The values should be defined as a list of iterables making up the cartesian product and a linear index, returning the cross product of the values at the supplied index. """ lengths ...
def cross_index(values, index): """ Allows efficiently indexing into a cartesian product without expanding it. The values should be defined as a list of iterables making up the cartesian product and a linear index, returning the cross product of the values at the supplied index. """ lengths ...
[ "Allows", "efficiently", "indexing", "into", "a", "cartesian", "product", "without", "expanding", "it", ".", "The", "values", "should", "be", "defined", "as", "a", "list", "of", "iterables", "making", "up", "the", "cartesian", "product", "and", "a", "linear", ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1776-L1794
[ "def", "cross_index", "(", "values", ",", "index", ")", ":", "lengths", "=", "[", "len", "(", "v", ")", "for", "v", "in", "values", "]", "length", "=", "np", ".", "product", "(", "lengths", ")", "if", "index", ">=", "length", ":", "raise", "IndexEr...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
arglexsort
Returns the indices of the lexicographical sorting order of the supplied arrays.
holoviews/core/util.py
def arglexsort(arrays): """ Returns the indices of the lexicographical sorting order of the supplied arrays. """ dtypes = ','.join(array.dtype.str for array in arrays) recarray = np.empty(len(arrays[0]), dtype=dtypes) for i, array in enumerate(arrays): recarray['f%s' % i] = array ...
def arglexsort(arrays): """ Returns the indices of the lexicographical sorting order of the supplied arrays. """ dtypes = ','.join(array.dtype.str for array in arrays) recarray = np.empty(len(arrays[0]), dtype=dtypes) for i, array in enumerate(arrays): recarray['f%s' % i] = array ...
[ "Returns", "the", "indices", "of", "the", "lexicographical", "sorting", "order", "of", "the", "supplied", "arrays", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1797-L1806
[ "def", "arglexsort", "(", "arrays", ")", ":", "dtypes", "=", "','", ".", "join", "(", "array", ".", "dtype", ".", "str", "for", "array", "in", "arrays", ")", "recarray", "=", "np", ".", "empty", "(", "len", "(", "arrays", "[", "0", "]", ")", ",",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dimensioned_streams
Given a DynamicMap return all streams that have any dimensioned parameters i.e parameters also listed in the key dimensions.
holoviews/core/util.py
def dimensioned_streams(dmap): """ Given a DynamicMap return all streams that have any dimensioned parameters i.e parameters also listed in the key dimensions. """ dimensioned = [] for stream in dmap.streams: stream_params = stream_parameters([stream]) if set([str(k) for k in dma...
def dimensioned_streams(dmap): """ Given a DynamicMap return all streams that have any dimensioned parameters i.e parameters also listed in the key dimensions. """ dimensioned = [] for stream in dmap.streams: stream_params = stream_parameters([stream]) if set([str(k) for k in dma...
[ "Given", "a", "DynamicMap", "return", "all", "streams", "that", "have", "any", "dimensioned", "parameters", "i", ".", "e", "parameters", "also", "listed", "in", "the", "key", "dimensions", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1809-L1819
[ "def", "dimensioned_streams", "(", "dmap", ")", ":", "dimensioned", "=", "[", "]", "for", "stream", "in", "dmap", ".", "streams", ":", "stream_params", "=", "stream_parameters", "(", "[", "stream", "]", ")", "if", "set", "(", "[", "str", "(", "k", ")",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
expand_grid_coords
Expand the coordinates along a dimension of the gridded dataset into an ND-array matching the dimensionality of the dataset.
holoviews/core/util.py
def expand_grid_coords(dataset, dim): """ Expand the coordinates along a dimension of the gridded dataset into an ND-array matching the dimensionality of the dataset. """ arrays = [dataset.interface.coords(dataset, d.name, True) for d in dataset.kdims] idx = dataset.get_dimensi...
def expand_grid_coords(dataset, dim): """ Expand the coordinates along a dimension of the gridded dataset into an ND-array matching the dimensionality of the dataset. """ arrays = [dataset.interface.coords(dataset, d.name, True) for d in dataset.kdims] idx = dataset.get_dimensi...
[ "Expand", "the", "coordinates", "along", "a", "dimension", "of", "the", "gridded", "dataset", "into", "an", "ND", "-", "array", "matching", "the", "dimensionality", "of", "the", "dataset", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1822-L1831
[ "def", "expand_grid_coords", "(", "dataset", ",", "dim", ")", ":", "arrays", "=", "[", "dataset", ".", "interface", ".", "coords", "(", "dataset", ",", "d", ".", "name", ",", "True", ")", "for", "d", "in", "dataset", ".", "kdims", "]", "idx", "=", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dt64_to_dt
Safely converts NumPy datetime64 to a datetime object.
holoviews/core/util.py
def dt64_to_dt(dt64): """ Safely converts NumPy datetime64 to a datetime object. """ ts = (dt64 - np.datetime64('1970-01-01T00:00:00')) / np.timedelta64(1, 's') return dt.datetime.utcfromtimestamp(ts)
def dt64_to_dt(dt64): """ Safely converts NumPy datetime64 to a datetime object. """ ts = (dt64 - np.datetime64('1970-01-01T00:00:00')) / np.timedelta64(1, 's') return dt.datetime.utcfromtimestamp(ts)
[ "Safely", "converts", "NumPy", "datetime64", "to", "a", "datetime", "object", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1834-L1839
[ "def", "dt64_to_dt", "(", "dt64", ")", ":", "ts", "=", "(", "dt64", "-", "np", ".", "datetime64", "(", "'1970-01-01T00:00:00'", ")", ")", "/", "np", ".", "timedelta64", "(", "1", ",", "'s'", ")", "return", "dt", ".", "datetime", ".", "utcfromtimestamp"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
bound_range
Computes a bounding range and density from a number of samples assumed to be evenly spaced. Density is rounded to machine precision using significant digits reported by sys.float_info.dig.
holoviews/core/util.py
def bound_range(vals, density, time_unit='us'): """ Computes a bounding range and density from a number of samples assumed to be evenly spaced. Density is rounded to machine precision using significant digits reported by sys.float_info.dig. """ if not len(vals): return(np.nan, np.nan, de...
def bound_range(vals, density, time_unit='us'): """ Computes a bounding range and density from a number of samples assumed to be evenly spaced. Density is rounded to machine precision using significant digits reported by sys.float_info.dig. """ if not len(vals): return(np.nan, np.nan, de...
[ "Computes", "a", "bounding", "range", "and", "density", "from", "a", "number", "of", "samples", "assumed", "to", "be", "evenly", "spaced", ".", "Density", "is", "rounded", "to", "machine", "precision", "using", "significant", "digits", "reported", "by", "sys",...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1852-L1876
[ "def", "bound_range", "(", "vals", ",", "density", ",", "time_unit", "=", "'us'", ")", ":", "if", "not", "len", "(", "vals", ")", ":", "return", "(", "np", ".", "nan", ",", "np", ".", "nan", ",", "density", ",", "False", ")", "low", ",", "high", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
validate_regular_sampling
Validates regular sampling of a 1D array ensuring that the difference in sampling steps is at most rtol times the smallest sampling step. Returns a boolean indicating whether the sampling is regular.
holoviews/core/util.py
def validate_regular_sampling(values, rtol=10e-6): """ Validates regular sampling of a 1D array ensuring that the difference in sampling steps is at most rtol times the smallest sampling step. Returns a boolean indicating whether the sampling is regular. """ diffs = np.diff(values) return (l...
def validate_regular_sampling(values, rtol=10e-6): """ Validates regular sampling of a 1D array ensuring that the difference in sampling steps is at most rtol times the smallest sampling step. Returns a boolean indicating whether the sampling is regular. """ diffs = np.diff(values) return (l...
[ "Validates", "regular", "sampling", "of", "a", "1D", "array", "ensuring", "that", "the", "difference", "in", "sampling", "steps", "is", "at", "most", "rtol", "times", "the", "smallest", "sampling", "step", ".", "Returns", "a", "boolean", "indicating", "whether...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1879-L1886
[ "def", "validate_regular_sampling", "(", "values", ",", "rtol", "=", "10e-6", ")", ":", "diffs", "=", "np", ".", "diff", "(", "values", ")", "return", "(", "len", "(", "diffs", ")", "<", "1", ")", "or", "abs", "(", "diffs", ".", "min", "(", ")", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
compute_density
Computes a grid density given the edges and number of samples. Handles datetime grids correctly by computing timedeltas and computing a density for the given time_unit.
holoviews/core/util.py
def compute_density(start, end, length, time_unit='us'): """ Computes a grid density given the edges and number of samples. Handles datetime grids correctly by computing timedeltas and computing a density for the given time_unit. """ if isinstance(start, int): start = float(start) if isinsta...
def compute_density(start, end, length, time_unit='us'): """ Computes a grid density given the edges and number of samples. Handles datetime grids correctly by computing timedeltas and computing a density for the given time_unit. """ if isinstance(start, int): start = float(start) if isinsta...
[ "Computes", "a", "grid", "density", "given", "the", "edges", "and", "number", "of", "samples", ".", "Handles", "datetime", "grids", "correctly", "by", "computing", "timedeltas", "and", "computing", "a", "density", "for", "the", "given", "time_unit", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1889-L1904
[ "def", "compute_density", "(", "start", ",", "end", ",", "length", ",", "time_unit", "=", "'us'", ")", ":", "if", "isinstance", "(", "start", ",", "int", ")", ":", "start", "=", "float", "(", "start", ")", "if", "isinstance", "(", "end", ",", "int", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
date_range
Computes a date range given a start date, end date and the number of samples.
holoviews/core/util.py
def date_range(start, end, length, time_unit='us'): """ Computes a date range given a start date, end date and the number of samples. """ step = (1./compute_density(start, end, length, time_unit)) if pd and isinstance(start, pd.Timestamp): start = start.to_datetime64() step = np.time...
def date_range(start, end, length, time_unit='us'): """ Computes a date range given a start date, end date and the number of samples. """ step = (1./compute_density(start, end, length, time_unit)) if pd and isinstance(start, pd.Timestamp): start = start.to_datetime64() step = np.time...
[ "Computes", "a", "date", "range", "given", "a", "start", "date", "end", "date", "and", "the", "number", "of", "samples", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1907-L1916
[ "def", "date_range", "(", "start", ",", "end", ",", "length", ",", "time_unit", "=", "'us'", ")", ":", "step", "=", "(", "1.", "/", "compute_density", "(", "start", ",", "end", ",", "length", ",", "time_unit", ")", ")", "if", "pd", "and", "isinstance...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
dt_to_int
Converts a datetime type to an integer with the supplied time unit.
holoviews/core/util.py
def dt_to_int(value, time_unit='us'): """ Converts a datetime type to an integer with the supplied time unit. """ if pd: if isinstance(value, pd.Period): value = value.to_timestamp() if isinstance(value, pd.Timestamp): try: value = value.to_datetim...
def dt_to_int(value, time_unit='us'): """ Converts a datetime type to an integer with the supplied time unit. """ if pd: if isinstance(value, pd.Period): value = value.to_timestamp() if isinstance(value, pd.Timestamp): try: value = value.to_datetim...
[ "Converts", "a", "datetime", "type", "to", "an", "integer", "with", "the", "supplied", "time", "unit", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1919-L1957
[ "def", "dt_to_int", "(", "value", ",", "time_unit", "=", "'us'", ")", ":", "if", "pd", ":", "if", "isinstance", "(", "value", ",", "pd", ".", "Period", ")", ":", "value", "=", "value", ".", "to_timestamp", "(", ")", "if", "isinstance", "(", "value", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
cftime_to_timestamp
Converts cftime to timestamp since epoch in milliseconds Non-standard calendars (e.g. Julian or no leap calendars) are converted to standard Gregorian calendar. This can cause extra space to be added for dates that don't exist in the original calendar. In order to handle these dates correctly a custom ...
holoviews/core/util.py
def cftime_to_timestamp(date, time_unit='us'): """Converts cftime to timestamp since epoch in milliseconds Non-standard calendars (e.g. Julian or no leap calendars) are converted to standard Gregorian calendar. This can cause extra space to be added for dates that don't exist in the original calend...
def cftime_to_timestamp(date, time_unit='us'): """Converts cftime to timestamp since epoch in milliseconds Non-standard calendars (e.g. Julian or no leap calendars) are converted to standard Gregorian calendar. This can cause extra space to be added for dates that don't exist in the original calend...
[ "Converts", "cftime", "to", "timestamp", "since", "epoch", "in", "milliseconds" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1960-L1981
[ "def", "cftime_to_timestamp", "(", "date", ",", "time_unit", "=", "'us'", ")", ":", "import", "cftime", "utime", "=", "cftime", ".", "utime", "(", "'microseconds since 1970-01-01 00:00:00'", ")", "if", "time_unit", "==", "'us'", ":", "tscale", "=", "1", "else"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
search_indices
Given a set of values returns the indices of each of those values in the source array.
holoviews/core/util.py
def search_indices(values, source): """ Given a set of values returns the indices of each of those values in the source array. """ orig_indices = source.argsort() return orig_indices[np.searchsorted(source[orig_indices], values)]
def search_indices(values, source): """ Given a set of values returns the indices of each of those values in the source array. """ orig_indices = source.argsort() return orig_indices[np.searchsorted(source[orig_indices], values)]
[ "Given", "a", "set", "of", "values", "returns", "the", "indices", "of", "each", "of", "those", "values", "in", "the", "source", "array", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1984-L1990
[ "def", "search_indices", "(", "values", ",", "source", ")", ":", "orig_indices", "=", "source", ".", "argsort", "(", ")", "return", "orig_indices", "[", "np", ".", "searchsorted", "(", "source", "[", "orig_indices", "]", ",", "values", ")", "]" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
compute_edges
Computes edges as midpoints of the bin centers. The first and last boundaries are equidistant from the first and last midpoints respectively.
holoviews/core/util.py
def compute_edges(edges): """ Computes edges as midpoints of the bin centers. The first and last boundaries are equidistant from the first and last midpoints respectively. """ edges = np.asarray(edges) if edges.dtype.kind == 'i': edges = edges.astype('f') midpoints = (edges[:-1]...
def compute_edges(edges): """ Computes edges as midpoints of the bin centers. The first and last boundaries are equidistant from the first and last midpoints respectively. """ edges = np.asarray(edges) if edges.dtype.kind == 'i': edges = edges.astype('f') midpoints = (edges[:-1]...
[ "Computes", "edges", "as", "midpoints", "of", "the", "bin", "centers", ".", "The", "first", "and", "last", "boundaries", "are", "equidistant", "from", "the", "first", "and", "last", "midpoints", "respectively", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L1993-L2004
[ "def", "compute_edges", "(", "edges", ")", ":", "edges", "=", "np", ".", "asarray", "(", "edges", ")", "if", "edges", ".", "dtype", ".", "kind", "==", "'i'", ":", "edges", "=", "edges", ".", "astype", "(", "'f'", ")", "midpoints", "=", "(", "edges"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
mimebundle_to_html
Converts a MIME bundle into HTML.
holoviews/core/util.py
def mimebundle_to_html(bundle): """ Converts a MIME bundle into HTML. """ if isinstance(bundle, tuple): data, metadata = bundle else: data = bundle html = data.get('text/html', '') if 'application/javascript' in data: js = data['application/javascript'] html +...
def mimebundle_to_html(bundle): """ Converts a MIME bundle into HTML. """ if isinstance(bundle, tuple): data, metadata = bundle else: data = bundle html = data.get('text/html', '') if 'application/javascript' in data: js = data['application/javascript'] html +...
[ "Converts", "a", "MIME", "bundle", "into", "HTML", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L2007-L2019
[ "def", "mimebundle_to_html", "(", "bundle", ")", ":", "if", "isinstance", "(", "bundle", ",", "tuple", ")", ":", "data", ",", "metadata", "=", "bundle", "else", ":", "data", "=", "bundle", "html", "=", "data", ".", "get", "(", "'text/html'", ",", "''",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
numpy_scalar_to_python
Converts a NumPy scalar to a regular python type.
holoviews/core/util.py
def numpy_scalar_to_python(scalar): """ Converts a NumPy scalar to a regular python type. """ scalar_type = type(scalar) if np.issubclass_(scalar_type, np.float_): return float(scalar) elif np.issubclass_(scalar_type, np.int_): return int(scalar) return scalar
def numpy_scalar_to_python(scalar): """ Converts a NumPy scalar to a regular python type. """ scalar_type = type(scalar) if np.issubclass_(scalar_type, np.float_): return float(scalar) elif np.issubclass_(scalar_type, np.int_): return int(scalar) return scalar
[ "Converts", "a", "NumPy", "scalar", "to", "a", "regular", "python", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L2022-L2031
[ "def", "numpy_scalar_to_python", "(", "scalar", ")", ":", "scalar_type", "=", "type", "(", "scalar", ")", "if", "np", ".", "issubclass_", "(", "scalar_type", ",", "np", ".", "float_", ")", ":", "return", "float", "(", "scalar", ")", "elif", "np", ".", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
closest_match
Recursively iterates over type, group, label and overlay key, finding the closest matching spec.
holoviews/core/util.py
def closest_match(match, specs, depth=0): """ Recursively iterates over type, group, label and overlay key, finding the closest matching spec. """ new_specs = [] match_lengths = [] for i, spec in specs: if spec[0] == match[0]: new_specs.append((i, spec[1:])) else:...
def closest_match(match, specs, depth=0): """ Recursively iterates over type, group, label and overlay key, finding the closest matching spec. """ new_specs = [] match_lengths = [] for i, spec in specs: if spec[0] == match[0]: new_specs.append((i, spec[1:])) else:...
[ "Recursively", "iterates", "over", "type", "group", "label", "and", "overlay", "key", "finding", "the", "closest", "matching", "spec", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L2034-L2063
[ "def", "closest_match", "(", "match", ",", "specs", ",", "depth", "=", "0", ")", ":", "new_specs", "=", "[", "]", "match_lengths", "=", "[", "]", "for", "i", ",", "spec", "in", "specs", ":", "if", "spec", "[", "0", "]", "==", "match", "[", "0", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.add_aliases
Conveniently add new aliases as keyword arguments. For instance you can add a new alias with add_aliases(short='Longer string')
holoviews/core/util.py
def add_aliases(self_or_cls, **kwargs): """ Conveniently add new aliases as keyword arguments. For instance you can add a new alias with add_aliases(short='Longer string') """ self_or_cls.aliases.update({v:k for k,v in kwargs.items()})
def add_aliases(self_or_cls, **kwargs): """ Conveniently add new aliases as keyword arguments. For instance you can add a new alias with add_aliases(short='Longer string') """ self_or_cls.aliases.update({v:k for k,v in kwargs.items()})
[ "Conveniently", "add", "new", "aliases", "as", "keyword", "arguments", ".", "For", "instance", "you", "can", "add", "a", "new", "alias", "with", "add_aliases", "(", "short", "=", "Longer", "string", ")" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L637-L642
[ "def", "add_aliases", "(", "self_or_cls", ",", "*", "*", "kwargs", ")", ":", "self_or_cls", ".", "aliases", ".", "update", "(", "{", "v", ":", "k", "for", "k", ",", "v", "in", "kwargs", ".", "items", "(", ")", "}", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.remove_aliases
Remove a list of aliases.
holoviews/core/util.py
def remove_aliases(self_or_cls, aliases): """ Remove a list of aliases. """ for k,v in self_or_cls.aliases.items(): if v in aliases: self_or_cls.aliases.pop(k)
def remove_aliases(self_or_cls, aliases): """ Remove a list of aliases. """ for k,v in self_or_cls.aliases.items(): if v in aliases: self_or_cls.aliases.pop(k)
[ "Remove", "a", "list", "of", "aliases", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L645-L651
[ "def", "remove_aliases", "(", "self_or_cls", ",", "aliases", ")", ":", "for", "k", ",", "v", "in", "self_or_cls", ".", "aliases", ".", "items", "(", ")", ":", "if", "v", "in", "aliases", ":", "self_or_cls", ".", "aliases", ".", "pop", "(", "k", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.prefixed
Whether or not the identifier will be prefixed. Strings that require the prefix are generally not recommended.
holoviews/core/util.py
def prefixed(self, identifier, version): """ Whether or not the identifier will be prefixed. Strings that require the prefix are generally not recommended. """ invalid_starting = ['Mn', 'Mc', 'Nd', 'Pc'] if identifier.startswith('_'): return True return((identifi...
def prefixed(self, identifier, version): """ Whether or not the identifier will be prefixed. Strings that require the prefix are generally not recommended. """ invalid_starting = ['Mn', 'Mc', 'Nd', 'Pc'] if identifier.startswith('_'): return True return((identifi...
[ "Whether", "or", "not", "the", "identifier", "will", "be", "prefixed", ".", "Strings", "that", "require", "the", "prefix", "are", "generally", "not", "recommended", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L666-L674
[ "def", "prefixed", "(", "self", ",", "identifier", ",", "version", ")", ":", "invalid_starting", "=", "[", "'Mn'", ",", "'Mc'", ",", "'Nd'", ",", "'Pc'", "]", "if", "identifier", ".", "startswith", "(", "'_'", ")", ":", "return", "True", "return", "(",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.remove_diacritics
Remove diacritics and accents from the input leaving other unicode characters alone.
holoviews/core/util.py
def remove_diacritics(self_or_cls, identifier): """ Remove diacritics and accents from the input leaving other unicode characters alone.""" chars = '' for c in identifier: replacement = unicodedata.normalize('NFKD', c).encode('ASCII', 'ignore') if replacem...
def remove_diacritics(self_or_cls, identifier): """ Remove diacritics and accents from the input leaving other unicode characters alone.""" chars = '' for c in identifier: replacement = unicodedata.normalize('NFKD', c).encode('ASCII', 'ignore') if replacem...
[ "Remove", "diacritics", "and", "accents", "from", "the", "input", "leaving", "other", "unicode", "characters", "alone", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L677-L688
[ "def", "remove_diacritics", "(", "self_or_cls", ",", "identifier", ")", ":", "chars", "=", "''", "for", "c", "in", "identifier", ":", "replacement", "=", "unicodedata", ".", "normalize", "(", "'NFKD'", ",", "c", ")", ".", "encode", "(", "'ASCII'", ",", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.shortened_character_name
Given a unicode character c, return the shortened unicode name (as a list of tokens) by applying the eliminations, substitutions and transforms.
holoviews/core/util.py
def shortened_character_name(self_or_cls, c, eliminations=[], substitutions={}, transforms=[]): """ Given a unicode character c, return the shortened unicode name (as a list of tokens) by applying the eliminations, substitutions and transforms. """ name = unicodedata.name...
def shortened_character_name(self_or_cls, c, eliminations=[], substitutions={}, transforms=[]): """ Given a unicode character c, return the shortened unicode name (as a list of tokens) by applying the eliminations, substitutions and transforms. """ name = unicodedata.name...
[ "Given", "a", "unicode", "character", "c", "return", "the", "shortened", "unicode", "name", "(", "as", "a", "list", "of", "tokens", ")", "by", "applying", "the", "eliminations", "substitutions", "and", "transforms", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L691-L706
[ "def", "shortened_character_name", "(", "self_or_cls", ",", "c", ",", "eliminations", "=", "[", "]", ",", "substitutions", "=", "{", "}", ",", "transforms", "=", "[", "]", ")", ":", "name", "=", "unicodedata", ".", "name", "(", "c", ")", ".", "lower", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn._process_underscores
Strip underscores to make sure the number is correct after join
holoviews/core/util.py
def _process_underscores(self, tokens): "Strip underscores to make sure the number is correct after join" groups = [[str(''.join(el))] if b else list(el) for (b,el) in itertools.groupby(tokens, lambda k: k=='_')] flattened = [el for group in groups for el in group] proc...
def _process_underscores(self, tokens): "Strip underscores to make sure the number is correct after join" groups = [[str(''.join(el))] if b else list(el) for (b,el) in itertools.groupby(tokens, lambda k: k=='_')] flattened = [el for group in groups for el in group] proc...
[ "Strip", "underscores", "to", "make", "sure", "the", "number", "is", "correct", "after", "join" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L733-L746
[ "def", "_process_underscores", "(", "self", ",", "tokens", ")", ":", "groups", "=", "[", "[", "str", "(", "''", ".", "join", "(", "el", ")", ")", "]", "if", "b", "else", "list", "(", "el", ")", "for", "(", "b", ",", "el", ")", "in", "itertools"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
sanitize_identifier_fn.sanitize
Accumulate blocks of hex and separate blocks by underscores
holoviews/core/util.py
def sanitize(self, name, valid_fn): "Accumulate blocks of hex and separate blocks by underscores" invalid = {'\a':'a','\b':'b', '\v':'v','\f':'f','\r':'r'} for cc in filter(lambda el: el in name, invalid.keys()): raise Exception("Please use a raw string or escape control code '\%s'" ...
def sanitize(self, name, valid_fn): "Accumulate blocks of hex and separate blocks by underscores" invalid = {'\a':'a','\b':'b', '\v':'v','\f':'f','\r':'r'} for cc in filter(lambda el: el in name, invalid.keys()): raise Exception("Please use a raw string or escape control code '\%s'" ...
[ "Accumulate", "blocks", "of", "hex", "and", "separate", "blocks", "by", "underscores" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/util.py#L761-L782
[ "def", "sanitize", "(", "self", ",", "name", ",", "valid_fn", ")", ":", "invalid", "=", "{", "'\\a'", ":", "'a'", ",", "'\\b'", ":", "'b'", ",", "'\\v'", ":", "'v'", ",", "'\\f'", ":", "'f'", ",", "'\\r'", ":", "'r'", "}", "for", "cc", "in", "f...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ImageInterface.values
The set of samples available along a particular dimension.
holoviews/core/data/image.py
def values(cls, dataset, dim, expanded=True, flat=True, compute=True): """ The set of samples available along a particular dimension. """ dim_idx = dataset.get_dimension_index(dim) if dim_idx in [0, 1]: l, b, r, t = dataset.bounds.lbrt() dim2, dim1 = datas...
def values(cls, dataset, dim, expanded=True, flat=True, compute=True): """ The set of samples available along a particular dimension. """ dim_idx = dataset.get_dimension_index(dim) if dim_idx in [0, 1]: l, b, r, t = dataset.bounds.lbrt() dim2, dim1 = datas...
[ "The", "set", "of", "samples", "available", "along", "a", "particular", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/image.py#L150-L188
[ "def", "values", "(", "cls", ",", "dataset", ",", "dim", ",", "expanded", "=", "True", ",", "flat", "=", "True", ",", "compute", "=", "True", ")", ":", "dim_idx", "=", "dataset", ".", "get_dimension_index", "(", "dim", ")", "if", "dim_idx", "in", "["...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ImageInterface.select
Slice the underlying numpy array in sheet coordinates.
holoviews/core/data/image.py
def select(cls, dataset, selection_mask=None, **selection): """ Slice the underlying numpy array in sheet coordinates. """ selection = {k: slice(*sel) if isinstance(sel, tuple) else sel for k, sel in selection.items()} coords = tuple(selection[kd.name] if kd....
def select(cls, dataset, selection_mask=None, **selection): """ Slice the underlying numpy array in sheet coordinates. """ selection = {k: slice(*sel) if isinstance(sel, tuple) else sel for k, sel in selection.items()} coords = tuple(selection[kd.name] if kd....
[ "Slice", "the", "underlying", "numpy", "array", "in", "sheet", "coordinates", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/image.py#L192-L214
[ "def", "select", "(", "cls", ",", "dataset", ",", "selection_mask", "=", "None", ",", "*", "*", "selection", ")", ":", "selection", "=", "{", "k", ":", "slice", "(", "*", "sel", ")", "if", "isinstance", "(", "sel", ",", "tuple", ")", "else", "sel",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ImageInterface.sample
Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter. If two dimension samples and a new_xaxis is provided the sample will be the value of the sampled unit indexed by the value in the new_xaxis ...
holoviews/core/data/image.py
def sample(cls, dataset, samples=[]): """ Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter. If two dimension samples and a new_xaxis is provided the sample will be the value of th...
def sample(cls, dataset, samples=[]): """ Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter. If two dimension samples and a new_xaxis is provided the sample will be the value of th...
[ "Sample", "the", "Raster", "along", "one", "or", "both", "of", "its", "dimensions", "returning", "a", "reduced", "dimensionality", "type", "which", "is", "either", "a", "ItemTable", "Curve", "or", "Scatter", ".", "If", "two", "dimension", "samples", "and", "...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/data/image.py#L218-L230
[ "def", "sample", "(", "cls", ",", "dataset", ",", "samples", "=", "[", "]", ")", ":", "if", "len", "(", "samples", "[", "0", "]", ")", "==", "1", ":", "select", "=", "{", "dataset", ".", "kdims", "[", "0", "]", ".", "name", ":", "[", "s", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ImageInterface.unpack_scalar
Given a dataset object and data in the appropriate format for the interface, return a simple scalar.
holoviews/core/data/image.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 np.isscalar(data) or len(data) != 1: return data key = list(data.keys())[0] if len(data[key]) == 1 a...
def unpack_scalar(cls, dataset, data): """ Given a dataset object and data in the appropriate format for the interface, return a simple scalar. """ if np.isscalar(data) or len(data) != 1: return data key = list(data.keys())[0] if len(data[key]) == 1 a...
[ "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/image.py#L269-L279
[ "def", "unpack_scalar", "(", "cls", ",", "dataset", ",", "data", ")", ":", "if", "np", ".", "isscalar", "(", "data", ")", "or", "len", "(", "data", ")", "!=", "1", ":", "return", "data", "key", "=", "list", "(", "data", ".", "keys", "(", ")", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
mandel
Given the real and imaginary parts of a complex number, determine if it is a candidate for membership in the Mandelbrot set given a fixed number of iterations.
examples/gallery/apps/bokeh/mandelbrot.py
def mandel(x, y, max_iters): """ Given the real and imaginary parts of a complex number, determine if it is a candidate for membership in the Mandelbrot set given a fixed number of iterations. """ i = 0 c = complex(x,y) z = 0.0j for i in range(max_iters): z = z*z + c ...
def mandel(x, y, max_iters): """ Given the real and imaginary parts of a complex number, determine if it is a candidate for membership in the Mandelbrot set given a fixed number of iterations. """ i = 0 c = complex(x,y) z = 0.0j for i in range(max_iters): z = z*z + c ...
[ "Given", "the", "real", "and", "imaginary", "parts", "of", "a", "complex", "number", "determine", "if", "it", "is", "a", "candidate", "for", "membership", "in", "the", "Mandelbrot", "set", "given", "a", "fixed", "number", "of", "iterations", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/examples/gallery/apps/bokeh/mandelbrot.py#L17-L31
[ "def", "mandel", "(", "x", ",", "y", ",", "max_iters", ")", ":", "i", "=", "0", "c", "=", "complex", "(", "x", ",", "y", ")", "z", "=", "0.0j", "for", "i", "in", "range", "(", "max_iters", ")", ":", "z", "=", "z", "*", "z", "+", "c", "if"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ErrorBars.range
Return the lower and upper bounds of values along dimension. Range of the y-dimension includes the symmetric or assymetric error. Args: dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool)...
holoviews/element/chart.py
def range(self, dim, data_range=True, dimension_range=True): """Return the lower and upper bounds of values along dimension. Range of the y-dimension includes the symmetric or assymetric error. Args: dimension: The dimension to compute the range on. data_range (...
def range(self, dim, data_range=True, dimension_range=True): """Return the lower and upper bounds of values along dimension. Range of the y-dimension includes the symmetric or assymetric error. Args: dimension: The dimension to compute the range on. data_range (...
[ "Return", "the", "lower", "and", "upper", "bounds", "of", "values", "along", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/chart.py#L104-L134
[ "def", "range", "(", "self", ",", "dim", ",", "data_range", "=", "True", ",", "dimension_range", "=", "True", ")", ":", "didx", "=", "self", ".", "get_dimension_index", "(", "dim", ")", "dim", "=", "self", ".", "get_dimension", "(", "dim", ")", "if", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Histogram.values
Property to access the Histogram values provided for backward compatibility
holoviews/element/chart.py
def values(self): "Property to access the Histogram values provided for backward compatibility" if util.config.future_deprecations: self.param.warning('Histogram.values is deprecated in favor of ' 'common dimension_values method.') return self.dimension...
def values(self): "Property to access the Histogram values provided for backward compatibility" if util.config.future_deprecations: self.param.warning('Histogram.values is deprecated in favor of ' 'common dimension_values method.') return self.dimension...
[ "Property", "to", "access", "the", "Histogram", "values", "provided", "for", "backward", "compatibility" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/chart.py#L215-L220
[ "def", "values", "(", "self", ")", ":", "if", "util", ".", "config", ".", "future_deprecations", ":", "self", ".", "param", ".", "warning", "(", "'Histogram.values is deprecated in favor of '", "'common dimension_values method.'", ")", "return", "self", ".", "dimens...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Histogram.edges
Property to access the Histogram edges provided for backward compatibility
holoviews/element/chart.py
def edges(self): "Property to access the Histogram edges provided for backward compatibility" if util.config.future_deprecations: self.param.warning('Histogram.edges is deprecated in favor of ' 'common dimension_values method.') return self.interface.co...
def edges(self): "Property to access the Histogram edges provided for backward compatibility" if util.config.future_deprecations: self.param.warning('Histogram.edges is deprecated in favor of ' 'common dimension_values method.') return self.interface.co...
[ "Property", "to", "access", "the", "Histogram", "edges", "provided", "for", "backward", "compatibility" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/chart.py#L224-L229
[ "def", "edges", "(", "self", ")", ":", "if", "util", ".", "config", ".", "future_deprecations", ":", "self", ".", "param", ".", "warning", "(", "'Histogram.edges is deprecated in favor of '", "'common dimension_values method.'", ")", "return", "self", ".", "interfac...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Area.stack
Stacks an (Nd)Overlay of Area or Curve Elements by offsetting their baselines. To stack a HoloMap or DynamicMap use the map method.
holoviews/element/chart.py
def stack(cls, areas): """ Stacks an (Nd)Overlay of Area or Curve Elements by offsetting their baselines. To stack a HoloMap or DynamicMap use the map method. """ if not len(areas): return areas baseline = np.zeros(len(areas.values()[0])) stack...
def stack(cls, areas): """ Stacks an (Nd)Overlay of Area or Curve Elements by offsetting their baselines. To stack a HoloMap or DynamicMap use the map method. """ if not len(areas): return areas baseline = np.zeros(len(areas.values()[0])) stack...
[ "Stacks", "an", "(", "Nd", ")", "Overlay", "of", "Area", "or", "Curve", "Elements", "by", "offsetting", "their", "baselines", ".", "To", "stack", "a", "HoloMap", "or", "DynamicMap", "use", "the", "map", "method", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/chart.py#L267-L283
[ "def", "stack", "(", "cls", ",", "areas", ")", ":", "if", "not", "len", "(", "areas", ")", ":", "return", "areas", "baseline", "=", "np", ".", "zeros", "(", "len", "(", "areas", ".", "values", "(", ")", "[", "0", "]", ")", ")", "stacked", "=", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Plot.cleanup
Cleans up references to the plot on the attached Stream subscribers.
holoviews/plotting/plot.py
def cleanup(self): """ Cleans up references to the plot on the attached Stream subscribers. """ plots = self.traverse(lambda x: x, [Plot]) for plot in plots: if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)): ...
def cleanup(self): """ Cleans up references to the plot on the attached Stream subscribers. """ plots = self.traverse(lambda x: x, [Plot]) for plot in plots: if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)): ...
[ "Cleans", "up", "references", "to", "the", "plot", "on", "the", "attached", "Stream", "subscribers", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L69-L83
[ "def", "cleanup", "(", "self", ")", ":", "plots", "=", "self", ".", "traverse", "(", "lambda", "x", ":", "x", ",", "[", "Plot", "]", ")", "for", "plot", "in", "plots", ":", "if", "not", "isinstance", "(", "plot", ",", "(", "GenericCompositePlot", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
DimensionedPlot.matches
Matches a specification against the current Plot.
holoviews/plotting/plot.py
def matches(self, spec): """ Matches a specification against the current Plot. """ if callable(spec) and not isinstance(spec, type): return spec(self) elif isinstance(spec, type): return isinstance(self, spec) else: raise ValueError("Matching specs have to be ...
def matches(self, spec): """ Matches a specification against the current Plot. """ if callable(spec) and not isinstance(spec, type): return spec(self) elif isinstance(spec, type): return isinstance(self, spec) else: raise ValueError("Matching specs have to be ...
[ "Matches", "a", "specification", "against", "the", "current", "Plot", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L273-L280
[ "def", "matches", "(", "self", ",", "spec", ")", ":", "if", "callable", "(", "spec", ")", "and", "not", "isinstance", "(", "spec", ",", "type", ")", ":", "return", "spec", "(", "self", ")", "elif", "isinstance", "(", "spec", ",", "type", ")", ":", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
DimensionedPlot.traverse
Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.
holoviews/plotting/plot.py
def traverse(self, fn=None, specs=None, full_breadth=True): """ Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class. ...
def traverse(self, fn=None, specs=None, full_breadth=True): """ Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class. ...
[ "Traverses", "any", "nested", "DimensionedPlot", "returning", "a", "list", "of", "all", "plots", "that", "match", "the", "specs", ".", "The", "specs", "should", "be", "supplied", "as", "a", "list", "of", "either", "Plot", "types", "or", "callables", "which",...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L283-L306
[ "def", "traverse", "(", "self", ",", "fn", "=", "None", ",", "specs", "=", "None", ",", "full_breadth", "=", "True", ")", ":", "accumulator", "=", "[", "]", "matches", "=", "specs", "is", "None", "if", "not", "matches", ":", "for", "spec", "in", "s...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
DimensionedPlot._frame_title
Returns the formatted dimension group strings for a particular frame.
holoviews/plotting/plot.py
def _frame_title(self, key, group_size=2, separator='\n'): """ Returns the formatted dimension group strings for a particular frame. """ if self.layout_dimensions is not None: dimensions, key = zip(*self.layout_dimensions.items()) elif not self.dynamic and (no...
def _frame_title(self, key, group_size=2, separator='\n'): """ Returns the formatted dimension group strings for a particular frame. """ if self.layout_dimensions is not None: dimensions, key = zip(*self.layout_dimensions.items()) elif not self.dynamic and (no...
[ "Returns", "the", "formatted", "dimension", "group", "strings", "for", "a", "particular", "frame", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/plot.py#L309-L325
[ "def", "_frame_title", "(", "self", ",", "key", ",", "group_size", "=", "2", ",", "separator", "=", "'\\n'", ")", ":", "if", "self", ".", "layout_dimensions", "is", "not", "None", ":", "dimensions", ",", "key", "=", "zip", "(", "*", "self", ".", "lay...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655