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
OptsCompleter.option_completer
Tab completion hook for the %%opts cell magic.
holoviews/ipython/magics.py
def option_completer(cls, k,v): "Tab completion hook for the %%opts cell magic." line = v.text_until_cursor completions = cls.setup_completer() compositor_defs = {el.group:el.output_type.__name__ for el in Compositor.definitions if el.group} return cls....
def option_completer(cls, k,v): "Tab completion hook for the %%opts cell magic." line = v.text_until_cursor completions = cls.setup_completer() compositor_defs = {el.group:el.output_type.__name__ for el in Compositor.definitions if el.group} return cls....
[ "Tab", "completion", "hook", "for", "the", "%%opts", "cell", "magic", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/magics.py#L209-L215
[ "def", "option_completer", "(", "cls", ",", "k", ",", "v", ")", ":", "line", "=", "v", ".", "text_until_cursor", "completions", "=", "cls", ".", "setup_completer", "(", ")", "compositor_defs", "=", "{", "el", ".", "group", ":", "el", ".", "output_type", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Link.link
Registers the Link
holoviews/plotting/links.py
def link(self): """ Registers the Link """ if self.source in self.registry: links = self.registry[self.source] params = { k: v for k, v in self.get_param_values() if k != 'name'} for link in links: link_params = { ...
def link(self): """ Registers the Link """ if self.source in self.registry: links = self.registry[self.source] params = { k: v for k, v in self.get_param_values() if k != 'name'} for link in links: link_params = { ...
[ "Registers", "the", "Link" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/links.py#L62-L78
[ "def", "link", "(", "self", ")", ":", "if", "self", ".", "source", "in", "self", ".", "registry", ":", "links", "=", "self", ".", "registry", "[", "self", ".", "source", "]", "params", "=", "{", "k", ":", "v", "for", "k", ",", "v", "in", "self"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Link.unlink
Unregisters the Link
holoviews/plotting/links.py
def unlink(self): """ Unregisters the Link """ links = self.registry.get(self.source) if self in links: links.pop(links.index(self))
def unlink(self): """ Unregisters the Link """ links = self.registry.get(self.source) if self in links: links.pop(links.index(self))
[ "Unregisters", "the", "Link" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/links.py#L80-L86
[ "def", "unlink", "(", "self", ")", ":", "links", "=", "self", ".", "registry", ".", "get", "(", "self", ".", "source", ")", "if", "self", "in", "links", ":", "links", ".", "pop", "(", "links", ".", "index", "(", "self", ")", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
BoxWhiskerPlot._get_factors
Get factors for categorical axes.
holoviews/plotting/bokeh/stats.py
def _get_factors(self, element): """ Get factors for categorical axes. """ if not element.kdims: xfactors, yfactors = [element.label], [] else: factors = [key for key in element.groupby(element.kdims).data.keys()] if element.ndims > 1: ...
def _get_factors(self, element): """ Get factors for categorical axes. """ if not element.kdims: xfactors, yfactors = [element.label], [] else: factors = [key for key in element.groupby(element.kdims).data.keys()] if element.ndims > 1: ...
[ "Get", "factors", "for", "categorical", "axes", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/stats.py#L112-L126
[ "def", "_get_factors", "(", "self", ",", "element", ")", ":", "if", "not", "element", ".", "kdims", ":", "xfactors", ",", "yfactors", "=", "[", "element", ".", "label", "]", ",", "[", "]", "else", ":", "factors", "=", "[", "key", "for", "key", "in"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_bins
Map elements from given `order` array to bins of start and end values for radius or angle dimension.
holoviews/plotting/bokeh/heatmap.py
def _get_bins(self, kind, order, reverse=False): """ Map elements from given `order` array to bins of start and end values for radius or angle dimension. """ if kind == "radius": start = self.max_radius * self.radius_inner end = self.max_radius e...
def _get_bins(self, kind, order, reverse=False): """ Map elements from given `order` array to bins of start and end values for radius or angle dimension. """ if kind == "radius": start = self.max_radius * self.radius_inner end = self.max_radius e...
[ "Map", "elements", "from", "given", "order", "array", "to", "bins", "of", "start", "and", "end", "values", "for", "radius", "or", "angle", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L240-L260
[ "def", "_get_bins", "(", "self", ",", "kind", ",", "order", ",", "reverse", "=", "False", ")", ":", "if", "kind", "==", "\"radius\"", ":", "start", "=", "self", ".", "max_radius", "*", "self", ".", "radius_inner", "end", "=", "self", ".", "max_radius",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_bounds
Extract first and second value from tuples of mapped bins.
holoviews/plotting/bokeh/heatmap.py
def _get_bounds(mapper, values): """ Extract first and second value from tuples of mapped bins. """ array = np.array([mapper.get(x) for x in values]) return array[:, 0], array[:, 1]
def _get_bounds(mapper, values): """ Extract first and second value from tuples of mapped bins. """ array = np.array([mapper.get(x) for x in values]) return array[:, 0], array[:, 1]
[ "Extract", "first", "and", "second", "value", "from", "tuples", "of", "mapped", "bins", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L264-L270
[ "def", "_get_bounds", "(", "mapper", ",", "values", ")", ":", "array", "=", "np", ".", "array", "(", "[", "mapper", ".", "get", "(", "x", ")", "for", "x", "in", "values", "]", ")", "return", "array", "[", ":", ",", "0", "]", ",", "array", "[", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._postprocess_hover
Limit hover tool to annular wedges only.
holoviews/plotting/bokeh/heatmap.py
def _postprocess_hover(self, renderer, source): """ Limit hover tool to annular wedges only. """ if isinstance(renderer.glyph, AnnularWedge): super(RadialHeatMapPlot, self)._postprocess_hover(renderer, source)
def _postprocess_hover(self, renderer, source): """ Limit hover tool to annular wedges only. """ if isinstance(renderer.glyph, AnnularWedge): super(RadialHeatMapPlot, self)._postprocess_hover(renderer, source)
[ "Limit", "hover", "tool", "to", "annular", "wedges", "only", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L273-L279
[ "def", "_postprocess_hover", "(", "self", ",", "renderer", ",", "source", ")", ":", "if", "isinstance", "(", "renderer", ".", "glyph", ",", "AnnularWedge", ")", ":", "super", "(", "RadialHeatMapPlot", ",", "self", ")", ".", "_postprocess_hover", "(", "render...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot.get_extents
Supply custom, static extents because radial heatmaps always have the same boundaries.
holoviews/plotting/bokeh/heatmap.py
def get_extents(self, view, ranges, range_type='combined'): """Supply custom, static extents because radial heatmaps always have the same boundaries. """ if range_type not in ('data', 'combined'): return (None,)*4 lower = -self.radius_outer upper = 2 * self.ma...
def get_extents(self, view, ranges, range_type='combined'): """Supply custom, static extents because radial heatmaps always have the same boundaries. """ if range_type not in ('data', 'combined'): return (None,)*4 lower = -self.radius_outer upper = 2 * self.ma...
[ "Supply", "custom", "static", "extents", "because", "radial", "heatmaps", "always", "have", "the", "same", "boundaries", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L282-L290
[ "def", "get_extents", "(", "self", ",", "view", ",", "ranges", ",", "range_type", "=", "'combined'", ")", ":", "if", "range_type", "not", "in", "(", "'data'", ",", "'combined'", ")", ":", "return", "(", "None", ",", ")", "*", "4", "lower", "=", "-", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot.get_default_mapping
Create dictionary containing default ColumnDataSource glyph to data mappings.
holoviews/plotting/bokeh/heatmap.py
def get_default_mapping(self, z, cmapper): """Create dictionary containing default ColumnDataSource glyph to data mappings. """ map_annular = dict(x=self.max_radius, y=self.max_radius, inner_radius="inner_radius", outer_radius="oute...
def get_default_mapping(self, z, cmapper): """Create dictionary containing default ColumnDataSource glyph to data mappings. """ map_annular = dict(x=self.max_radius, y=self.max_radius, inner_radius="inner_radius", outer_radius="oute...
[ "Create", "dictionary", "containing", "default", "ColumnDataSource", "glyph", "to", "data", "mappings", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L305-L334
[ "def", "get_default_mapping", "(", "self", ",", "z", ",", "cmapper", ")", ":", "map_annular", "=", "dict", "(", "x", "=", "self", ".", "max_radius", ",", "y", "=", "self", ".", "max_radius", ",", "inner_radius", "=", "\"inner_radius\"", ",", "outer_radius"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._pprint
Helper function to convert values to corresponding dimension type.
holoviews/plotting/bokeh/heatmap.py
def _pprint(self, element, dim_label, vals): """Helper function to convert values to corresponding dimension type. """ if vals.dtype.kind not in 'SU': dim = element.gridded.get_dimension(dim_label) return [dim.pprint_value(v) for v in vals] return vals
def _pprint(self, element, dim_label, vals): """Helper function to convert values to corresponding dimension type. """ if vals.dtype.kind not in 'SU': dim = element.gridded.get_dimension(dim_label) return [dim.pprint_value(v) for v in vals] return vals
[ "Helper", "function", "to", "convert", "values", "to", "corresponding", "dimension", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L337-L346
[ "def", "_pprint", "(", "self", ",", "element", ",", "dim_label", ",", "vals", ")", ":", "if", "vals", ".", "dtype", ".", "kind", "not", "in", "'SU'", ":", "dim", "=", "element", ".", "gridded", ".", "get_dimension", "(", "dim_label", ")", "return", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._compute_tick_mapping
Helper function to compute tick mappings based on `ticks` and default orders and bins.
holoviews/plotting/bokeh/heatmap.py
def _compute_tick_mapping(self, kind, order, bins): """Helper function to compute tick mappings based on `ticks` and default orders and bins. """ if kind == "angle": ticks = self.xticks reverse = True elif kind == "radius": ticks = self.ytick...
def _compute_tick_mapping(self, kind, order, bins): """Helper function to compute tick mappings based on `ticks` and default orders and bins. """ if kind == "angle": ticks = self.xticks reverse = True elif kind == "radius": ticks = self.ytick...
[ "Helper", "function", "to", "compute", "tick", "mappings", "based", "on", "ticks", "and", "default", "orders", "and", "bins", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L349-L373
[ "def", "_compute_tick_mapping", "(", "self", ",", "kind", ",", "order", ",", "bins", ")", ":", "if", "kind", "==", "\"angle\"", ":", "ticks", "=", "self", ".", "xticks", "reverse", "=", "True", "elif", "kind", "==", "\"radius\"", ":", "ticks", "=", "se...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_seg_labels_data
Generate ColumnDataSource dictionary for segment labels.
holoviews/plotting/bokeh/heatmap.py
def _get_seg_labels_data(self, order_seg, bins_seg): """Generate ColumnDataSource dictionary for segment labels. """ if self.xticks is None: return dict(x=[], y=[], text=[], angle=[]) mapping = self._compute_tick_mapping("angle", order_seg, bins_seg) values = [(te...
def _get_seg_labels_data(self, order_seg, bins_seg): """Generate ColumnDataSource dictionary for segment labels. """ if self.xticks is None: return dict(x=[], y=[], text=[], angle=[]) mapping = self._compute_tick_mapping("angle", order_seg, bins_seg) values = [(te...
[ "Generate", "ColumnDataSource", "dictionary", "for", "segment", "labels", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L376-L398
[ "def", "_get_seg_labels_data", "(", "self", ",", "order_seg", ",", "bins_seg", ")", ":", "if", "self", ".", "xticks", "is", "None", ":", "return", "dict", "(", "x", "=", "[", "]", ",", "y", "=", "[", "]", ",", "text", "=", "[", "]", ",", "angle",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_ann_labels_data
Generate ColumnDataSource dictionary for annular labels.
holoviews/plotting/bokeh/heatmap.py
def _get_ann_labels_data(self, order_ann, bins_ann): """Generate ColumnDataSource dictionary for annular labels. """ if self.yticks is None: return dict(x=[], y=[], text=[], angle=[]) mapping = self._compute_tick_mapping("radius", order_ann, bins_ann) values = [(la...
def _get_ann_labels_data(self, order_ann, bins_ann): """Generate ColumnDataSource dictionary for annular labels. """ if self.yticks is None: return dict(x=[], y=[], text=[], angle=[]) mapping = self._compute_tick_mapping("radius", order_ann, bins_ann) values = [(la...
[ "Generate", "ColumnDataSource", "dictionary", "for", "annular", "labels", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L400-L420
[ "def", "_get_ann_labels_data", "(", "self", ",", "order_ann", ",", "bins_ann", ")", ":", "if", "self", ".", "yticks", "is", "None", ":", "return", "dict", "(", "x", "=", "[", "]", ",", "y", "=", "[", "]", ",", "text", "=", "[", "]", ",", "angle",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_markers
Helper function to get marker positions depending on mark type.
holoviews/plotting/bokeh/heatmap.py
def _get_markers(marks, order, bins): """Helper function to get marker positions depending on mark type. """ if callable(marks): markers = [x for x in order if marks(x)] elif isinstance(marks, list): markers = [order[x] for x in marks] elif isinstance(ma...
def _get_markers(marks, order, bins): """Helper function to get marker positions depending on mark type. """ if callable(marks): markers = [x for x in order if marks(x)] elif isinstance(marks, list): markers = [order[x] for x in marks] elif isinstance(ma...
[ "Helper", "function", "to", "get", "marker", "positions", "depending", "on", "mark", "type", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L424-L439
[ "def", "_get_markers", "(", "marks", ",", "order", ",", "bins", ")", ":", "if", "callable", "(", "marks", ")", ":", "markers", "=", "[", "x", "for", "x", "in", "order", "if", "marks", "(", "x", ")", "]", "elif", "isinstance", "(", "marks", ",", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_xmarks_data
Generate ColumnDataSource dictionary for segment separation lines.
holoviews/plotting/bokeh/heatmap.py
def _get_xmarks_data(self, order_seg, bins_seg): """Generate ColumnDataSource dictionary for segment separation lines. """ if not self.xmarks: return dict(xs=[], ys=[]) angles = self._get_markers(self.xmarks, order_seg, bins_seg) inner = self.max_radius * self.rad...
def _get_xmarks_data(self, order_seg, bins_seg): """Generate ColumnDataSource dictionary for segment separation lines. """ if not self.xmarks: return dict(xs=[], ys=[]) angles = self._get_markers(self.xmarks, order_seg, bins_seg) inner = self.max_radius * self.rad...
[ "Generate", "ColumnDataSource", "dictionary", "for", "segment", "separation", "lines", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L442-L464
[ "def", "_get_xmarks_data", "(", "self", ",", "order_seg", ",", "bins_seg", ")", ":", "if", "not", "self", ".", "xmarks", ":", "return", "dict", "(", "xs", "=", "[", "]", ",", "ys", "=", "[", "]", ")", "angles", "=", "self", ".", "_get_markers", "("...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._get_ymarks_data
Generate ColumnDataSource dictionary for segment separation lines.
holoviews/plotting/bokeh/heatmap.py
def _get_ymarks_data(self, order_ann, bins_ann): """Generate ColumnDataSource dictionary for segment separation lines. """ if not self.ymarks: return dict(radius=[]) radius = self._get_markers(self.ymarks, order_ann, bins_ann) return dict(radius=radius)
def _get_ymarks_data(self, order_ann, bins_ann): """Generate ColumnDataSource dictionary for segment separation lines. """ if not self.ymarks: return dict(radius=[]) radius = self._get_markers(self.ymarks, order_ann, bins_ann) return dict(radius=radius)
[ "Generate", "ColumnDataSource", "dictionary", "for", "segment", "separation", "lines", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/heatmap.py#L467-L477
[ "def", "_get_ymarks_data", "(", "self", ",", "order_ann", ",", "bins_ann", ")", ":", "if", "not", "self", ".", "ymarks", ":", "return", "dict", "(", "radius", "=", "[", "]", ")", "radius", "=", "self", ".", "_get_markers", "(", "self", ".", "ymarks", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.merge
Merge a collection of AttrTree objects.
holoviews/core/tree.py
def merge(cls, trees): """ Merge a collection of AttrTree objects. """ first = trees[0] for tree in trees: first.update(tree) return first
def merge(cls, trees): """ Merge a collection of AttrTree objects. """ first = trees[0] for tree in trees: first.update(tree) return first
[ "Merge", "a", "collection", "of", "AttrTree", "objects", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L26-L33
[ "def", "merge", "(", "cls", ",", "trees", ")", ":", "first", "=", "trees", "[", "0", "]", "for", "tree", "in", "trees", ":", "first", ".", "update", "(", "tree", ")", "return", "first" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.path
Returns the path up to the root for the current node.
holoviews/core/tree.py
def path(self): "Returns the path up to the root for the current node." if self.parent: return '.'.join([self.parent.path, str(self.identifier)]) else: return self.identifier if self.identifier else self.__class__.__name__
def path(self): "Returns the path up to the root for the current node." if self.parent: return '.'.join([self.parent.path, str(self.identifier)]) else: return self.identifier if self.identifier else self.__class__.__name__
[ "Returns", "the", "path", "up", "to", "the", "root", "for", "the", "current", "node", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L74-L79
[ "def", "path", "(", "self", ")", ":", "if", "self", ".", "parent", ":", "return", "'.'", ".", "join", "(", "[", "self", ".", "parent", ".", "path", ",", "str", "(", "self", ".", "identifier", ")", "]", ")", "else", ":", "return", "self", ".", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.update
Updated the contents of the current AttrTree with the contents of a second AttrTree.
holoviews/core/tree.py
def update(self, other): """ Updated the contents of the current AttrTree with the contents of a second AttrTree. """ if not isinstance(other, AttrTree): raise Exception('Can only update with another AttrTree type.') fixed_status = (self.fixed, other.fixed) ...
def update(self, other): """ Updated the contents of the current AttrTree with the contents of a second AttrTree. """ if not isinstance(other, AttrTree): raise Exception('Can only update with another AttrTree type.') fixed_status = (self.fixed, other.fixed) ...
[ "Updated", "the", "contents", "of", "the", "current", "AttrTree", "with", "the", "contents", "of", "a", "second", "AttrTree", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L92-L106
[ "def", "update", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "AttrTree", ")", ":", "raise", "Exception", "(", "'Can only update with another AttrTree type.'", ")", "fixed_status", "=", "(", "self", ".", "fixed", ",", "o...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.set_path
Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.
holoviews/core/tree.py
def set_path(self, path, val): """ Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format. """ path = tuple(path.split('.')) if isinstance(path , str) else tuple(path) disallowed = [p for p in path if not type(self)._...
def set_path(self, path, val): """ Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format. """ path = tuple(path.split('.')) if isinstance(path , str) else tuple(path) disallowed = [p for p in path if not type(self)._...
[ "Set", "the", "given", "value", "at", "the", "supplied", "path", "where", "path", "is", "either", "a", "tuple", "of", "strings", "or", "a", "string", "in", "A", ".", "B", ".", "C", "format", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L109-L124
[ "def", "set_path", "(", "self", ",", "path", ",", "val", ")", ":", "path", "=", "tuple", "(", "path", ".", "split", "(", "'.'", ")", ")", "if", "isinstance", "(", "path", ",", "str", ")", "else", "tuple", "(", "path", ")", "disallowed", "=", "[",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.filter
Filters the loaded AttrTree using the supplied path_filters.
holoviews/core/tree.py
def filter(self, path_filters): """ Filters the loaded AttrTree using the supplied path_filters. """ if not path_filters: return self # Convert string path filters path_filters = [tuple(pf.split('.')) if not isinstance(pf, tuple) else pf for pf in...
def filter(self, path_filters): """ Filters the loaded AttrTree using the supplied path_filters. """ if not path_filters: return self # Convert string path filters path_filters = [tuple(pf.split('.')) if not isinstance(pf, tuple) else pf for pf in...
[ "Filters", "the", "loaded", "AttrTree", "using", "the", "supplied", "path_filters", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L127-L143
[ "def", "filter", "(", "self", ",", "path_filters", ")", ":", "if", "not", "path_filters", ":", "return", "self", "# Convert string path filters", "path_filters", "=", "[", "tuple", "(", "pf", ".", "split", "(", "'.'", ")", ")", "if", "not", "isinstance", "...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree._propagate
Propagate the value up to the root node.
holoviews/core/tree.py
def _propagate(self, path, val): """ Propagate the value up to the root node. """ if val == '_DELETE': if path in self.data: del self.data[path] else: items = [(key, v) for key, v in self.data.items() if not...
def _propagate(self, path, val): """ Propagate the value up to the root node. """ if val == '_DELETE': if path in self.data: del self.data[path] else: items = [(key, v) for key, v in self.data.items() if not...
[ "Propagate", "the", "value", "up", "to", "the", "root", "node", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L146-L160
[ "def", "_propagate", "(", "self", ",", "path", ",", "val", ")", ":", "if", "val", "==", "'_DELETE'", ":", "if", "path", "in", "self", ".", "data", ":", "del", "self", ".", "data", "[", "path", "]", "else", ":", "items", "=", "[", "(", "key", ",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.get
Get a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The indexed node of the AttrTree
holoviews/core/tree.py
def get(self, identifier, default=None): """Get a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The indexed node of the AttrTree """ split...
def get(self, identifier, default=None): """Get a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The indexed node of the AttrTree """ split...
[ "Get", "a", "node", "of", "the", "AttrTree", "using", "its", "path", "string", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L284-L304
[ "def", "get", "(", "self", ",", "identifier", ",", "default", "=", "None", ")", ":", "split_label", "=", "(", "tuple", "(", "identifier", ".", "split", "(", "'.'", ")", ")", "if", "isinstance", "(", "identifier", ",", "str", ")", "else", "tuple", "("...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
AttrTree.pop
Pop a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The node that was removed from the AttrTree
holoviews/core/tree.py
def pop(self, identifier, default=None): """Pop a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The node that was removed from the AttrTree """ ...
def pop(self, identifier, default=None): """Pop a node of the AttrTree using its path string. Args: identifier: Path string of the node to return default: Value to return if no node is found Returns: The node that was removed from the AttrTree """ ...
[ "Pop", "a", "node", "of", "the", "AttrTree", "using", "its", "path", "string", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/core/tree.py#L321-L336
[ "def", "pop", "(", "self", ",", "identifier", ",", "default", "=", "None", ")", ":", "if", "identifier", "in", "self", ".", "children", ":", "item", "=", "self", "[", "identifier", "]", "self", ".", "__delitem__", "(", "identifier", ")", "return", "ite...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
MessageCallback._filter_msg
Filter event values that do not originate from the plotting handles associated with a particular stream using their ids to match them.
holoviews/plotting/bokeh/callbacks.py
def _filter_msg(self, msg, ids): """ Filter event values that do not originate from the plotting handles associated with a particular stream using their ids to match them. """ filtered_msg = {} for k, v in msg.items(): if isinstance(v, dict) and 'id' i...
def _filter_msg(self, msg, ids): """ Filter event values that do not originate from the plotting handles associated with a particular stream using their ids to match them. """ filtered_msg = {} for k, v in msg.items(): if isinstance(v, dict) and 'id' i...
[ "Filter", "event", "values", "that", "do", "not", "originate", "from", "the", "plotting", "handles", "associated", "with", "a", "particular", "stream", "using", "their", "ids", "to", "match", "them", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L101-L114
[ "def", "_filter_msg", "(", "self", ",", "msg", ",", "ids", ")", ":", "filtered_msg", "=", "{", "}", "for", "k", ",", "v", "in", "msg", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", "and", "'id'", "in", "v", ":", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
MessageCallback._init_plot_handles
Find all requested plotting handles and cache them along with the IDs of the models the callbacks will be attached to.
holoviews/plotting/bokeh/callbacks.py
def _init_plot_handles(self): """ Find all requested plotting handles and cache them along with the IDs of the models the callbacks will be attached to. """ plots = [self.plot] if self.plot.subplots: plots += list(self.plot.subplots.values()) handles ...
def _init_plot_handles(self): """ Find all requested plotting handles and cache them along with the IDs of the models the callbacks will be attached to. """ plots = [self.plot] if self.plot.subplots: plots += list(self.plot.subplots.values()) handles ...
[ "Find", "all", "requested", "plotting", "handles", "and", "cache", "them", "along", "with", "the", "IDs", "of", "the", "models", "the", "callbacks", "will", "be", "attached", "to", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L140-L165
[ "def", "_init_plot_handles", "(", "self", ")", ":", "plots", "=", "[", "self", ".", "plot", "]", "if", "self", ".", "plot", ".", "subplots", ":", "plots", "+=", "list", "(", "self", ".", "plot", ".", "subplots", ".", "values", "(", ")", ")", "handl...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
MessageCallback._get_stream_handle_ids
Gather the ids of the plotting handles attached to this callback This allows checking that a stream is not given the state of a plotting handle it wasn't attached to
holoviews/plotting/bokeh/callbacks.py
def _get_stream_handle_ids(self, handles): """ Gather the ids of the plotting handles attached to this callback This allows checking that a stream is not given the state of a plotting handle it wasn't attached to """ stream_handle_ids = defaultdict(dict) for strea...
def _get_stream_handle_ids(self, handles): """ Gather the ids of the plotting handles attached to this callback This allows checking that a stream is not given the state of a plotting handle it wasn't attached to """ stream_handle_ids = defaultdict(dict) for strea...
[ "Gather", "the", "ids", "of", "the", "plotting", "handles", "attached", "to", "this", "callback", "This", "allows", "checking", "that", "a", "stream", "is", "not", "given", "the", "state", "of", "a", "plotting", "handle", "it", "wasn", "t", "attached", "to...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L168-L180
[ "def", "_get_stream_handle_ids", "(", "self", ",", "handles", ")", ":", "stream_handle_ids", "=", "defaultdict", "(", "dict", ")", "for", "stream", "in", "self", ".", "streams", ":", "for", "h", "in", "self", ".", "models", ":", "if", "h", "in", "handles...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
CustomJSCallback.attributes_js
Generates JS code to look up attributes on JS objects from an attributes specification dictionary. If the specification references a plotting particular plotting handle it will also generate JS code to get the ID of the object. Simple example (when referencing cb_data or cb_obj): ...
holoviews/plotting/bokeh/callbacks.py
def attributes_js(cls, attributes): """ Generates JS code to look up attributes on JS objects from an attributes specification dictionary. If the specification references a plotting particular plotting handle it will also generate JS code to get the ID of the object. Sim...
def attributes_js(cls, attributes): """ Generates JS code to look up attributes on JS objects from an attributes specification dictionary. If the specification references a plotting particular plotting handle it will also generate JS code to get the ID of the object. Sim...
[ "Generates", "JS", "code", "to", "look", "up", "attributes", "on", "JS", "objects", "from", "an", "attributes", "specification", "dictionary", ".", "If", "the", "specification", "references", "a", "plotting", "particular", "plotting", "handle", "it", "will", "al...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L202-L242
[ "def", "attributes_js", "(", "cls", ",", "attributes", ")", ":", "assign_template", "=", "'{assign}{{id: {obj_name}[\"id\"], value: {obj_name}{attr_getters}}};\\n'", "conditional_template", "=", "'if (({obj_name} != undefined)) {{ {assign} }}'", "code", "=", "''", "for", "key", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
CustomJSCallback.get_customjs
Creates a CustomJS callback that will send the requested attributes back to python.
holoviews/plotting/bokeh/callbacks.py
def get_customjs(self, references, plot_id=None): """ Creates a CustomJS callback that will send the requested attributes back to python. """ # Generate callback JS code to get all the requested data if plot_id is None: plot_id = self.plot.id or 'PLACEHOLDER_P...
def get_customjs(self, references, plot_id=None): """ Creates a CustomJS callback that will send the requested attributes back to python. """ # Generate callback JS code to get all the requested data if plot_id is None: plot_id = self.plot.id or 'PLACEHOLDER_P...
[ "Creates", "a", "CustomJS", "callback", "that", "will", "send", "the", "requested", "attributes", "back", "to", "python", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L245-L265
[ "def", "get_customjs", "(", "self", ",", "references", ",", "plot_id", "=", "None", ")", ":", "# Generate callback JS code to get all the requested data", "if", "plot_id", "is", "None", ":", "plot_id", "=", "self", ".", "plot", ".", "id", "or", "'PLACEHOLDER_PLOT_...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
CustomJSCallback.set_customjs_callback
Generates a CustomJS callback by generating the required JS code and gathering all plotting handles and installs it on the requested callback handle.
holoviews/plotting/bokeh/callbacks.py
def set_customjs_callback(self, js_callback, handle): """ Generates a CustomJS callback by generating the required JS code and gathering all plotting handles and installs it on the requested callback handle. """ if self.on_events: for event in self.on_events: ...
def set_customjs_callback(self, js_callback, handle): """ Generates a CustomJS callback by generating the required JS code and gathering all plotting handles and installs it on the requested callback handle. """ if self.on_events: for event in self.on_events: ...
[ "Generates", "a", "CustomJS", "callback", "by", "generating", "the", "required", "JS", "code", "and", "gathering", "all", "plotting", "handles", "and", "installs", "it", "on", "the", "requested", "callback", "handle", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L268-L281
[ "def", "set_customjs_callback", "(", "self", ",", "js_callback", ",", "handle", ")", ":", "if", "self", ".", "on_events", ":", "for", "event", "in", "self", ".", "on_events", ":", "handle", ".", "js_on_event", "(", "event", ",", "js_callback", ")", "if", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ServerCallback.resolve_attr_spec
Resolves a Callback attribute specification looking the corresponding attribute up on the cb_obj, which should be a bokeh model. If not model is supplied cb_obj is assumed to be the same as the model.
holoviews/plotting/bokeh/callbacks.py
def resolve_attr_spec(cls, spec, cb_obj, model=None): """ Resolves a Callback attribute specification looking the corresponding attribute up on the cb_obj, which should be a bokeh model. If not model is supplied cb_obj is assumed to be the same as the model. """ i...
def resolve_attr_spec(cls, spec, cb_obj, model=None): """ Resolves a Callback attribute specification looking the corresponding attribute up on the cb_obj, which should be a bokeh model. If not model is supplied cb_obj is assumed to be the same as the model. """ i...
[ "Resolves", "a", "Callback", "attribute", "specification", "looking", "the", "corresponding", "attribute", "up", "on", "the", "cb_obj", "which", "should", "be", "a", "bokeh", "model", ".", "If", "not", "model", "is", "supplied", "cb_obj", "is", "assumed", "to"...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L299-L319
[ "def", "resolve_attr_spec", "(", "cls", ",", "spec", ",", "cb_obj", ",", "model", "=", "None", ")", ":", "if", "not", "cb_obj", ":", "raise", "Exception", "(", "'Bokeh plot attribute %s could not be found'", "%", "spec", ")", "if", "model", "is", "None", ":"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ServerCallback.on_change
Process change events adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates.
holoviews/plotting/bokeh/callbacks.py
def on_change(self, attr, old, new): """ Process change events adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates. """ self._queue.append((attr, old, new)) if not self._active and self.plot.document: ...
def on_change(self, attr, old, new): """ Process change events adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates. """ self._queue.append((attr, old, new)) if not self._active and self.plot.document: ...
[ "Process", "change", "events", "adding", "timeout", "to", "process", "multiple", "concerted", "value", "change", "at", "once", "rather", "than", "firing", "off", "multiple", "plot", "updates", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L322-L330
[ "def", "on_change", "(", "self", ",", "attr", ",", "old", ",", "new", ")", ":", "self", ".", "_queue", ".", "append", "(", "(", "attr", ",", "old", ",", "new", ")", ")", "if", "not", "self", ".", "_active", "and", "self", ".", "plot", ".", "doc...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ServerCallback.on_event
Process bokeh UIEvents adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates.
holoviews/plotting/bokeh/callbacks.py
def on_event(self, event): """ Process bokeh UIEvents adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates. """ self._queue.append((event)) if not self._active and self.plot.document: self.plot.document...
def on_event(self, event): """ Process bokeh UIEvents adding timeout to process multiple concerted value change at once rather than firing off multiple plot updates. """ self._queue.append((event)) if not self._active and self.plot.document: self.plot.document...
[ "Process", "bokeh", "UIEvents", "adding", "timeout", "to", "process", "multiple", "concerted", "value", "change", "at", "once", "rather", "than", "firing", "off", "multiple", "plot", "updates", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L333-L341
[ "def", "on_event", "(", "self", ",", "event", ")", ":", "self", ".", "_queue", ".", "append", "(", "(", "event", ")", ")", "if", "not", "self", ".", "_active", "and", "self", ".", "plot", ".", "document", ":", "self", ".", "plot", ".", "document", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ServerCallback.process_on_event
Trigger callback change event and triggering corresponding streams.
holoviews/plotting/bokeh/callbacks.py
def process_on_event(self): """ Trigger callback change event and triggering corresponding streams. """ if not self._queue: self._active = False return # Get unique event types in the queue events = list(OrderedDict([(event.event_name, event) ...
def process_on_event(self): """ Trigger callback change event and triggering corresponding streams. """ if not self._queue: self._active = False return # Get unique event types in the queue events = list(OrderedDict([(event.event_name, event) ...
[ "Trigger", "callback", "change", "event", "and", "triggering", "corresponding", "streams", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L344-L363
[ "def", "process_on_event", "(", "self", ")", ":", "if", "not", "self", ".", "_queue", ":", "self", ".", "_active", "=", "False", "return", "# Get unique event types in the queue", "events", "=", "list", "(", "OrderedDict", "(", "[", "(", "event", ".", "event...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ServerCallback.set_server_callback
Set up on_change events for bokeh server interactions.
holoviews/plotting/bokeh/callbacks.py
def set_server_callback(self, handle): """ Set up on_change events for bokeh server interactions. """ if self.on_events: for event in self.on_events: handle.on_event(event, self.on_event) if self.on_changes: for change in self.on_changes: ...
def set_server_callback(self, handle): """ Set up on_change events for bokeh server interactions. """ if self.on_events: for event in self.on_events: handle.on_event(event, self.on_event) if self.on_changes: for change in self.on_changes: ...
[ "Set", "up", "on_change", "events", "for", "bokeh", "server", "interactions", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L387-L399
[ "def", "set_server_callback", "(", "self", ",", "handle", ")", ":", "if", "self", ".", "on_events", ":", "for", "event", "in", "self", ".", "on_events", ":", "handle", ".", "on_event", "(", "event", ",", "self", ".", "on_event", ")", "if", "self", ".",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
PointerXYCallback._process_out_of_bounds
Clips out of bounds values
holoviews/plotting/bokeh/callbacks.py
def _process_out_of_bounds(self, value, start, end): "Clips out of bounds values" if isinstance(value, np.datetime64): v = dt64_to_dt(value) if isinstance(start, (int, float)): start = convert_timestamp(start) if isinstance(end, (int, float)): ...
def _process_out_of_bounds(self, value, start, end): "Clips out of bounds values" if isinstance(value, np.datetime64): v = dt64_to_dt(value) if isinstance(start, (int, float)): start = convert_timestamp(start) if isinstance(end, (int, float)): ...
[ "Clips", "out", "of", "bounds", "values" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L531-L552
[ "def", "_process_out_of_bounds", "(", "self", ",", "value", ",", "start", ",", "end", ")", ":", "if", "isinstance", "(", "value", ",", "np", ".", "datetime64", ")", ":", "v", "=", "dt64_to_dt", "(", "value", ")", "if", "isinstance", "(", "start", ",", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
LinkCallback.find_links
Traverses the supplied plot and searches for any Links on the plotted objects.
holoviews/plotting/bokeh/callbacks.py
def find_links(cls, root_plot): """ Traverses the supplied plot and searches for any Links on the plotted objects. """ plot_fn = lambda x: isinstance(x, GenericElementPlot) and not isinstance(x, GenericOverlayPlot) plots = root_plot.traverse(lambda x: x, [plot_fn]) ...
def find_links(cls, root_plot): """ Traverses the supplied plot and searches for any Links on the plotted objects. """ plot_fn = lambda x: isinstance(x, GenericElementPlot) and not isinstance(x, GenericOverlayPlot) plots = root_plot.traverse(lambda x: x, [plot_fn]) ...
[ "Traverses", "the", "supplied", "plot", "and", "searches", "for", "any", "Links", "on", "the", "plotted", "objects", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L1216-L1236
[ "def", "find_links", "(", "cls", ",", "root_plot", ")", ":", "plot_fn", "=", "lambda", "x", ":", "isinstance", "(", "x", ",", "GenericElementPlot", ")", "and", "not", "isinstance", "(", "x", ",", "GenericOverlayPlot", ")", "plots", "=", "root_plot", ".", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
LinkCallback.find_link
Searches a GenericElementPlot for a Link.
holoviews/plotting/bokeh/callbacks.py
def find_link(cls, plot, link=None): """ Searches a GenericElementPlot for a Link. """ registry = Link.registry.items() for source in plot.link_sources: if link is None: links = [ l for src, links in registry for l in links ...
def find_link(cls, plot, link=None): """ Searches a GenericElementPlot for a Link. """ registry = Link.registry.items() for source in plot.link_sources: if link is None: links = [ l for src, links in registry for l in links ...
[ "Searches", "a", "GenericElementPlot", "for", "a", "Link", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/bokeh/callbacks.py#L1239-L1257
[ "def", "find_link", "(", "cls", ",", "plot", ",", "link", "=", "None", ")", ":", "registry", "=", "Link", ".", "registry", ".", "items", "(", ")", "for", "source", "in", "plot", ".", "link_sources", ":", "if", "link", "is", "None", ":", "links", "=...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Annotation.dimension_values
Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten array Returns: NumPy array of values along the requested di...
holoviews/element/annotation.py
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
[ "Return", "the", "values", "along", "the", "requested", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/annotation.py#L54-L71
[ "def", "dimension_values", "(", "self", ",", "dimension", ",", "expanded", "=", "True", ",", "flat", "=", "True", ")", ":", "index", "=", "self", ".", "get_dimension_index", "(", "dimension", ")", "if", "index", "==", "0", ":", "return", "np", ".", "ar...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Spline.clone
Clones the object, overriding data and parameters. Args: data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to *args: Additional arguments to pass to constructor ...
holoviews/element/annotation.py
def clone(self, data=None, shared_data=True, new_type=None, *args, **overrides): """Clones the object, overriding data and parameters. Args: data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Typ...
def clone(self, data=None, shared_data=True, new_type=None, *args, **overrides): """Clones the object, overriding data and parameters. Args: data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Typ...
[ "Clones", "the", "object", "overriding", "data", "and", "parameters", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/annotation.py#L176-L190
[ "def", "clone", "(", "self", ",", "data", "=", "None", ",", "shared_data", "=", "True", ",", "new_type", "=", "None", ",", "*", "args", ",", "*", "*", "overrides", ")", ":", "return", "Element2D", ".", "clone", "(", "self", ",", "data", ",", "share...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Spline.dimension_values
Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten array Returns: NumPy array of values along the requested di...
holoviews/element/annotation.py
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
[ "Return", "the", "values", "along", "the", "requested", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/annotation.py#L192-L207
[ "def", "dimension_values", "(", "self", ",", "dimension", ",", "expanded", "=", "True", ",", "flat", "=", "True", ")", ":", "index", "=", "self", ".", "get_dimension_index", "(", "dimension", ")", "if", "index", "in", "[", "0", ",", "1", "]", ":", "r...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
Arrow.dimension_values
Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten array Returns: NumPy array of values along the requested di...
holoviews/element/annotation.py
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
def dimension_values(self, dimension, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten arra...
[ "Return", "the", "values", "along", "the", "requested", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/annotation.py#L263-L280
[ "def", "dimension_values", "(", "self", ",", "dimension", ",", "expanded", "=", "True", ",", "flat", "=", "True", ")", ":", "index", "=", "self", ".", "get_dimension_index", "(", "dimension", ")", "if", "index", "==", "0", ":", "return", "np", ".", "ar...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ItemTable.pprint_cell
Get the formatted cell value for the given row and column indices.
holoviews/element/tabular.py
def pprint_cell(self, row, col): """ Get the formatted cell value for the given row and column indices. """ if col > 2: raise Exception("Only two columns available in a ItemTable.") elif row >= self.rows: raise Exception("Maximum row index is %d" % self.ro...
def pprint_cell(self, row, col): """ Get the formatted cell value for the given row and column indices. """ if col > 2: raise Exception("Only two columns available in a ItemTable.") elif row >= self.rows: raise Exception("Maximum row index is %d" % self.ro...
[ "Get", "the", "formatted", "cell", "value", "for", "the", "given", "row", "and", "column", "indices", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/tabular.py#L102-L115
[ "def", "pprint_cell", "(", "self", ",", "row", ",", "col", ")", ":", "if", "col", ">", "2", ":", "raise", "Exception", "(", "\"Only two columns available in a ItemTable.\"", ")", "elif", "row", ">=", "self", ".", "rows", ":", "raise", "Exception", "(", "\"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
ItemTable.values
Deprecated method to access the ItemTable value dimension values.
holoviews/element/tabular.py
def values(self): """ Deprecated method to access the ItemTable value dimension values. """ self.param.warning('ItemTable values method is deprecated.') return tuple(self.data.get(d.name, np.NaN) for d in self.vdims)
def values(self): """ Deprecated method to access the ItemTable value dimension values. """ self.param.warning('ItemTable values method is deprecated.') return tuple(self.data.get(d.name, np.NaN) for d in self.vdims)
[ "Deprecated", "method", "to", "access", "the", "ItemTable", "value", "dimension", "values", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/tabular.py#L136-L142
[ "def", "values", "(", "self", ")", ":", "self", ".", "param", ".", "warning", "(", "'ItemTable values method is deprecated.'", ")", "return", "tuple", "(", "self", ".", "data", ".", "get", "(", "d", ".", "name", ",", "np", ".", "NaN", ")", "for", "d", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
process_object
Hook to process the object currently being displayed.
holoviews/ipython/display_hooks.py
def process_object(obj): "Hook to process the object currently being displayed." invalid_options = OptsMagic.process_element(obj) if invalid_options: return invalid_options OutputMagic.info(obj)
def process_object(obj): "Hook to process the object currently being displayed." invalid_options = OptsMagic.process_element(obj) if invalid_options: return invalid_options OutputMagic.info(obj)
[ "Hook", "to", "process", "the", "object", "currently", "being", "displayed", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L42-L46
[ "def", "process_object", "(", "obj", ")", ":", "invalid_options", "=", "OptsMagic", ".", "process_element", "(", "obj", ")", "if", "invalid_options", ":", "return", "invalid_options", "OutputMagic", ".", "info", "(", "obj", ")" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
single_frame_plot
Returns plot, renderer and format for single frame export.
holoviews/ipython/display_hooks.py
def single_frame_plot(obj): """ Returns plot, renderer and format for single frame export. """ obj = Layout.from_values(obj) if isinstance(obj, AdjointLayout) else obj backend = Store.current_backend renderer = Store.renderers[backend] plot_cls = renderer.plotting_class(obj) plot = plo...
def single_frame_plot(obj): """ Returns plot, renderer and format for single frame export. """ obj = Layout.from_values(obj) if isinstance(obj, AdjointLayout) else obj backend = Store.current_backend renderer = Store.renderers[backend] plot_cls = renderer.plotting_class(obj) plot = plo...
[ "Returns", "plot", "renderer", "and", "format", "for", "single", "frame", "export", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L68-L80
[ "def", "single_frame_plot", "(", "obj", ")", ":", "obj", "=", "Layout", ".", "from_values", "(", "obj", ")", "if", "isinstance", "(", "obj", ",", "AdjointLayout", ")", "else", "obj", "backend", "=", "Store", ".", "current_backend", "renderer", "=", "Store"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
first_frame
Only display the first frame of an animated plot
holoviews/ipython/display_hooks.py
def first_frame(obj): "Only display the first frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) plot.update(0) return {'text/html': renderer.html(plot, fmt)}
def first_frame(obj): "Only display the first frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) plot.update(0) return {'text/html': renderer.html(plot, fmt)}
[ "Only", "display", "the", "first", "frame", "of", "an", "animated", "plot" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L83-L87
[ "def", "first_frame", "(", "obj", ")", ":", "plot", ",", "renderer", ",", "fmt", "=", "single_frame_plot", "(", "obj", ")", "plot", ".", "update", "(", "0", ")", "return", "{", "'text/html'", ":", "renderer", ".", "html", "(", "plot", ",", "fmt", ")"...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
middle_frame
Only display the (approximately) middle frame of an animated plot
holoviews/ipython/display_hooks.py
def middle_frame(obj): "Only display the (approximately) middle frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) middle_frame = int(len(plot) / 2) plot.update(middle_frame) return {'text/html': renderer.html(plot, fmt)}
def middle_frame(obj): "Only display the (approximately) middle frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) middle_frame = int(len(plot) / 2) plot.update(middle_frame) return {'text/html': renderer.html(plot, fmt)}
[ "Only", "display", "the", "(", "approximately", ")", "middle", "frame", "of", "an", "animated", "plot" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L89-L94
[ "def", "middle_frame", "(", "obj", ")", ":", "plot", ",", "renderer", ",", "fmt", "=", "single_frame_plot", "(", "obj", ")", "middle_frame", "=", "int", "(", "len", "(", "plot", ")", "/", "2", ")", "plot", ".", "update", "(", "middle_frame", ")", "re...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
last_frame
Only display the last frame of an animated plot
holoviews/ipython/display_hooks.py
def last_frame(obj): "Only display the last frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) plot.update(len(plot)) return {'text/html': renderer.html(plot, fmt)}
def last_frame(obj): "Only display the last frame of an animated plot" plot, renderer, fmt = single_frame_plot(obj) plot.update(len(plot)) return {'text/html': renderer.html(plot, fmt)}
[ "Only", "display", "the", "last", "frame", "of", "an", "animated", "plot" ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L96-L100
[ "def", "last_frame", "(", "obj", ")", ":", "plot", ",", "renderer", ",", "fmt", "=", "single_frame_plot", "(", "obj", ")", "plot", ".", "update", "(", "len", "(", "plot", ")", ")", "return", "{", "'text/html'", ":", "renderer", ".", "html", "(", "plo...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
display_hook
A decorator to wrap display hooks that return a MIME bundle or None. Additionally it handles adding output to the notebook archive, saves files specified with the output magic and handles tracebacks.
holoviews/ipython/display_hooks.py
def display_hook(fn): """ A decorator to wrap display hooks that return a MIME bundle or None. Additionally it handles adding output to the notebook archive, saves files specified with the output magic and handles tracebacks. """ @wraps(fn) def wrapped(element): global FULL_TRACEBACK...
def display_hook(fn): """ A decorator to wrap display hooks that return a MIME bundle or None. Additionally it handles adding output to the notebook archive, saves files specified with the output magic and handles tracebacks. """ @wraps(fn) def wrapped(element): global FULL_TRACEBACK...
[ "A", "decorator", "to", "wrap", "display", "hooks", "that", "return", "a", "MIME", "bundle", "or", "None", ".", "Additionally", "it", "handles", "adding", "output", "to", "the", "notebook", "archive", "saves", "files", "specified", "with", "the", "output", "...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L128-L174
[ "def", "display_hook", "(", "fn", ")", ":", "@", "wraps", "(", "fn", ")", "def", "wrapped", "(", "element", ")", ":", "global", "FULL_TRACEBACK", "if", "Store", ".", "current_backend", "is", "None", ":", "return", "{", "}", ",", "{", "}", "try", ":",...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
display
Renders any HoloViews object to HTML and displays it using the IPython display function. If raw is enabled the raw HTML is returned instead of displaying it directly.
holoviews/ipython/display_hooks.py
def display(obj, raw_output=False, **kwargs): """ Renders any HoloViews object to HTML and displays it using the IPython display function. If raw is enabled the raw HTML is returned instead of displaying it directly. """ if not Store.loaded_backends() and isinstance(obj, Dimensioned): ra...
def display(obj, raw_output=False, **kwargs): """ Renders any HoloViews object to HTML and displays it using the IPython display function. If raw is enabled the raw HTML is returned instead of displaying it directly. """ if not Store.loaded_backends() and isinstance(obj, Dimensioned): ra...
[ "Renders", "any", "HoloViews", "object", "to", "HTML", "and", "displays", "it", "using", "the", "IPython", "display", "function", ".", "If", "raw", "is", "enabled", "the", "raw", "HTML", "is", "returned", "instead", "of", "displaying", "it", "directly", "." ...
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L230-L266
[ "def", "display", "(", "obj", ",", "raw_output", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "not", "Store", ".", "loaded_backends", "(", ")", "and", "isinstance", "(", "obj", ",", "Dimensioned", ")", ":", "raise", "RuntimeError", "(", "'To ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
image_display
Used to render elements to an image format (svg or png) if requested in the display formats.
holoviews/ipython/display_hooks.py
def image_display(element, max_frames, fmt): """ Used to render elements to an image format (svg or png) if requested in the display formats. """ if fmt not in Store.display_formats: return None info = process_object(element) if info: display(HTML(info)) return b...
def image_display(element, max_frames, fmt): """ Used to render elements to an image format (svg or png) if requested in the display formats. """ if fmt not in Store.display_formats: return None info = process_object(element) if info: display(HTML(info)) return b...
[ "Used", "to", "render", "elements", "to", "an", "image", "format", "(", "svg", "or", "png", ")", "if", "requested", "in", "the", "display", "formats", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/ipython/display_hooks.py#L280-L303
[ "def", "image_display", "(", "element", ",", "max_frames", ",", "fmt", ")", ":", "if", "fmt", "not", "in", "Store", ".", "display_formats", ":", "return", "None", "info", "=", "process_object", "(", "element", ")", "if", "info", ":", "display", "(", "HTM...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._map_order_to_ticks
Map elements from given `order` array to bins ranging from `start` to `end`.
holoviews/plotting/mpl/heatmap.py
def _map_order_to_ticks(start, end, order, reverse=False): """Map elements from given `order` array to bins ranging from `start` to `end`. """ size = len(order) bounds = np.linspace(start, end, size + 1) if reverse: bounds = bounds[::-1] mapping = list...
def _map_order_to_ticks(start, end, order, reverse=False): """Map elements from given `order` array to bins ranging from `start` to `end`. """ size = len(order) bounds = np.linspace(start, end, size + 1) if reverse: bounds = bounds[::-1] mapping = list...
[ "Map", "elements", "from", "given", "order", "array", "to", "bins", "ranging", "from", "start", "to", "end", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/heatmap.py#L270-L279
[ "def", "_map_order_to_ticks", "(", "start", ",", "end", ",", "order", ",", "reverse", "=", "False", ")", ":", "size", "=", "len", "(", "order", ")", "bounds", "=", "np", ".", "linspace", "(", "start", ",", "end", ",", "size", "+", "1", ")", "if", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
RadialHeatMapPlot._compute_separations
Compute x and y positions for separation lines for given angles.
holoviews/plotting/mpl/heatmap.py
def _compute_separations(inner, outer, angles): """Compute x and y positions for separation lines for given angles. """ return [np.array([[a, inner], [a, outer]]) for a in angles]
def _compute_separations(inner, outer, angles): """Compute x and y positions for separation lines for given angles. """ return [np.array([[a, inner], [a, outer]]) for a in angles]
[ "Compute", "x", "and", "y", "positions", "for", "separation", "lines", "for", "given", "angles", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/heatmap.py#L282-L286
[ "def", "_compute_separations", "(", "inner", ",", "outer", ",", "angles", ")", ":", "return", "[", "np", ".", "array", "(", "[", "[", "a", ",", "inner", "]", ",", "[", "a", ",", "outer", "]", "]", ")", "for", "a", "in", "angles", "]" ]
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
StatisticsElement.range
Return the lower and upper bounds of values along dimension. Args: dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): Include Dimension ranges Whether to include Dimension range and soft...
holoviews/element/stats.py
def range(self, dim, data_range=True, dimension_range=True): """Return the lower and upper bounds of values along dimension. Args: dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): Include Dime...
def range(self, dim, data_range=True, dimension_range=True): """Return the lower and upper bounds of values along dimension. Args: dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): Include Dime...
[ "Return", "the", "lower", "and", "upper", "bounds", "of", "values", "along", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/stats.py#L39-L53
[ "def", "range", "(", "self", ",", "dim", ",", "data_range", "=", "True", ",", "dimension_range", "=", "True", ")", ":", "iskdim", "=", "self", ".", "get_dimension", "(", "dim", ")", "not", "in", "self", ".", "vdims", "return", "super", "(", "Statistics...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
StatisticsElement.dimension_values
Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values Whether to return the expanded values, behavior depends on the type of data: * Colum...
holoviews/element/stats.py
def dimension_values(self, dim, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values Whether to return the expanded values, behavior ...
def dimension_values(self, dim, expanded=True, flat=True): """Return the values along the requested dimension. Args: dimension: The dimension to return values for expanded (bool, optional): Whether to expand values Whether to return the expanded values, behavior ...
[ "Return", "the", "values", "along", "the", "requested", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/stats.py#L56-L75
[ "def", "dimension_values", "(", "self", ",", "dim", ",", "expanded", "=", "True", ",", "flat", "=", "True", ")", ":", "dim", "=", "self", ".", "get_dimension", "(", "dim", ",", "strict", "=", "True", ")", "if", "dim", "in", "self", ".", "vdims", ":...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
StatisticsElement.get_dimension_type
Get the type of the requested dimension. Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None. Args: dimension: Dimension to look up by name or by index Returns: Declared type of values along the dimension
holoviews/element/stats.py
def get_dimension_type(self, dim): """Get the type of the requested dimension. Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None. Args: dimension: Dimension to look up by name or by index Returns: Decl...
def get_dimension_type(self, dim): """Get the type of the requested dimension. Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None. Args: dimension: Dimension to look up by name or by index Returns: Decl...
[ "Get", "the", "type", "of", "the", "requested", "dimension", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/stats.py#L78-L97
[ "def", "get_dimension_type", "(", "self", ",", "dim", ")", ":", "dim", "=", "self", ".", "get_dimension", "(", "dim", ")", "if", "dim", "is", "None", ":", "return", "None", "elif", "dim", ".", "type", "is", "not", "None", ":", "return", "dim", ".", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
StatisticsElement.dframe
Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi-)index Return...
holoviews/element/stats.py
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
def dframe(self, dimensions=None, multi_index=False): """Convert dimension values to DataFrame. Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions. Args: dimensions: Dimensions to return as columns mul...
[ "Convert", "dimension", "values", "to", "DataFrame", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/stats.py#L100-L123
[ "def", "dframe", "(", "self", ",", "dimensions", "=", "None", ",", "multi_index", "=", "False", ")", ":", "if", "dimensions", ":", "dimensions", "=", "[", "self", ".", "get_dimension", "(", "d", ",", "strict", "=", "True", ")", "for", "d", "in", "dim...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
StatisticsElement.columns
Convert dimension values to a dictionary. Returns a dictionary of column arrays along each dimension of the element. Args: dimensions: Dimensions to return as columns Returns: Dictionary of arrays for each dimension
holoviews/element/stats.py
def columns(self, dimensions=None): """Convert dimension values to a dictionary. Returns a dictionary of column arrays along each dimension of the element. Args: dimensions: Dimensions to return as columns Returns: Dictionary of arrays for each dimensio...
def columns(self, dimensions=None): """Convert dimension values to a dictionary. Returns a dictionary of column arrays along each dimension of the element. Args: dimensions: Dimensions to return as columns Returns: Dictionary of arrays for each dimensio...
[ "Convert", "dimension", "values", "to", "a", "dictionary", "." ]
pyviz/holoviews
python
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/element/stats.py#L126-L148
[ "def", "columns", "(", "self", ",", "dimensions", "=", "None", ")", ":", "if", "dimensions", "is", "None", ":", "dimensions", "=", "self", ".", "kdims", "else", ":", "dimensions", "=", "[", "self", ".", "get_dimension", "(", "d", ",", "strict", "=", ...
ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655
train
mavudpin_multi.recv_msg
message receive routine for UDP link
dronekit/mavlink.py
def recv_msg(self): '''message receive routine for UDP link''' self.pre_message() s = self.recv() if len(s) > 0: if self.first_byte: self.auto_mavlink_version(s) m = self.mav.parse_char(s) if m is not None: self.post_message(m) ...
def recv_msg(self): '''message receive routine for UDP link''' self.pre_message() s = self.recv() if len(s) > 0: if self.first_byte: self.auto_mavlink_version(s) m = self.mav.parse_char(s) if m is not None: self.post_message(m) ...
[ "message", "receive", "routine", "for", "UDP", "link" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/mavlink.py#L99-L111
[ "def", "recv_msg", "(", "self", ")", ":", "self", ".", "pre_message", "(", ")", "s", "=", "self", ".", "recv", "(", ")", "if", "len", "(", "s", ")", ">", "0", ":", "if", "self", ".", "first_byte", ":", "self", ".", "auto_mavlink_version", "(", "s...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
condition_yaw
Send MAV_CMD_CONDITION_YAW message to point vehicle at a specified heading (in degrees). This method sets an absolute heading by default, but you can set the `relative` parameter to `True` to set yaw relative to the current yaw heading. By default the yaw of the vehicle will follow the direction of travel...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def condition_yaw(heading, relative=False): """ Send MAV_CMD_CONDITION_YAW message to point vehicle at a specified heading (in degrees). This method sets an absolute heading by default, but you can set the `relative` parameter to `True` to set yaw relative to the current yaw heading. By default th...
def condition_yaw(heading, relative=False): """ Send MAV_CMD_CONDITION_YAW message to point vehicle at a specified heading (in degrees). This method sets an absolute heading by default, but you can set the `relative` parameter to `True` to set yaw relative to the current yaw heading. By default th...
[ "Send", "MAV_CMD_CONDITION_YAW", "message", "to", "point", "vehicle", "at", "a", "specified", "heading", "(", "in", "degrees", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L95-L124
[ "def", "condition_yaw", "(", "heading", ",", "relative", "=", "False", ")", ":", "if", "relative", ":", "is_relative", "=", "1", "#yaw relative to direction of travel", "else", ":", "is_relative", "=", "0", "#yaw is an absolute angle", "# create the CONDITION_YAW comman...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
set_roi
Send MAV_CMD_DO_SET_ROI message to point camera gimbal at a specified region of interest (LocationGlobal). The vehicle may also turn to face the ROI. For more information see: http://copter.ardupilot.com/common-mavlink-mission-command-messages-mav_cmd/#mav_cmd_do_set_roi
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def set_roi(location): """ Send MAV_CMD_DO_SET_ROI message to point camera gimbal at a specified region of interest (LocationGlobal). The vehicle may also turn to face the ROI. For more information see: http://copter.ardupilot.com/common-mavlink-mission-command-messages-mav_cmd/#mav_cmd_do_se...
def set_roi(location): """ Send MAV_CMD_DO_SET_ROI message to point camera gimbal at a specified region of interest (LocationGlobal). The vehicle may also turn to face the ROI. For more information see: http://copter.ardupilot.com/common-mavlink-mission-command-messages-mav_cmd/#mav_cmd_do_se...
[ "Send", "MAV_CMD_DO_SET_ROI", "message", "to", "point", "camera", "gimbal", "at", "a", "specified", "region", "of", "interest", "(", "LocationGlobal", ")", ".", "The", "vehicle", "may", "also", "turn", "to", "face", "the", "ROI", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L127-L147
[ "def", "set_roi", "(", "location", ")", ":", "# create the MAV_CMD_DO_SET_ROI command", "msg", "=", "vehicle", ".", "message_factory", ".", "command_long_encode", "(", "0", ",", "0", ",", "# target system, target component", "mavutil", ".", "mavlink", ".", "MAV_CMD_DO...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
get_location_metres
Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned LocationGlobal has the same `alt` value as `original_location`. The function is useful when you want to move the vehicle around specifying locations relative t...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def get_location_metres(original_location, dNorth, dEast): """ Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned LocationGlobal has the same `alt` value as `original_location`. The function is useful w...
def get_location_metres(original_location, dNorth, dEast): """ Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned LocationGlobal has the same `alt` value as `original_location`. The function is useful w...
[ "Returns", "a", "LocationGlobal", "object", "containing", "the", "latitude", "/", "longitude", "dNorth", "and", "dEast", "metres", "from", "the", "specified", "original_location", ".", "The", "returned", "LocationGlobal", "has", "the", "same", "alt", "value", "as"...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L165-L194
[ "def", "get_location_metres", "(", "original_location", ",", "dNorth", ",", "dEast", ")", ":", "earth_radius", "=", "6378137.0", "#Radius of \"spherical\" earth", "#Coordinate offsets in radians", "dLat", "=", "dNorth", "/", "earth_radius", "dLon", "=", "dEast", "/", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
get_distance_metres
Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/diydrones/ardupilot/blob/master/Tools/autotest/common.py
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def get_distance_metres(aLocation1, aLocation2): """ Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/d...
def get_distance_metres(aLocation1, aLocation2): """ Returns the ground distance in metres between two LocationGlobal objects. This method is an approximation, and will not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/d...
[ "Returns", "the", "ground", "distance", "in", "metres", "between", "two", "LocationGlobal", "objects", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L197-L207
[ "def", "get_distance_metres", "(", "aLocation1", ",", "aLocation2", ")", ":", "dlat", "=", "aLocation2", ".", "lat", "-", "aLocation1", ".", "lat", "dlong", "=", "aLocation2", ".", "lon", "-", "aLocation1", ".", "lon", "return", "math", ".", "sqrt", "(", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
get_bearing
Returns the bearing between the two LocationGlobal objects passed as parameters. This method is an approximation, and may not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/diydrones/ardupilot/blob/master/Tools/autotest/common.py
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def get_bearing(aLocation1, aLocation2): """ Returns the bearing between the two LocationGlobal objects passed as parameters. This method is an approximation, and may not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/diy...
def get_bearing(aLocation1, aLocation2): """ Returns the bearing between the two LocationGlobal objects passed as parameters. This method is an approximation, and may not be accurate over large distances and close to the earth's poles. It comes from the ArduPilot test code: https://github.com/diy...
[ "Returns", "the", "bearing", "between", "the", "two", "LocationGlobal", "objects", "passed", "as", "parameters", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L210-L223
[ "def", "get_bearing", "(", "aLocation1", ",", "aLocation2", ")", ":", "off_x", "=", "aLocation2", ".", "lon", "-", "aLocation1", ".", "lon", "off_y", "=", "aLocation2", ".", "lat", "-", "aLocation1", ".", "lat", "bearing", "=", "90.00", "+", "math", ".",...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
goto_position_target_global_int
Send SET_POSITION_TARGET_GLOBAL_INT command to request the vehicle fly to a specified LocationGlobal. For more information see: https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT See the above link for information on the type_mask (0=enable, 1=ignore). At time of writing, acceleration and ya...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def goto_position_target_global_int(aLocation): """ Send SET_POSITION_TARGET_GLOBAL_INT command to request the vehicle fly to a specified LocationGlobal. For more information see: https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT See the above link for information on the type_mask (0=ena...
def goto_position_target_global_int(aLocation): """ Send SET_POSITION_TARGET_GLOBAL_INT command to request the vehicle fly to a specified LocationGlobal. For more information see: https://pixhawk.ethz.ch/mavlink/#SET_POSITION_TARGET_GLOBAL_INT See the above link for information on the type_mask (0=ena...
[ "Send", "SET_POSITION_TARGET_GLOBAL_INT", "command", "to", "request", "the", "vehicle", "fly", "to", "a", "specified", "LocationGlobal", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L241-L264
[ "def", "goto_position_target_global_int", "(", "aLocation", ")", ":", "msg", "=", "vehicle", ".", "message_factory", ".", "set_position_target_global_int_encode", "(", "0", ",", "# time_boot_ms (not used)", "0", ",", "0", ",", "# target system, target component", "mavutil...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
goto_position_target_local_ned
Send SET_POSITION_TARGET_LOCAL_NED command to request the vehicle fly to a specified location in the North, East, Down frame. It is important to remember that in this frame, positive altitudes are entered as negative "Down" values. So if down is "10", this will be 10 metres below the home altitude. ...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def goto_position_target_local_ned(north, east, down): """ Send SET_POSITION_TARGET_LOCAL_NED command to request the vehicle fly to a specified location in the North, East, Down frame. It is important to remember that in this frame, positive altitudes are entered as negative "Down" values. So if...
def goto_position_target_local_ned(north, east, down): """ Send SET_POSITION_TARGET_LOCAL_NED command to request the vehicle fly to a specified location in the North, East, Down frame. It is important to remember that in this frame, positive altitudes are entered as negative "Down" values. So if...
[ "Send", "SET_POSITION_TARGET_LOCAL_NED", "command", "to", "request", "the", "vehicle", "fly", "to", "a", "specified", "location", "in", "the", "North", "East", "Down", "frame", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L268-L294
[ "def", "goto_position_target_local_ned", "(", "north", ",", "east", ",", "down", ")", ":", "msg", "=", "vehicle", ".", "message_factory", ".", "set_position_target_local_ned_encode", "(", "0", ",", "# time_boot_ms (not used)", "0", ",", "0", ",", "# target system, t...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
goto
Moves the vehicle to a position dNorth metres North and dEast metres East of the current position. The method takes a function pointer argument with a single `dronekit.lib.LocationGlobal` parameter for the target position. This allows it to be called with different position-setting commands. By default i...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def goto(dNorth, dEast, gotoFunction=vehicle.simple_goto): """ Moves the vehicle to a position dNorth metres North and dEast metres East of the current position. The method takes a function pointer argument with a single `dronekit.lib.LocationGlobal` parameter for the target position. This allows it t...
def goto(dNorth, dEast, gotoFunction=vehicle.simple_goto): """ Moves the vehicle to a position dNorth metres North and dEast metres East of the current position. The method takes a function pointer argument with a single `dronekit.lib.LocationGlobal` parameter for the target position. This allows it t...
[ "Moves", "the", "vehicle", "to", "a", "position", "dNorth", "metres", "North", "and", "dEast", "metres", "East", "of", "the", "current", "position", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L298-L324
[ "def", "goto", "(", "dNorth", ",", "dEast", ",", "gotoFunction", "=", "vehicle", ".", "simple_goto", ")", ":", "currentLocation", "=", "vehicle", ".", "location", ".", "global_relative_frame", "targetLocation", "=", "get_location_metres", "(", "currentLocation", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
send_ned_velocity
Move vehicle in direction based on specified velocity vectors and for the specified duration. This uses the SET_POSITION_TARGET_LOCAL_NED command with a type mask enabling only velocity components (http://dev.ardupilot.com/wiki/copter-commands-in-guided-mode/#set_position_target_local_ned). ...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def send_ned_velocity(velocity_x, velocity_y, velocity_z, duration): """ Move vehicle in direction based on specified velocity vectors and for the specified duration. This uses the SET_POSITION_TARGET_LOCAL_NED command with a type mask enabling only velocity components (http://dev.ardupilot.c...
def send_ned_velocity(velocity_x, velocity_y, velocity_z, duration): """ Move vehicle in direction based on specified velocity vectors and for the specified duration. This uses the SET_POSITION_TARGET_LOCAL_NED command with a type mask enabling only velocity components (http://dev.ardupilot.c...
[ "Move", "vehicle", "in", "direction", "based", "on", "specified", "velocity", "vectors", "and", "for", "the", "specified", "duration", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L339-L369
[ "def", "send_ned_velocity", "(", "velocity_x", ",", "velocity_y", ",", "velocity_z", ",", "duration", ")", ":", "msg", "=", "vehicle", ".", "message_factory", ".", "set_position_target_local_ned_encode", "(", "0", ",", "# time_boot_ms (not used)", "0", ",", "0", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
send_global_velocity
Move vehicle in direction based on specified velocity vectors. This uses the SET_POSITION_TARGET_GLOBAL_INT command with type mask enabling only velocity components (http://dev.ardupilot.com/wiki/copter-commands-in-guided-mode/#set_position_target_global_int). Note that from AC3.3 the message sh...
examples/guided_set_speed_yaw/guided_set_speed_yaw.py
def send_global_velocity(velocity_x, velocity_y, velocity_z, duration): """ Move vehicle in direction based on specified velocity vectors. This uses the SET_POSITION_TARGET_GLOBAL_INT command with type mask enabling only velocity components (http://dev.ardupilot.com/wiki/copter-commands-in-guided...
def send_global_velocity(velocity_x, velocity_y, velocity_z, duration): """ Move vehicle in direction based on specified velocity vectors. This uses the SET_POSITION_TARGET_GLOBAL_INT command with type mask enabling only velocity components (http://dev.ardupilot.com/wiki/copter-commands-in-guided...
[ "Move", "vehicle", "in", "direction", "based", "on", "specified", "velocity", "vectors", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/guided_set_speed_yaw/guided_set_speed_yaw.py#L374-L408
[ "def", "send_global_velocity", "(", "velocity_x", ",", "velocity_y", ",", "velocity_z", ",", "duration", ")", ":", "msg", "=", "vehicle", ".", "message_factory", ".", "set_position_target_global_int_encode", "(", "0", ",", "# time_boot_ms (not used)", "0", ",", "0",...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
readmission
Load a mission from a file into a list. The mission definition is in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). This function is used by upload_mission().
examples/mission_import_export/mission_import_export.py
def readmission(aFileName): """ Load a mission from a file into a list. The mission definition is in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). This function is used by upload_mission(). """ print("\nReading mission from file: %s" % aFil...
def readmission(aFileName): """ Load a mission from a file into a list. The mission definition is in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). This function is used by upload_mission(). """ print("\nReading mission from file: %s" % aFil...
[ "Load", "a", "mission", "from", "a", "file", "into", "a", "list", ".", "The", "mission", "definition", "is", "in", "the", "Waypoint", "file", "format", "(", "http", ":", "//", "qgroundcontrol", ".", "org", "/", "mavlink", "/", "waypoint_protocol#waypoint_fil...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_import_export/mission_import_export.py#L51-L82
[ "def", "readmission", "(", "aFileName", ")", ":", "print", "(", "\"\\nReading mission from file: %s\"", "%", "aFileName", ")", "cmds", "=", "vehicle", ".", "commands", "missionlist", "=", "[", "]", "with", "open", "(", "aFileName", ")", "as", "f", ":", "for"...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
upload_mission
Upload a mission from a file.
examples/mission_import_export/mission_import_export.py
def upload_mission(aFileName): """ Upload a mission from a file. """ #Read mission from file missionlist = readmission(aFileName) print("\nUpload mission from a file: %s" % aFileName) #Clear existing mission from vehicle print(' Clear mission') cmds = vehicle.commands cmds....
def upload_mission(aFileName): """ Upload a mission from a file. """ #Read mission from file missionlist = readmission(aFileName) print("\nUpload mission from a file: %s" % aFileName) #Clear existing mission from vehicle print(' Clear mission') cmds = vehicle.commands cmds....
[ "Upload", "a", "mission", "from", "a", "file", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_import_export/mission_import_export.py#L85-L101
[ "def", "upload_mission", "(", "aFileName", ")", ":", "#Read mission from file", "missionlist", "=", "readmission", "(", "aFileName", ")", "print", "(", "\"\\nUpload mission from a file: %s\"", "%", "aFileName", ")", "#Clear existing mission from vehicle", "print", "(", "'...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
download_mission
Downloads the current mission and returns it in a list. It is used in save_mission() to get the file information to save.
examples/mission_import_export/mission_import_export.py
def download_mission(): """ Downloads the current mission and returns it in a list. It is used in save_mission() to get the file information to save. """ print(" Download mission from vehicle") missionlist=[] cmds = vehicle.commands cmds.download() cmds.wait_ready() for cmd in cm...
def download_mission(): """ Downloads the current mission and returns it in a list. It is used in save_mission() to get the file information to save. """ print(" Download mission from vehicle") missionlist=[] cmds = vehicle.commands cmds.download() cmds.wait_ready() for cmd in cm...
[ "Downloads", "the", "current", "mission", "and", "returns", "it", "in", "a", "list", ".", "It", "is", "used", "in", "save_mission", "()", "to", "get", "the", "file", "information", "to", "save", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_import_export/mission_import_export.py#L104-L116
[ "def", "download_mission", "(", ")", ":", "print", "(", "\" Download mission from vehicle\"", ")", "missionlist", "=", "[", "]", "cmds", "=", "vehicle", ".", "commands", "cmds", ".", "download", "(", ")", "cmds", ".", "wait_ready", "(", ")", "for", "cmd", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
save_mission
Save a mission in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format).
examples/mission_import_export/mission_import_export.py
def save_mission(aFileName): """ Save a mission in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). """ print("\nSave mission from Vehicle to file: %s" % aFileName) #Download mission from vehicle missionlist = download_mission() #A...
def save_mission(aFileName): """ Save a mission in the Waypoint file format (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format). """ print("\nSave mission from Vehicle to file: %s" % aFileName) #Download mission from vehicle missionlist = download_mission() #A...
[ "Save", "a", "mission", "in", "the", "Waypoint", "file", "format", "(", "http", ":", "//", "qgroundcontrol", ".", "org", "/", "mavlink", "/", "waypoint_protocol#waypoint_file_format", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_import_export/mission_import_export.py#L118-L137
[ "def", "save_mission", "(", "aFileName", ")", ":", "print", "(", "\"\\nSave mission from Vehicle to file: %s\"", "%", "aFileName", ")", "#Download mission from vehicle", "missionlist", "=", "download_mission", "(", ")", "#Add file-format information", "output", "=", "'QGC W...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
printfile
Print a mission file to demonstrate "round trip"
examples/mission_import_export/mission_import_export.py
def printfile(aFileName): """ Print a mission file to demonstrate "round trip" """ print("\nMission file: %s" % aFileName) with open(aFileName) as f: for line in f: print(' %s' % line.strip())
def printfile(aFileName): """ Print a mission file to demonstrate "round trip" """ print("\nMission file: %s" % aFileName) with open(aFileName) as f: for line in f: print(' %s' % line.strip())
[ "Print", "a", "mission", "file", "to", "demonstrate", "round", "trip" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_import_export/mission_import_export.py#L140-L147
[ "def", "printfile", "(", "aFileName", ")", ":", "print", "(", "\"\\nMission file: %s\"", "%", "aFileName", ")", "with", "open", "(", "aFileName", ")", "as", "f", ":", "for", "line", "in", "f", ":", "print", "(", "' %s'", "%", "line", ".", "strip", "(",...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
distance_to_current_waypoint
Gets distance in metres to the current waypoint. It returns None for the first waypoint (Home location).
examples/flight_replay/flight_replay.py
def distance_to_current_waypoint(): """ Gets distance in metres to the current waypoint. It returns None for the first waypoint (Home location). """ nextwaypoint = vehicle.commands.next if nextwaypoint==0: return None missionitem=vehicle.commands[nextwaypoint-1] #commands are zero i...
def distance_to_current_waypoint(): """ Gets distance in metres to the current waypoint. It returns None for the first waypoint (Home location). """ nextwaypoint = vehicle.commands.next if nextwaypoint==0: return None missionitem=vehicle.commands[nextwaypoint-1] #commands are zero i...
[ "Gets", "distance", "in", "metres", "to", "the", "current", "waypoint", ".", "It", "returns", "None", "for", "the", "first", "waypoint", "(", "Home", "location", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/flight_replay/flight_replay.py#L43-L57
[ "def", "distance_to_current_waypoint", "(", ")", ":", "nextwaypoint", "=", "vehicle", ".", "commands", ".", "next", "if", "nextwaypoint", "==", "0", ":", "return", "None", "missionitem", "=", "vehicle", ".", "commands", "[", "nextwaypoint", "-", "1", "]", "#...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
position_messages_from_tlog
Given telemetry log, get a series of wpts approximating the previous flight
examples/flight_replay/flight_replay.py
def position_messages_from_tlog(filename): """ Given telemetry log, get a series of wpts approximating the previous flight """ # Pull out just the global position msgs messages = [] mlog = mavutil.mavlink_connection(filename) while True: try: m = mlog.recv_match(type=['GL...
def position_messages_from_tlog(filename): """ Given telemetry log, get a series of wpts approximating the previous flight """ # Pull out just the global position msgs messages = [] mlog = mavutil.mavlink_connection(filename) while True: try: m = mlog.recv_match(type=['GL...
[ "Given", "telemetry", "log", "get", "a", "series", "of", "wpts", "approximating", "the", "previous", "flight" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/flight_replay/flight_replay.py#L59-L101
[ "def", "position_messages_from_tlog", "(", "filename", ")", ":", "# Pull out just the global position msgs", "messages", "=", "[", "]", "mlog", "=", "mavutil", ".", "mavlink_connection", "(", "filename", ")", "while", "True", ":", "try", ":", "m", "=", "mlog", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
arm_and_takeoff
Arms vehicle and fly to aTargetAltitude.
examples/flight_replay/flight_replay.py
def arm_and_takeoff(aTargetAltitude): """ Arms vehicle and fly to aTargetAltitude. """ # Don't try to arm until autopilot is ready while not vehicle.is_armable: print(" Waiting for vehicle to initialise...") time.sleep(1) # Set mode to GUIDED for arming and takeoff: ...
def arm_and_takeoff(aTargetAltitude): """ Arms vehicle and fly to aTargetAltitude. """ # Don't try to arm until autopilot is ready while not vehicle.is_armable: print(" Waiting for vehicle to initialise...") time.sleep(1) # Set mode to GUIDED for arming and takeoff: ...
[ "Arms", "vehicle", "and", "fly", "to", "aTargetAltitude", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/flight_replay/flight_replay.py#L104-L138
[ "def", "arm_and_takeoff", "(", "aTargetAltitude", ")", ":", "# Don't try to arm until autopilot is ready", "while", "not", "vehicle", ".", "is_armable", ":", "print", "(", "\" Waiting for vehicle to initialise...\"", ")", "time", ".", "sleep", "(", "1", ")", "# Set mode...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
get_location_metres
Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned Location has the same `alt` value as `original_location`. The function is useful when you want to move the vehicle around specifying locations relative to ...
examples/mission_basic/mission_basic.py
def get_location_metres(original_location, dNorth, dEast): """ Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned Location has the same `alt` value as `original_location`. The function is useful when yo...
def get_location_metres(original_location, dNorth, dEast): """ Returns a LocationGlobal object containing the latitude/longitude `dNorth` and `dEast` metres from the specified `original_location`. The returned Location has the same `alt` value as `original_location`. The function is useful when yo...
[ "Returns", "a", "LocationGlobal", "object", "containing", "the", "latitude", "/", "longitude", "dNorth", "and", "dEast", "metres", "from", "the", "specified", "original_location", ".", "The", "returned", "Location", "has", "the", "same", "alt", "value", "as", "o...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_basic/mission_basic.py#L41-L61
[ "def", "get_location_metres", "(", "original_location", ",", "dNorth", ",", "dEast", ")", ":", "earth_radius", "=", "6378137.0", "#Radius of \"spherical\" earth", "#Coordinate offsets in radians", "dLat", "=", "dNorth", "/", "earth_radius", "dLon", "=", "dEast", "/", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
adds_square_mission
Adds a takeoff command and four waypoint commands to the current mission. The waypoints are positioned to form a square of side length 2*aSize around the specified LocationGlobal (aLocation). The function assumes vehicle.commands matches the vehicle mission state (you must have called download at least o...
examples/mission_basic/mission_basic.py
def adds_square_mission(aLocation, aSize): """ Adds a takeoff command and four waypoint commands to the current mission. The waypoints are positioned to form a square of side length 2*aSize around the specified LocationGlobal (aLocation). The function assumes vehicle.commands matches the vehicle missi...
def adds_square_mission(aLocation, aSize): """ Adds a takeoff command and four waypoint commands to the current mission. The waypoints are positioned to form a square of side length 2*aSize around the specified LocationGlobal (aLocation). The function assumes vehicle.commands matches the vehicle missi...
[ "Adds", "a", "takeoff", "command", "and", "four", "waypoint", "commands", "to", "the", "current", "mission", ".", "The", "waypoints", "are", "positioned", "to", "form", "a", "square", "of", "side", "length", "2", "*", "aSize", "around", "the", "specified", ...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/mission_basic/mission_basic.py#L105-L138
[ "def", "adds_square_mission", "(", "aLocation", ",", "aSize", ")", ":", "cmds", "=", "vehicle", ".", "commands", "print", "(", "\" Clear any existing commands\"", ")", "cmds", ".", "clear", "(", ")", "print", "(", "\" Define/add new commands.\"", ")", "# Add new c...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
connect
Returns a :py:class:`Vehicle` object connected to the address specified by string parameter ``ip``. Connection string parameters (``ip``) for different targets are listed in the :ref:`getting started guide <get_started_connecting>`. The method is usually called with ``wait_ready=True`` to ensure that vehicle p...
dronekit/__init__.py
def connect(ip, _initialize=True, wait_ready=None, timeout=30, still_waiting_callback=default_still_waiting_callback, still_waiting_interval=1, status_printer=None, vehicle_class=None, rate=4, baud=115200, ...
def connect(ip, _initialize=True, wait_ready=None, timeout=30, still_waiting_callback=default_still_waiting_callback, still_waiting_interval=1, status_printer=None, vehicle_class=None, rate=4, baud=115200, ...
[ "Returns", "a", ":", "py", ":", "class", ":", "Vehicle", "object", "connected", "to", "the", "address", "specified", "by", "string", "parameter", "ip", ".", "Connection", "string", "parameters", "(", "ip", ")", "for", "different", "targets", "are", "listed",...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L3085-L3176
[ "def", "connect", "(", "ip", ",", "_initialize", "=", "True", ",", "wait_ready", "=", "None", ",", "timeout", "=", "30", ",", "still_waiting_callback", "=", "default_still_waiting_callback", ",", "still_waiting_interval", "=", "1", ",", "status_printer", "=", "N...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
LocationLocal.distance_home
Distance away from home, in meters. Returns 3D distance if `down` is known, otherwise 2D distance.
dronekit/__init__.py
def distance_home(self): """ Distance away from home, in meters. Returns 3D distance if `down` is known, otherwise 2D distance. """ if self.north is not None and self.east is not None: if self.down is not None: return math.sqrt(self.north**2 + self.east**2 + ...
def distance_home(self): """ Distance away from home, in meters. Returns 3D distance if `down` is known, otherwise 2D distance. """ if self.north is not None and self.east is not None: if self.down is not None: return math.sqrt(self.north**2 + self.east**2 + ...
[ "Distance", "away", "from", "home", "in", "meters", ".", "Returns", "3D", "distance", "if", "down", "is", "known", "otherwise", "2D", "distance", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L187-L196
[ "def", "distance_home", "(", "self", ")", ":", "if", "self", ".", "north", "is", "not", "None", "and", "self", ".", "east", "is", "not", "None", ":", "if", "self", ".", "down", "is", "not", "None", ":", "return", "math", ".", "sqrt", "(", "self", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
HasObservers.add_attribute_listener
Add an attribute listener callback. The callback function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are updated whenever a message is received from the vehicle. Attributes wh...
dronekit/__init__.py
def add_attribute_listener(self, attr_name, observer): """ Add an attribute listener callback. The callback function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are upd...
def add_attribute_listener(self, attr_name, observer): """ Add an attribute listener callback. The callback function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are upd...
[ "Add", "an", "attribute", "listener", "callback", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L542-L590
[ "def", "add_attribute_listener", "(", "self", ",", "attr_name", ",", "observer", ")", ":", "listeners_for_attr", "=", "self", ".", "_attribute_listeners", ".", "get", "(", "attr_name", ")", "if", "listeners_for_attr", "is", "None", ":", "listeners_for_attr", "=", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
HasObservers.remove_attribute_listener
Remove an attribute listener (observer) that was previously added using :py:func:`add_attribute_listener`. For example, the following line would remove a previously added vehicle 'global_frame' observer called ``location_callback``: .. code:: python vehicle.remove_attribute_listen...
dronekit/__init__.py
def remove_attribute_listener(self, attr_name, observer): """ Remove an attribute listener (observer) that was previously added using :py:func:`add_attribute_listener`. For example, the following line would remove a previously added vehicle 'global_frame' observer called ``location_call...
def remove_attribute_listener(self, attr_name, observer): """ Remove an attribute listener (observer) that was previously added using :py:func:`add_attribute_listener`. For example, the following line would remove a previously added vehicle 'global_frame' observer called ``location_call...
[ "Remove", "an", "attribute", "listener", "(", "observer", ")", "that", "was", "previously", "added", "using", ":", "py", ":", "func", ":", "add_attribute_listener", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L592-L613
[ "def", "remove_attribute_listener", "(", "self", ",", "attr_name", ",", "observer", ")", ":", "listeners_for_attr", "=", "self", ".", "_attribute_listeners", ".", "get", "(", "attr_name", ")", "if", "listeners_for_attr", "is", "not", "None", ":", "listeners_for_at...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
HasObservers.notify_attribute_listeners
This method is used to update attribute observers when the named attribute is updated. You should call it in your message listeners after updating an attribute with information from a vehicle message. By default the value of ``cache`` is ``False`` and every update from the vehicle is sent to l...
dronekit/__init__.py
def notify_attribute_listeners(self, attr_name, value, cache=False): """ This method is used to update attribute observers when the named attribute is updated. You should call it in your message listeners after updating an attribute with information from a vehicle message. By d...
def notify_attribute_listeners(self, attr_name, value, cache=False): """ This method is used to update attribute observers when the named attribute is updated. You should call it in your message listeners after updating an attribute with information from a vehicle message. By d...
[ "This", "method", "is", "used", "to", "update", "attribute", "observers", "when", "the", "named", "attribute", "is", "updated", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L615-L653
[ "def", "notify_attribute_listeners", "(", "self", ",", "attr_name", ",", "value", ",", "cache", "=", "False", ")", ":", "# Cached values are not re-sent if they are unchanged.", "if", "cache", ":", "if", "self", ".", "_attribute_cache", ".", "get", "(", "attr_name",...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
HasObservers.on_attribute
Decorator for attribute listeners. The decorated function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are updated whenever a message is received from the vehicle. Attributes wh...
dronekit/__init__.py
def on_attribute(self, name): """ Decorator for attribute listeners. The decorated function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are updated whenever a m...
def on_attribute(self, name): """ Decorator for attribute listeners. The decorated function (``observer``) is invoked differently depending on the *type of attribute*. Attributes that represent sensor values or which are used to monitor connection status are updated whenever a m...
[ "Decorator", "for", "attribute", "listeners", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L655-L700
[ "def", "on_attribute", "(", "self", ",", "name", ")", ":", "def", "decorator", "(", "fn", ")", ":", "if", "isinstance", "(", "name", ",", "list", ")", ":", "for", "n", "in", "name", ":", "self", ".", "add_attribute_listener", "(", "n", ",", "fn", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.on_message
Decorator for message listener callback functions. .. tip:: This is the most elegant way to define message listener callback functions. Use :py:func:`add_message_listener` only if you need to be able to :py:func:`remove the listener <remove_message_listener>` later. ...
dronekit/__init__.py
def on_message(self, name): """ Decorator for message listener callback functions. .. tip:: This is the most elegant way to define message listener callback functions. Use :py:func:`add_message_listener` only if you need to be able to :py:func:`remove the li...
def on_message(self, name): """ Decorator for message listener callback functions. .. tip:: This is the most elegant way to define message listener callback functions. Use :py:func:`add_message_listener` only if you need to be able to :py:func:`remove the li...
[ "Decorator", "for", "message", "listener", "callback", "functions", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1433-L1471
[ "def", "on_message", "(", "self", ",", "name", ")", ":", "def", "decorator", "(", "fn", ")", ":", "if", "isinstance", "(", "name", ",", "list", ")", ":", "for", "n", "in", "name", ":", "self", ".", "add_message_listener", "(", "n", ",", "fn", ")", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.add_message_listener
Adds a message listener function that will be called every time the specified message is received. .. tip:: We recommend you use :py:func:`on_message` instead of this method as it has a more elegant syntax. This method is only preferred if you need to be able to :py:func:`r...
dronekit/__init__.py
def add_message_listener(self, name, fn): """ Adds a message listener function that will be called every time the specified message is received. .. tip:: We recommend you use :py:func:`on_message` instead of this method as it has a more elegant syntax. This method is on...
def add_message_listener(self, name, fn): """ Adds a message listener function that will be called every time the specified message is received. .. tip:: We recommend you use :py:func:`on_message` instead of this method as it has a more elegant syntax. This method is on...
[ "Adds", "a", "message", "listener", "function", "that", "will", "be", "called", "every", "time", "the", "specified", "message", "is", "received", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1473-L1509
[ "def", "add_message_listener", "(", "self", ",", "name", ",", "fn", ")", ":", "name", "=", "str", "(", "name", ")", "if", "name", "not", "in", "self", ".", "_message_listeners", ":", "self", ".", "_message_listeners", "[", "name", "]", "=", "[", "]", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.remove_message_listener
Removes a message listener (that was previously added using :py:func:`add_message_listener`). See :ref:`mavlink_messages` for more information. :param String name: The name of the message for which the listener is to be removed (or '*' to remove an 'all messages' observer). :param fn: The list...
dronekit/__init__.py
def remove_message_listener(self, name, fn): """ Removes a message listener (that was previously added using :py:func:`add_message_listener`). See :ref:`mavlink_messages` for more information. :param String name: The name of the message for which the listener is to be removed (or '*' t...
def remove_message_listener(self, name, fn): """ Removes a message listener (that was previously added using :py:func:`add_message_listener`). See :ref:`mavlink_messages` for more information. :param String name: The name of the message for which the listener is to be removed (or '*' t...
[ "Removes", "a", "message", "listener", "(", "that", "was", "previously", "added", "using", ":", "py", ":", "func", ":", "add_message_listener", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1511-L1526
[ "def", "remove_message_listener", "(", "self", ",", "name", ",", "fn", ")", ":", "name", "=", "str", "(", "name", ")", "if", "name", "in", "self", ".", "_message_listeners", ":", "if", "fn", "in", "self", ".", "_message_listeners", "[", "name", "]", ":...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.battery
Current system batter status (:py:class:`Battery`).
dronekit/__init__.py
def battery(self): """ Current system batter status (:py:class:`Battery`). """ if self._voltage is None or self._current is None or self._level is None: return None return Battery(self._voltage, self._current, self._level)
def battery(self): """ Current system batter status (:py:class:`Battery`). """ if self._voltage is None or self._current is None or self._level is None: return None return Battery(self._voltage, self._current, self._level)
[ "Current", "system", "batter", "status", "(", ":", "py", ":", "class", ":", "Battery", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1686-L1692
[ "def", "battery", "(", "self", ")", ":", "if", "self", ".", "_voltage", "is", "None", "or", "self", ".", "_current", "is", "None", "or", "self", ".", "_level", "is", "None", ":", "return", "None", "return", "Battery", "(", "self", ".", "_voltage", ",...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.gps_0
GPS position information (:py:class:`GPSInfo`).
dronekit/__init__.py
def gps_0(self): """ GPS position information (:py:class:`GPSInfo`). """ return GPSInfo(self._eph, self._epv, self._fix_type, self._satellites_visible)
def gps_0(self): """ GPS position information (:py:class:`GPSInfo`). """ return GPSInfo(self._eph, self._epv, self._fix_type, self._satellites_visible)
[ "GPS", "position", "information", "(", ":", "py", ":", "class", ":", "GPSInfo", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1734-L1738
[ "def", "gps_0", "(", "self", ")", ":", "return", "GPSInfo", "(", "self", ".", "_eph", ",", "self", ".", "_epv", ",", "self", ".", "_fix_type", ",", "self", ".", "_satellites_visible", ")" ]
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.is_armable
Returns ``True`` if the vehicle is ready to arm, false otherwise (``Boolean``). This attribute wraps a number of pre-arm checks, ensuring that the vehicle has booted, has a good GPS fix, and that the EKF pre-arm is complete.
dronekit/__init__.py
def is_armable(self): """ Returns ``True`` if the vehicle is ready to arm, false otherwise (``Boolean``). This attribute wraps a number of pre-arm checks, ensuring that the vehicle has booted, has a good GPS fix, and that the EKF pre-arm is complete. """ # check that mod...
def is_armable(self): """ Returns ``True`` if the vehicle is ready to arm, false otherwise (``Boolean``). This attribute wraps a number of pre-arm checks, ensuring that the vehicle has booted, has a good GPS fix, and that the EKF pre-arm is complete. """ # check that mod...
[ "Returns", "True", "if", "the", "vehicle", "is", "ready", "to", "arm", "false", "otherwise", "(", "Boolean", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1769-L1779
[ "def", "is_armable", "(", "self", ")", ":", "# check that mode is not INITIALSING", "# check that we have a GPS fix", "# check that EKF pre-arm is complete", "return", "self", ".", "mode", "!=", "'INITIALISING'", "and", "(", "self", ".", "gps_0", ".", "fix_type", "is", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.system_status
System status (:py:class:`SystemStatus`). The status has a ``state`` property with one of the following values: * ``UNINIT``: Uninitialized system, state is unknown. * ``BOOT``: System is booting up. * ``CALIBRATING``: System is calibrating and not flight-ready. * ``STANDBY``: ...
dronekit/__init__.py
def system_status(self): """ System status (:py:class:`SystemStatus`). The status has a ``state`` property with one of the following values: * ``UNINIT``: Uninitialized system, state is unknown. * ``BOOT``: System is booting up. * ``CALIBRATING``: System is calibrating ...
def system_status(self): """ System status (:py:class:`SystemStatus`). The status has a ``state`` property with one of the following values: * ``UNINIT``: Uninitialized system, state is unknown. * ``BOOT``: System is booting up. * ``CALIBRATING``: System is calibrating ...
[ "System", "status", "(", ":", "py", ":", "class", ":", "SystemStatus", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1782-L1807
[ "def", "system_status", "(", "self", ")", ":", "return", "{", "0", ":", "SystemStatus", "(", "'UNINIT'", ")", ",", "1", ":", "SystemStatus", "(", "'BOOT'", ")", ",", "2", ":", "SystemStatus", "(", "'CALIBRATING'", ")", ",", "3", ":", "SystemStatus", "(...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.ekf_ok
``True`` if the EKF status is considered acceptable, ``False`` otherwise (``boolean``).
dronekit/__init__.py
def ekf_ok(self): """ ``True`` if the EKF status is considered acceptable, ``False`` otherwise (``boolean``). """ # legacy check for dronekit-python for solo # use same check that ArduCopter::system.pde::position_ok() is using if self.armed: return self._ekf_p...
def ekf_ok(self): """ ``True`` if the EKF status is considered acceptable, ``False`` otherwise (``boolean``). """ # legacy check for dronekit-python for solo # use same check that ArduCopter::system.pde::position_ok() is using if self.armed: return self._ekf_p...
[ "True", "if", "the", "EKF", "status", "is", "considered", "acceptable", "False", "otherwise", "(", "boolean", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1889-L1898
[ "def", "ekf_ok", "(", "self", ")", ":", "# legacy check for dronekit-python for solo", "# use same check that ArduCopter::system.pde::position_ok() is using", "if", "self", ".", "armed", ":", "return", "self", ".", "_ekf_poshorizabs", "and", "not", "self", ".", "_ekf_constp...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.home_location
Sets the home location (``LocationGlobal``). The value cannot be set until it has successfully been read from the vehicle. After being set the value is cached in the home_location attribute and does not have to be re-read. .. note:: Setting the value will fail silently if the spec...
dronekit/__init__.py
def home_location(self, pos): """ Sets the home location (``LocationGlobal``). The value cannot be set until it has successfully been read from the vehicle. After being set the value is cached in the home_location attribute and does not have to be re-read. .. note:: ...
def home_location(self, pos): """ Sets the home location (``LocationGlobal``). The value cannot be set until it has successfully been read from the vehicle. After being set the value is cached in the home_location attribute and does not have to be re-read. .. note:: ...
[ "Sets", "the", "home", "location", "(", "LocationGlobal", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L1962-L1987
[ "def", "home_location", "(", "self", ",", "pos", ")", ":", "if", "not", "isinstance", "(", "pos", ",", "LocationGlobal", ")", ":", "raise", "ValueError", "(", "'Expecting home_location to be set to a LocationGlobal.'", ")", "# Set cached home location.", "self", ".", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.wait_for
Wait for a condition to be True. Wait for condition, a callable, to return True. If timeout is nonzero, raise a TimeoutError(errmsg) if the condition is not True after timeout seconds. Check the condition everal interval seconds.
dronekit/__init__.py
def wait_for(self, condition, timeout=None, interval=0.1, errmsg=None): '''Wait for a condition to be True. Wait for condition, a callable, to return True. If timeout is nonzero, raise a TimeoutError(errmsg) if the condition is not True after timeout seconds. Check the condition evera...
def wait_for(self, condition, timeout=None, interval=0.1, errmsg=None): '''Wait for a condition to be True. Wait for condition, a callable, to return True. If timeout is nonzero, raise a TimeoutError(errmsg) if the condition is not True after timeout seconds. Check the condition evera...
[ "Wait", "for", "a", "condition", "to", "be", "True", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2007-L2022
[ "def", "wait_for", "(", "self", ",", "condition", ",", "timeout", "=", "None", ",", "interval", "=", "0.1", ",", "errmsg", "=", "None", ")", ":", "t0", "=", "time", ".", "time", "(", ")", "while", "not", "condition", "(", ")", ":", "t1", "=", "ti...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.wait_for_armable
Wait for the vehicle to become armable. If timeout is nonzero, raise a TimeoutError if the vehicle is not armable after timeout seconds.
dronekit/__init__.py
def wait_for_armable(self, timeout=None): '''Wait for the vehicle to become armable. If timeout is nonzero, raise a TimeoutError if the vehicle is not armable after timeout seconds. ''' def check_armable(): return self.is_armable self.wait_for(check_armable...
def wait_for_armable(self, timeout=None): '''Wait for the vehicle to become armable. If timeout is nonzero, raise a TimeoutError if the vehicle is not armable after timeout seconds. ''' def check_armable(): return self.is_armable self.wait_for(check_armable...
[ "Wait", "for", "the", "vehicle", "to", "become", "armable", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2024-L2034
[ "def", "wait_for_armable", "(", "self", ",", "timeout", "=", "None", ")", ":", "def", "check_armable", "(", ")", ":", "return", "self", ".", "is_armable", "self", ".", "wait_for", "(", "check_armable", ",", "timeout", "=", "timeout", ")" ]
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.arm
Arm the vehicle. If wait is True, wait for arm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not armed after timeout seconds.
dronekit/__init__.py
def arm(self, wait=True, timeout=None): '''Arm the vehicle. If wait is True, wait for arm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not armed after timeout seconds. ''' self.armed = True if wait: ...
def arm(self, wait=True, timeout=None): '''Arm the vehicle. If wait is True, wait for arm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not armed after timeout seconds. ''' self.armed = True if wait: ...
[ "Arm", "the", "vehicle", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2036-L2048
[ "def", "arm", "(", "self", ",", "wait", "=", "True", ",", "timeout", "=", "None", ")", ":", "self", ".", "armed", "=", "True", "if", "wait", ":", "self", ".", "wait_for", "(", "lambda", ":", "self", ".", "armed", ",", "timeout", "=", "timeout", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.disarm
Disarm the vehicle. If wait is True, wait for disarm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not disarmed after timeout seconds.
dronekit/__init__.py
def disarm(self, wait=True, timeout=None): '''Disarm the vehicle. If wait is True, wait for disarm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not disarmed after timeout seconds. ''' self.armed = False ...
def disarm(self, wait=True, timeout=None): '''Disarm the vehicle. If wait is True, wait for disarm operation to complete before returning. If timeout is nonzero, raise a TimeouTerror if the vehicle has not disarmed after timeout seconds. ''' self.armed = False ...
[ "Disarm", "the", "vehicle", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2050-L2061
[ "def", "disarm", "(", "self", ",", "wait", "=", "True", ",", "timeout", "=", "None", ")", ":", "self", ".", "armed", "=", "False", "if", "wait", ":", "self", ".", "wait_for", "(", "lambda", ":", "not", "self", ".", "armed", ",", "timeout", "=", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.wait_for_mode
Set the flight mode. If wait is True, wait for the mode to change before returning. If timeout is nonzero, raise a TimeoutError if the flight mode hasn't changed after timeout seconds.
dronekit/__init__.py
def wait_for_mode(self, mode, timeout=None): '''Set the flight mode. If wait is True, wait for the mode to change before returning. If timeout is nonzero, raise a TimeoutError if the flight mode hasn't changed after timeout seconds. ''' if not isinstance(mode, VehicleMo...
def wait_for_mode(self, mode, timeout=None): '''Set the flight mode. If wait is True, wait for the mode to change before returning. If timeout is nonzero, raise a TimeoutError if the flight mode hasn't changed after timeout seconds. ''' if not isinstance(mode, VehicleMo...
[ "Set", "the", "flight", "mode", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2063-L2078
[ "def", "wait_for_mode", "(", "self", ",", "mode", ",", "timeout", "=", "None", ")", ":", "if", "not", "isinstance", "(", "mode", ",", "VehicleMode", ")", ":", "mode", "=", "VehicleMode", "(", "mode", ")", "self", ".", "mode", "=", "mode", "self", "."...
91c147fa61f521f5fff5d0cee06d07ed93614af8