repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.compute_positions
def compute_positions(cls, screen_width, line): """Compute the relative position of the fields on a given line. Args: screen_width (int): the width of the screen line (mpdlcd.display_fields.Field list): the list of fields on the line Returns: ...
python
def compute_positions(cls, screen_width, line): """Compute the relative position of the fields on a given line. Args: screen_width (int): the width of the screen line (mpdlcd.display_fields.Field list): the list of fields on the line Returns: ...
[ "def", "compute_positions", "(", "cls", ",", "screen_width", ",", "line", ")", ":", "# First index", "left", "=", "1", "# Last index", "right", "=", "screen_width", "+", "1", "# Current 'flexible' field", "flexible", "=", "None", "# Compute the space to the left and t...
Compute the relative position of the fields on a given line. Args: screen_width (int): the width of the screen line (mpdlcd.display_fields.Field list): the list of fields on the line Returns: ((int, mpdlcd.display_fields.Field) list): the positions o...
[ "Compute", "the", "relative", "position", "of", "the", "fields", "on", "a", "given", "line", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L67-L126
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.add_to_screen
def add_to_screen(self, screen_width, screen): """Add the pattern to a screen. Also fills self.widgets. Args: screen_width (int): the width of the screen screen (lcdprod.Screen): the screen to fill. """ for lineno, fields in enumerate(self.line_fields): ...
python
def add_to_screen(self, screen_width, screen): """Add the pattern to a screen. Also fills self.widgets. Args: screen_width (int): the width of the screen screen (lcdprod.Screen): the screen to fill. """ for lineno, fields in enumerate(self.line_fields): ...
[ "def", "add_to_screen", "(", "self", ",", "screen_width", ",", "screen", ")", ":", "for", "lineno", ",", "fields", "in", "enumerate", "(", "self", ".", "line_fields", ")", ":", "for", "left", ",", "field", "in", "self", ".", "compute_positions", "(", "sc...
Add the pattern to a screen. Also fills self.widgets. Args: screen_width (int): the width of the screen screen (lcdprod.Screen): the screen to fill.
[ "Add", "the", "pattern", "to", "a", "screen", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L128-L145
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.register_hooks
def register_hooks(self, field): """Register a field on its target hooks.""" for hook, subhooks in field.register_hooks(): self.hooks[hook].append(field) self.subhooks[hook] |= set(subhooks)
python
def register_hooks(self, field): """Register a field on its target hooks.""" for hook, subhooks in field.register_hooks(): self.hooks[hook].append(field) self.subhooks[hook] |= set(subhooks)
[ "def", "register_hooks", "(", "self", ",", "field", ")", ":", "for", "hook", ",", "subhooks", "in", "field", ".", "register_hooks", "(", ")", ":", "self", ".", "hooks", "[", "hook", "]", ".", "append", "(", "field", ")", "self", ".", "subhooks", "[",...
Register a field on its target hooks.
[ "Register", "a", "field", "on", "its", "target", "hooks", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L147-L151
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.hook_changed
def hook_changed(self, hook, new_data): """Called whenever the data for a hook changed.""" for field in self.hooks[hook]: widget = self.widgets[field] field.hook_changed(hook, widget, new_data)
python
def hook_changed(self, hook, new_data): """Called whenever the data for a hook changed.""" for field in self.hooks[hook]: widget = self.widgets[field] field.hook_changed(hook, widget, new_data)
[ "def", "hook_changed", "(", "self", ",", "hook", ",", "new_data", ")", ":", "for", "field", "in", "self", ".", "hooks", "[", "hook", "]", ":", "widget", "=", "self", ".", "widgets", "[", "field", "]", "field", ".", "hook_changed", "(", "hook", ",", ...
Called whenever the data for a hook changed.
[ "Called", "whenever", "the", "data", "for", "a", "hook", "changed", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L153-L157
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPattern.parse_line
def parse_line(self, line): """Parse a line of text. A format contains fields, within curly brackets, and free text. Maximum one 'variable width' field is allowed per line. You cannot use the '{' or '}' characters in the various text/... fields. Format: '''{<field_k...
python
def parse_line(self, line): """Parse a line of text. A format contains fields, within curly brackets, and free text. Maximum one 'variable width' field is allowed per line. You cannot use the '{' or '}' characters in the various text/... fields. Format: '''{<field_k...
[ "def", "parse_line", "(", "self", ",", "line", ")", ":", "logger", ".", "debug", "(", "'Parsing line %s'", ",", "line", ")", "OUT_FIELD", "=", "0", "IN_FIELD_KIND", "=", "1", "IN_FIELD_OPTION_NAME", "=", "2", "IN_FIELD_OPTION_VALUE", "=", "3", "class", "Pars...
Parse a line of text. A format contains fields, within curly brackets, and free text. Maximum one 'variable width' field is allowed per line. You cannot use the '{' or '}' characters in the various text/... fields. Format: '''{<field_kind>[ <field_option>,<field_option]} te...
[ "Parse", "a", "line", "of", "text", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L163-L424
rbarrois/mpdlcd
mpdlcd/display_pattern.py
ScreenPatternList.add
def add(self, pattern_txt): """Add a pattern to the list. Args: pattern_txt (str list): the pattern, as a list of lines. """ self.patterns[len(pattern_txt)] = pattern_txt low = 0 high = len(pattern_txt) - 1 while not pattern_txt[low]: lo...
python
def add(self, pattern_txt): """Add a pattern to the list. Args: pattern_txt (str list): the pattern, as a list of lines. """ self.patterns[len(pattern_txt)] = pattern_txt low = 0 high = len(pattern_txt) - 1 while not pattern_txt[low]: lo...
[ "def", "add", "(", "self", ",", "pattern_txt", ")", ":", "self", ".", "patterns", "[", "len", "(", "pattern_txt", ")", "]", "=", "pattern_txt", "low", "=", "0", "high", "=", "len", "(", "pattern_txt", ")", "-", "1", "while", "not", "pattern_txt", "["...
Add a pattern to the list. Args: pattern_txt (str list): the pattern, as a list of lines.
[ "Add", "a", "pattern", "to", "the", "list", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/display_pattern.py#L446-L464
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
_arcball
def _arcball(xy, wh): """Convert x,y coordinates to w,x,y,z Quaternion parameters Adapted from: linalg library Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com> Licence at your convenience: GPLv3 or higher <http://www.gnu.org/licenses/gpl.html> BSD new <http://opensource....
python
def _arcball(xy, wh): """Convert x,y coordinates to w,x,y,z Quaternion parameters Adapted from: linalg library Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com> Licence at your convenience: GPLv3 or higher <http://www.gnu.org/licenses/gpl.html> BSD new <http://opensource....
[ "def", "_arcball", "(", "xy", ",", "wh", ")", ":", "x", ",", "y", "=", "xy", "w", ",", "h", "=", "wh", "r", "=", "(", "w", "+", "h", ")", "/", "2.", "x", ",", "y", "=", "-", "(", "2.", "*", "x", "-", "w", ")", "/", "r", ",", "(", ...
Convert x,y coordinates to w,x,y,z Quaternion parameters Adapted from: linalg library Copyright (c) 2010-2015, Renaud Blanch <rndblnch at gmail dot com> Licence at your convenience: GPLv3 or higher <http://www.gnu.org/licenses/gpl.html> BSD new <http://opensource.org/licenses/BSD-3-Clause>
[ "Convert", "x", "y", "coordinates", "to", "w", "x", "y", "z", "Quaternion", "parameters" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L84-L101
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._update_rotation
def _update_rotation(self, event): """Update rotation parmeters based on mouse movement""" p2 = event.mouse_event.pos if self._event_value is None: self._event_value = p2 wh = self._viewbox.size self._quaternion = (Quaternion(*_arcball(p2, wh)) * ...
python
def _update_rotation(self, event): """Update rotation parmeters based on mouse movement""" p2 = event.mouse_event.pos if self._event_value is None: self._event_value = p2 wh = self._viewbox.size self._quaternion = (Quaternion(*_arcball(p2, wh)) * ...
[ "def", "_update_rotation", "(", "self", ",", "event", ")", ":", "p2", "=", "event", ".", "mouse_event", ".", "pos", "if", "self", ".", "_event_value", "is", "None", ":", "self", ".", "_event_value", "=", "p2", "wh", "=", "self", ".", "_viewbox", ".", ...
Update rotation parmeters based on mouse movement
[ "Update", "rotation", "parmeters", "based", "on", "mouse", "movement" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L53-L63
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._rotate_tr
def _rotate_tr(self): """Rotate the transformation matrix based on camera parameters""" rot, x, y, z = self._quaternion.get_axis_angle() up, forward, right = self._get_dim_vectors() self.transform.rotate(180 * rot / np.pi, (x, z, y))
python
def _rotate_tr(self): """Rotate the transformation matrix based on camera parameters""" rot, x, y, z = self._quaternion.get_axis_angle() up, forward, right = self._get_dim_vectors() self.transform.rotate(180 * rot / np.pi, (x, z, y))
[ "def", "_rotate_tr", "(", "self", ")", ":", "rot", ",", "x", ",", "y", ",", "z", "=", "self", ".", "_quaternion", ".", "get_axis_angle", "(", ")", "up", ",", "forward", ",", "right", "=", "self", ".", "_get_dim_vectors", "(", ")", "self", ".", "tra...
Rotate the transformation matrix based on camera parameters
[ "Rotate", "the", "transformation", "matrix", "based", "on", "camera", "parameters" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L65-L69
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py
ArcballCamera._dist_to_trans
def _dist_to_trans(self, dist): """Convert mouse x, y movement into x, y, z translations""" rot, x, y, z = self._quaternion.get_axis_angle() tr = MatrixTransform() tr.rotate(180 * rot / np.pi, (x, y, z)) dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.)) retur...
python
def _dist_to_trans(self, dist): """Convert mouse x, y movement into x, y, z translations""" rot, x, y, z = self._quaternion.get_axis_angle() tr = MatrixTransform() tr.rotate(180 * rot / np.pi, (x, y, z)) dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.)) retur...
[ "def", "_dist_to_trans", "(", "self", ",", "dist", ")", ":", "rot", ",", "x", ",", "y", ",", "z", "=", "self", ".", "_quaternion", ".", "get_axis_angle", "(", ")", "tr", "=", "MatrixTransform", "(", ")", "tr", ".", "rotate", "(", "180", "*", "rot",...
Convert mouse x, y movement into x, y, z translations
[ "Convert", "mouse", "x", "y", "movement", "into", "x", "y", "z", "translations" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/arcball.py#L71-L77
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
arg_to_array
def arg_to_array(func): """ Decorator to convert argument to array. Parameters ---------- func : function The function to decorate. Returns ------- func : function The decorated function. """ def fn(self, arg, *args, **kwargs): """Function Param...
python
def arg_to_array(func): """ Decorator to convert argument to array. Parameters ---------- func : function The function to decorate. Returns ------- func : function The decorated function. """ def fn(self, arg, *args, **kwargs): """Function Param...
[ "def", "arg_to_array", "(", "func", ")", ":", "def", "fn", "(", "self", ",", "arg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tu...
Decorator to convert argument to array. Parameters ---------- func : function The function to decorate. Returns ------- func : function The decorated function.
[ "Decorator", "to", "convert", "argument", "to", "array", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L12-L44
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
as_vec4
def as_vec4(obj, default=(0, 0, 0, 1)): """ Convert `obj` to 4-element vector (numpy array with shape[-1] == 4) Parameters ---------- obj : array-like Original object. default : array-like The defaults to use if the object does not have 4 entries. Returns ------- ob...
python
def as_vec4(obj, default=(0, 0, 0, 1)): """ Convert `obj` to 4-element vector (numpy array with shape[-1] == 4) Parameters ---------- obj : array-like Original object. default : array-like The defaults to use if the object does not have 4 entries. Returns ------- ob...
[ "def", "as_vec4", "(", "obj", ",", "default", "=", "(", "0", ",", "0", ",", "0", ",", "1", ")", ")", ":", "obj", "=", "np", ".", "atleast_2d", "(", "obj", ")", "# For multiple vectors, reshape to (..., 4)", "if", "obj", ".", "shape", "[", "-", "1", ...
Convert `obj` to 4-element vector (numpy array with shape[-1] == 4) Parameters ---------- obj : array-like Original object. default : array-like The defaults to use if the object does not have 4 entries. Returns ------- obj : array-like The object promoted to have 4...
[ "Convert", "obj", "to", "4", "-", "element", "vector", "(", "numpy", "array", "with", "shape", "[", "-", "1", "]", "==", "4", ")" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L47-L82
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
arg_to_vec4
def arg_to_vec4(func, self_, arg, *args, **kwargs): """ Decorator for converting argument to vec4 format suitable for 4x4 matrix multiplication. [x, y] => [[x, y, 0, 1]] [x, y, z] => [[x, y, z, 1]] [[x1, y1], [[x1, y1, 0, 1], [x2, y2], => [x2, y2, 0, 1], [x3, y3]] ...
python
def arg_to_vec4(func, self_, arg, *args, **kwargs): """ Decorator for converting argument to vec4 format suitable for 4x4 matrix multiplication. [x, y] => [[x, y, 0, 1]] [x, y, z] => [[x, y, z, 1]] [[x1, y1], [[x1, y1, 0, 1], [x2, y2], => [x2, y2, 0, 1], [x3, y3]] ...
[ "def", "arg_to_vec4", "(", "func", ",", "self_", ",", "arg", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "arg", ",", "(", "tuple", ",", "list", ",", "np", ".", "ndarray", ")", ")", ":", "arg", "=", "np", ".", ...
Decorator for converting argument to vec4 format suitable for 4x4 matrix multiplication. [x, y] => [[x, y, 0, 1]] [x, y, z] => [[x, y, z, 1]] [[x1, y1], [[x1, y1, 0, 1], [x2, y2], => [x2, y2, 0, 1], [x3, y3]] [x3, y3, 0, 1]] If 1D input is provided, then the retu...
[ "Decorator", "for", "converting", "argument", "to", "vec4", "format", "suitable", "for", "4x4", "matrix", "multiplication", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L86-L122
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
TransformCache.get
def get(self, path): """ Get a transform from the cache that maps along *path*, which must be a list of Transforms to apply in reverse order (last transform is applied first). Accessed items have their age reset to 0. """ key = tuple(map(id, path)) item = self._c...
python
def get(self, path): """ Get a transform from the cache that maps along *path*, which must be a list of Transforms to apply in reverse order (last transform is applied first). Accessed items have their age reset to 0. """ key = tuple(map(id, path)) item = self._c...
[ "def", "get", "(", "self", ",", "path", ")", ":", "key", "=", "tuple", "(", "map", "(", "id", ",", "path", ")", ")", "item", "=", "self", ".", "_cache", ".", "get", "(", "key", ",", "None", ")", "if", "item", "is", "None", ":", "logger", ".",...
Get a transform from the cache that maps along *path*, which must be a list of Transforms to apply in reverse order (last transform is applied first). Accessed items have their age reset to 0.
[ "Get", "a", "transform", "from", "the", "cache", "that", "maps", "along", "*", "path", "*", "which", "must", "be", "a", "list", "of", "Transforms", "to", "apply", "in", "reverse", "order", "(", "last", "transform", "is", "applied", "first", ")", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L143-L164
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py
TransformCache.roll
def roll(self): """ Increase the age of all items in the cache by 1. Items whose age is greater than self.max_age will be removed from the cache. """ rem = [] for key, item in self._cache.items(): if item[0] > self.max_age: rem.append(key) ...
python
def roll(self): """ Increase the age of all items in the cache by 1. Items whose age is greater than self.max_age will be removed from the cache. """ rem = [] for key, item in self._cache.items(): if item[0] > self.max_age: rem.append(key) ...
[ "def", "roll", "(", "self", ")", ":", "rem", "=", "[", "]", "for", "key", ",", "item", "in", "self", ".", "_cache", ".", "items", "(", ")", ":", "if", "item", "[", "0", "]", ">", "self", ".", "max_age", ":", "rem", ".", "append", "(", "key", ...
Increase the age of all items in the cache by 1. Items whose age is greater than self.max_age will be removed from the cache.
[ "Increase", "the", "age", "of", "all", "items", "in", "the", "cache", "by", "1", ".", "Items", "whose", "age", "is", "greater", "than", "self", ".", "max_age", "will", "be", "removed", "from", "the", "cache", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/_util.py#L171-L183
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.histogram
def histogram(self, data, bins=10, color='w', orientation='h'): """Calculate and show a histogram of data Parameters ---------- data : array-like Data to histogram. Currently only 1D data is supported. bins : int | array-like Number of bins, or bin edges....
python
def histogram(self, data, bins=10, color='w', orientation='h'): """Calculate and show a histogram of data Parameters ---------- data : array-like Data to histogram. Currently only 1D data is supported. bins : int | array-like Number of bins, or bin edges....
[ "def", "histogram", "(", "self", ",", "data", ",", "bins", "=", "10", ",", "color", "=", "'w'", ",", "orientation", "=", "'h'", ")", ":", "self", ".", "_configure_2d", "(", ")", "hist", "=", "scene", ".", "Histogram", "(", "data", ",", "bins", ",",...
Calculate and show a histogram of data Parameters ---------- data : array-like Data to histogram. Currently only 1D data is supported. bins : int | array-like Number of bins, or bin edges. color : instance of Color Color of the histogram. ...
[ "Calculate", "and", "show", "a", "histogram", "of", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L159-L182
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.image
def image(self, data, cmap='cubehelix', clim='auto', fg_color=None): """Show an image Parameters ---------- data : ndarray Should have shape (N, M), (N, M, 3) or (N, M, 4). cmap : str Colormap name. clim : str | tuple Colormap limits. ...
python
def image(self, data, cmap='cubehelix', clim='auto', fg_color=None): """Show an image Parameters ---------- data : ndarray Should have shape (N, M), (N, M, 3) or (N, M, 4). cmap : str Colormap name. clim : str | tuple Colormap limits. ...
[ "def", "image", "(", "self", ",", "data", ",", "cmap", "=", "'cubehelix'", ",", "clim", "=", "'auto'", ",", "fg_color", "=", "None", ")", ":", "self", ".", "_configure_2d", "(", "fg_color", ")", "image", "=", "scene", ".", "Image", "(", "data", ",", ...
Show an image Parameters ---------- data : ndarray Should have shape (N, M), (N, M, 3) or (N, M, 4). cmap : str Colormap name. clim : str | tuple Colormap limits. Should be ``'auto'`` or a two-element tuple of min and max values. ...
[ "Show", "an", "image" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L184-L214
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.mesh
def mesh(self, vertices=None, faces=None, vertex_colors=None, face_colors=None, color=(0.5, 0.5, 1.), fname=None, meshdata=None): """Show a 3D mesh Parameters ---------- vertices : array Vertices. faces : array | None Face defini...
python
def mesh(self, vertices=None, faces=None, vertex_colors=None, face_colors=None, color=(0.5, 0.5, 1.), fname=None, meshdata=None): """Show a 3D mesh Parameters ---------- vertices : array Vertices. faces : array | None Face defini...
[ "def", "mesh", "(", "self", ",", "vertices", "=", "None", ",", "faces", "=", "None", ",", "vertex_colors", "=", "None", ",", "face_colors", "=", "None", ",", "color", "=", "(", "0.5", ",", "0.5", ",", "1.", ")", ",", "fname", "=", "None", ",", "m...
Show a 3D mesh Parameters ---------- vertices : array Vertices. faces : array | None Face definitions. vertex_colors : array | None Vertex colors. face_colors : array | None Face colors. color : instance of Color ...
[ "Show", "a", "3D", "mesh" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L216-L262
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.plot
def plot(self, data, color='k', symbol=None, line_kind='-', width=1., marker_size=10., edge_color='k', face_color='b', edge_width=1., title=None, xlabel=None, ylabel=None): """Plot a series of data using lines and markers Parameters ---------- data : array | tw...
python
def plot(self, data, color='k', symbol=None, line_kind='-', width=1., marker_size=10., edge_color='k', face_color='b', edge_width=1., title=None, xlabel=None, ylabel=None): """Plot a series of data using lines and markers Parameters ---------- data : array | tw...
[ "def", "plot", "(", "self", ",", "data", ",", "color", "=", "'k'", ",", "symbol", "=", "None", ",", "line_kind", "=", "'-'", ",", "width", "=", "1.", ",", "marker_size", "=", "10.", ",", "edge_color", "=", "'k'", ",", "face_color", "=", "'b'", ",",...
Plot a series of data using lines and markers Parameters ---------- data : array | two arrays Arguments can be passed as ``(Y,)``, ``(X, Y)`` or ``np.array((X, Y))``. color : instance of Color Color of the line. symbol : str Marker...
[ "Plot", "a", "series", "of", "data", "using", "lines", "and", "markers" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L264-L325
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.spectrogram
def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann', color_scale='log', cmap='cubehelix', clim='auto'): """Calculate and show a spectrogram Parameters ---------- x : array-like 1D signal to operate on. ``If len(x) < n_fft``, x will be ...
python
def spectrogram(self, x, n_fft=256, step=None, fs=1., window='hann', color_scale='log', cmap='cubehelix', clim='auto'): """Calculate and show a spectrogram Parameters ---------- x : array-like 1D signal to operate on. ``If len(x) < n_fft``, x will be ...
[ "def", "spectrogram", "(", "self", ",", "x", ",", "n_fft", "=", "256", ",", "step", "=", "None", ",", "fs", "=", "1.", ",", "window", "=", "'hann'", ",", "color_scale", "=", "'log'", ",", "cmap", "=", "'cubehelix'", ",", "clim", "=", "'auto'", ")",...
Calculate and show a spectrogram Parameters ---------- x : array-like 1D signal to operate on. ``If len(x) < n_fft``, x will be zero-padded to length ``n_fft``. n_fft : int Number of FFT points. Much faster for powers of two. step : int | None...
[ "Calculate", "and", "show", "a", "spectrogram" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L327-L370
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.volume
def volume(self, vol, clim=None, method='mip', threshold=None, cmap='grays'): """Show a 3D volume Parameters ---------- vol : ndarray Volume to render. clim : tuple of two floats | None The contrast limits. The values in the volume are mapp...
python
def volume(self, vol, clim=None, method='mip', threshold=None, cmap='grays'): """Show a 3D volume Parameters ---------- vol : ndarray Volume to render. clim : tuple of two floats | None The contrast limits. The values in the volume are mapp...
[ "def", "volume", "(", "self", ",", "vol", ",", "clim", "=", "None", ",", "method", "=", "'mip'", ",", "threshold", "=", "None", ",", "cmap", "=", "'grays'", ")", ":", "self", ".", "_configure_3d", "(", ")", "volume", "=", "scene", ".", "Volume", "(...
Show a 3D volume Parameters ---------- vol : ndarray Volume to render. clim : tuple of two floats | None The contrast limits. The values in the volume are mapped to black and white corresponding to these values. Default maps between min an...
[ "Show", "a", "3D", "volume" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L372-L406
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.surface
def surface(self, zdata, **kwargs): """Show a 3D surface plot. Extra keyword arguments are passed to `SurfacePlot()`. Parameters ---------- zdata : array-like A 2D array of the surface Z values. """ self._configure_3d() surf = scene.SurfaceP...
python
def surface(self, zdata, **kwargs): """Show a 3D surface plot. Extra keyword arguments are passed to `SurfacePlot()`. Parameters ---------- zdata : array-like A 2D array of the surface Z values. """ self._configure_3d() surf = scene.SurfaceP...
[ "def", "surface", "(", "self", ",", "zdata", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_configure_3d", "(", ")", "surf", "=", "scene", ".", "SurfacePlot", "(", "z", "=", "zdata", ",", "*", "*", "kwargs", ")", "self", ".", "view", ".", "add...
Show a 3D surface plot. Extra keyword arguments are passed to `SurfacePlot()`. Parameters ---------- zdata : array-like A 2D array of the surface Z values.
[ "Show", "a", "3D", "surface", "plot", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L408-L423
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/plot/plotwidget.py
PlotWidget.colorbar
def colorbar(self, cmap, position="right", label="", clim=("", ""), border_width=0.0, border_color="black", **kwargs): """Show a ColorBar Parameters ---------- cmap : str | vispy.color.ColorMap Either the name of the ColorMa...
python
def colorbar(self, cmap, position="right", label="", clim=("", ""), border_width=0.0, border_color="black", **kwargs): """Show a ColorBar Parameters ---------- cmap : str | vispy.color.ColorMap Either the name of the ColorMa...
[ "def", "colorbar", "(", "self", ",", "cmap", ",", "position", "=", "\"right\"", ",", "label", "=", "\"\"", ",", "clim", "=", "(", "\"\"", ",", "\"\"", ")", ",", "border_width", "=", "0.0", ",", "border_color", "=", "\"black\"", ",", "*", "*", "kwargs...
Show a ColorBar Parameters ---------- cmap : str | vispy.color.ColorMap Either the name of the ColorMap to be used from the standard set of names (refer to `vispy.color.get_colormap`), or a custom ColorMap object. The ColorMap is used to apply a g...
[ "Show", "a", "ColorBar" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L425-L499
glue-viz/glue-vispy-viewers
glue_vispy_viewers/scatter/layer_artist.py
ScatterLayerArtist.redraw
def redraw(self): """ Redraw the Vispy canvas """ if self._multiscat is not None: self._multiscat._update() self.vispy_widget.canvas.update()
python
def redraw(self): """ Redraw the Vispy canvas """ if self._multiscat is not None: self._multiscat._update() self.vispy_widget.canvas.update()
[ "def", "redraw", "(", "self", ")", ":", "if", "self", ".", "_multiscat", "is", "not", "None", ":", "self", ".", "_multiscat", ".", "_update", "(", ")", "self", ".", "vispy_widget", ".", "canvas", ".", "update", "(", ")" ]
Redraw the Vispy canvas
[ "Redraw", "the", "Vispy", "canvas" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L96-L102
glue-viz/glue-vispy-viewers
glue_vispy_viewers/scatter/layer_artist.py
ScatterLayerArtist.remove
def remove(self): """ Remove the layer artist from the visualization """ if self._multiscat is None: return self._multiscat.deallocate(self.id) self._multiscat = None self._viewer_state.remove_global_callback(self._update_scatter) self.state...
python
def remove(self): """ Remove the layer artist from the visualization """ if self._multiscat is None: return self._multiscat.deallocate(self.id) self._multiscat = None self._viewer_state.remove_global_callback(self._update_scatter) self.state...
[ "def", "remove", "(", "self", ")", ":", "if", "self", ".", "_multiscat", "is", "None", ":", "return", "self", ".", "_multiscat", ".", "deallocate", "(", "self", ".", "id", ")", "self", ".", "_multiscat", "=", "None", "self", ".", "_viewer_state", ".", ...
Remove the layer artist from the visualization
[ "Remove", "the", "layer", "artist", "from", "the", "visualization" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L110-L122
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_check_valid
def _check_valid(key, val, valid): """Helper to check valid options""" if val not in valid: raise ValueError('%s must be one of %s, not "%s"' % (key, valid, val))
python
def _check_valid(key, val, valid): """Helper to check valid options""" if val not in valid: raise ValueError('%s must be one of %s, not "%s"' % (key, valid, val))
[ "def", "_check_valid", "(", "key", ",", "val", ",", "valid", ")", ":", "if", "val", "not", "in", "valid", ":", "raise", "ValueError", "(", "'%s must be one of %s, not \"%s\"'", "%", "(", "key", ",", "valid", ",", "val", ")", ")" ]
Helper to check valid options
[ "Helper", "to", "check", "valid", "options" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L64-L68
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_to_args
def _to_args(x): """Convert to args representation""" if not isinstance(x, (list, tuple, np.ndarray)): x = [x] return x
python
def _to_args(x): """Convert to args representation""" if not isinstance(x, (list, tuple, np.ndarray)): x = [x] return x
[ "def", "_to_args", "(", "x", ")", ":", "if", "not", "isinstance", "(", "x", ",", "(", "list", ",", "tuple", ",", "np", ".", "ndarray", ")", ")", ":", "x", "=", "[", "x", "]", "return", "x" ]
Convert to args representation
[ "Convert", "to", "args", "representation" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L71-L75
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
_check_conversion
def _check_conversion(key, valid_dict): """Check for existence of key in dict, return value or raise error""" if key not in valid_dict and key not in valid_dict.values(): # Only show users the nice string values keys = [v for v in valid_dict.keys() if isinstance(v, string_types)] raise V...
python
def _check_conversion(key, valid_dict): """Check for existence of key in dict, return value or raise error""" if key not in valid_dict and key not in valid_dict.values(): # Only show users the nice string values keys = [v for v in valid_dict.keys() if isinstance(v, string_types)] raise V...
[ "def", "_check_conversion", "(", "key", ",", "valid_dict", ")", ":", "if", "key", "not", "in", "valid_dict", "and", "key", "not", "in", "valid_dict", ".", "values", "(", ")", ":", "# Only show users the nice string values", "keys", "=", "[", "v", "for", "v",...
Check for existence of key in dict, return value or raise error
[ "Check", "for", "existence", "of", "key", "in", "dict", "return", "value", "or", "raise", "error" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L78-L84
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
read_pixels
def read_pixels(viewport=None, alpha=True, out_type='unsigned_byte'): """Read pixels from the currently selected buffer. Under most circumstances, this function reads from the front buffer. Unlike all other functions in vispy.gloo, this function directly executes an OpenGL command. Parameters...
python
def read_pixels(viewport=None, alpha=True, out_type='unsigned_byte'): """Read pixels from the currently selected buffer. Under most circumstances, this function reads from the front buffer. Unlike all other functions in vispy.gloo, this function directly executes an OpenGL command. Parameters...
[ "def", "read_pixels", "(", "viewport", "=", "None", ",", "alpha", "=", "True", ",", "out_type", "=", "'unsigned_byte'", ")", ":", "# Check whether the GL context is direct or remote", "context", "=", "get_current_canvas", "(", ")", ".", "context", "if", "context", ...
Read pixels from the currently selected buffer. Under most circumstances, this function reads from the front buffer. Unlike all other functions in vispy.gloo, this function directly executes an OpenGL command. Parameters ---------- viewport : array-like | None 4-element list of x,...
[ "Read", "pixels", "from", "the", "currently", "selected", "buffer", ".", "Under", "most", "circumstances", "this", "function", "reads", "from", "the", "front", "buffer", ".", "Unlike", "all", "other", "functions", "in", "vispy", ".", "gloo", "this", "function"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L606-L663
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
get_gl_configuration
def get_gl_configuration(): """Read the current gl configuration This function uses constants that are not in the OpenGL ES 2.1 namespace, so only use this on desktop systems. Returns ------- config : dict The currently active OpenGL configuration. """ # XXX eventually maybe we...
python
def get_gl_configuration(): """Read the current gl configuration This function uses constants that are not in the OpenGL ES 2.1 namespace, so only use this on desktop systems. Returns ------- config : dict The currently active OpenGL configuration. """ # XXX eventually maybe we...
[ "def", "get_gl_configuration", "(", ")", ":", "# XXX eventually maybe we can ask `gl` whether or not we can access these", "gl", ".", "check_error", "(", "'pre-config check'", ")", "config", "=", "dict", "(", ")", "gl", ".", "glBindFramebuffer", "(", "gl", ".", "GL_FRAM...
Read the current gl configuration This function uses constants that are not in the OpenGL ES 2.1 namespace, so only use this on desktop systems. Returns ------- config : dict The currently active OpenGL configuration.
[ "Read", "the", "current", "gl", "configuration" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L666-L708
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_viewport
def set_viewport(self, *args): """Set the OpenGL viewport This is a wrapper for gl.glViewport. Parameters ---------- *args : tuple X and Y coordinates, plus width and height. Can be passed in as individual components, or as a single tuple with fo...
python
def set_viewport(self, *args): """Set the OpenGL viewport This is a wrapper for gl.glViewport. Parameters ---------- *args : tuple X and Y coordinates, plus width and height. Can be passed in as individual components, or as a single tuple with fo...
[ "def", "set_viewport", "(", "self", ",", "*", "args", ")", ":", "x", ",", "y", ",", "w", ",", "h", "=", "args", "[", "0", "]", "if", "len", "(", "args", ")", "==", "1", "else", "args", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", ...
Set the OpenGL viewport This is a wrapper for gl.glViewport. Parameters ---------- *args : tuple X and Y coordinates, plus width and height. Can be passed in as individual components, or as a single tuple with four values.
[ "Set", "the", "OpenGL", "viewport", "This", "is", "a", "wrapper", "for", "gl", ".", "glViewport", ".", "Parameters", "----------", "*", "args", ":", "tuple", "X", "and", "Y", "coordinates", "plus", "width", "and", "height", ".", "Can", "be", "passed", "i...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L100-L112
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_depth_range
def set_depth_range(self, near=0., far=1.): """Set depth values Parameters ---------- near : float Near clipping plane. far : float Far clipping plane. """ self.glir.command('FUNC', 'glDepthRange', float(near), float(far))
python
def set_depth_range(self, near=0., far=1.): """Set depth values Parameters ---------- near : float Near clipping plane. far : float Far clipping plane. """ self.glir.command('FUNC', 'glDepthRange', float(near), float(far))
[ "def", "set_depth_range", "(", "self", ",", "near", "=", "0.", ",", "far", "=", "1.", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glDepthRange'", ",", "float", "(", "near", ")", ",", "float", "(", "far", ")", ")" ]
Set depth values Parameters ---------- near : float Near clipping plane. far : float Far clipping plane.
[ "Set", "depth", "values", "Parameters", "----------", "near", ":", "float", "Near", "clipping", "plane", ".", "far", ":", "float", "Far", "clipping", "plane", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L114-L124
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_line_width
def set_line_width(self, width=1.): """Set line width Parameters ---------- width : float The line width. """ width = float(width) if width < 0: raise RuntimeError('Cannot have width < 0') self.glir.command('FUNC', 'glLineWidth...
python
def set_line_width(self, width=1.): """Set line width Parameters ---------- width : float The line width. """ width = float(width) if width < 0: raise RuntimeError('Cannot have width < 0') self.glir.command('FUNC', 'glLineWidth...
[ "def", "set_line_width", "(", "self", ",", "width", "=", "1.", ")", ":", "width", "=", "float", "(", "width", ")", "if", "width", "<", "0", ":", "raise", "RuntimeError", "(", "'Cannot have width < 0'", ")", "self", ".", "glir", ".", "command", "(", "'F...
Set line width Parameters ---------- width : float The line width.
[ "Set", "line", "width", "Parameters", "----------", "width", ":", "float", "The", "line", "width", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L146-L157
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_polygon_offset
def set_polygon_offset(self, factor=0., units=0.): """Set the scale and units used to calculate depth values Parameters ---------- factor : float Scale factor used to create a variable depth offset for each polygon. units : float Multiplie...
python
def set_polygon_offset(self, factor=0., units=0.): """Set the scale and units used to calculate depth values Parameters ---------- factor : float Scale factor used to create a variable depth offset for each polygon. units : float Multiplie...
[ "def", "set_polygon_offset", "(", "self", ",", "factor", "=", "0.", ",", "units", "=", "0.", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glPolygonOffset'", ",", "float", "(", "factor", ")", ",", "float", "(", "units", ")", ")...
Set the scale and units used to calculate depth values Parameters ---------- factor : float Scale factor used to create a variable depth offset for each polygon. units : float Multiplied by an implementation-specific value to create a ...
[ "Set", "the", "scale", "and", "units", "used", "to", "calculate", "depth", "values", "Parameters", "----------", "factor", ":", "float", "Scale", "factor", "used", "to", "create", "a", "variable", "depth", "offset", "for", "each", "polygon", ".", "units", ":...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L159-L172
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.clear
def clear(self, color=True, depth=True, stencil=True): """Clear the screen buffers This is a wrapper for gl.glClear. Parameters ---------- color : bool | str | tuple | instance of Color Clear the color buffer bit. If not bool, ``set_clear_color`` will ...
python
def clear(self, color=True, depth=True, stencil=True): """Clear the screen buffers This is a wrapper for gl.glClear. Parameters ---------- color : bool | str | tuple | instance of Color Clear the color buffer bit. If not bool, ``set_clear_color`` will ...
[ "def", "clear", "(", "self", ",", "color", "=", "True", ",", "depth", "=", "True", ",", "stencil", "=", "True", ")", ":", "bits", "=", "0", "if", "isinstance", "(", "color", ",", "np", ".", "ndarray", ")", "or", "bool", "(", "color", ")", ":", ...
Clear the screen buffers This is a wrapper for gl.glClear. Parameters ---------- color : bool | str | tuple | instance of Color Clear the color buffer bit. If not bool, ``set_clear_color`` will be used to set the color clear value. depth : bool |...
[ "Clear", "the", "screen", "buffers", "This", "is", "a", "wrapper", "for", "gl", ".", "glClear", ".", "Parameters", "----------", "color", ":", "bool", "|", "str", "|", "tuple", "|", "instance", "of", "Color", "Clear", "the", "color", "buffer", "bit", "."...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L181-L211
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_clear_color
def set_clear_color(self, color='black', alpha=None): """Set the screen clear color This is a wrapper for gl.glClearColor. Parameters ---------- color : str | tuple | instance of Color Color to use. See vispy.color.Color for options. alpha : float | None ...
python
def set_clear_color(self, color='black', alpha=None): """Set the screen clear color This is a wrapper for gl.glClearColor. Parameters ---------- color : str | tuple | instance of Color Color to use. See vispy.color.Color for options. alpha : float | None ...
[ "def", "set_clear_color", "(", "self", ",", "color", "=", "'black'", ",", "alpha", "=", "None", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glClearColor'", ",", "*", "Color", "(", "color", ",", "alpha", ")", ".", "rgba", ")" ...
Set the screen clear color This is a wrapper for gl.glClearColor. Parameters ---------- color : str | tuple | instance of Color Color to use. See vispy.color.Color for options. alpha : float | None Alpha to use.
[ "Set", "the", "screen", "clear", "color" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L213-L225
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_blend_func
def set_blend_func(self, srgb='one', drgb='zero', salpha=None, dalpha=None): """Specify pixel arithmetic for RGB and alpha Parameters ---------- srgb : str Source RGB factor. drgb : str Destination RGB factor. salpha : s...
python
def set_blend_func(self, srgb='one', drgb='zero', salpha=None, dalpha=None): """Specify pixel arithmetic for RGB and alpha Parameters ---------- srgb : str Source RGB factor. drgb : str Destination RGB factor. salpha : s...
[ "def", "set_blend_func", "(", "self", ",", "srgb", "=", "'one'", ",", "drgb", "=", "'zero'", ",", "salpha", "=", "None", ",", "dalpha", "=", "None", ")", ":", "salpha", "=", "srgb", "if", "salpha", "is", "None", "else", "salpha", "dalpha", "=", "drgb...
Specify pixel arithmetic for RGB and alpha Parameters ---------- srgb : str Source RGB factor. drgb : str Destination RGB factor. salpha : str | None Source alpha factor. If None, ``srgb`` is used. dalpha : str Destinat...
[ "Specify", "pixel", "arithmetic", "for", "RGB", "and", "alpha", "Parameters", "----------", "srgb", ":", "str", "Source", "RGB", "factor", ".", "drgb", ":", "str", "Destination", "RGB", "factor", ".", "salpha", ":", "str", "|", "None", "Source", "alpha", "...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L253-L271
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_blend_equation
def set_blend_equation(self, mode_rgb, mode_alpha=None): """Specify the equation for RGB and alpha blending Parameters ---------- mode_rgb : str Mode for RGB. mode_alpha : str | None Mode for Alpha. If None, ``mode_rgb`` is used. Notes ...
python
def set_blend_equation(self, mode_rgb, mode_alpha=None): """Specify the equation for RGB and alpha blending Parameters ---------- mode_rgb : str Mode for RGB. mode_alpha : str | None Mode for Alpha. If None, ``mode_rgb`` is used. Notes ...
[ "def", "set_blend_equation", "(", "self", ",", "mode_rgb", ",", "mode_alpha", "=", "None", ")", ":", "mode_alpha", "=", "mode_rgb", "if", "mode_alpha", "is", "None", "else", "mode_alpha", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glBlendEqua...
Specify the equation for RGB and alpha blending Parameters ---------- mode_rgb : str Mode for RGB. mode_alpha : str | None Mode for Alpha. If None, ``mode_rgb`` is used. Notes ----- See ``set_blend_equation`` for valid modes.
[ "Specify", "the", "equation", "for", "RGB", "and", "alpha", "blending", "Parameters", "----------", "mode_rgb", ":", "str", "Mode", "for", "RGB", ".", "mode_alpha", ":", "str", "|", "None", "Mode", "for", "Alpha", ".", "If", "None", "mode_rgb", "is", "used...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L283-L299
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_scissor
def set_scissor(self, x, y, w, h): """Define the scissor box Parameters ---------- x : int Left corner of the box. y : int Lower corner of the box. w : int The width of the box. h : int The height of the box. ...
python
def set_scissor(self, x, y, w, h): """Define the scissor box Parameters ---------- x : int Left corner of the box. y : int Lower corner of the box. w : int The width of the box. h : int The height of the box. ...
[ "def", "set_scissor", "(", "self", ",", "x", ",", "y", ",", "w", ",", "h", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glScissor'", ",", "int", "(", "x", ")", ",", "int", "(", "y", ")", ",", "int", "(", "w", ")", ",...
Define the scissor box Parameters ---------- x : int Left corner of the box. y : int Lower corner of the box. w : int The width of the box. h : int The height of the box.
[ "Define", "the", "scissor", "box", "Parameters", "----------", "x", ":", "int", "Left", "corner", "of", "the", "box", ".", "y", ":", "int", "Lower", "corner", "of", "the", "box", ".", "w", ":", "int", "The", "width", "of", "the", "box", ".", "h", "...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L304-L318
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_func
def set_stencil_func(self, func='always', ref=0, mask=8, face='front_and_back'): """Set front or back function and reference value Parameters ---------- func : str See set_stencil_func. ref : int Reference value for the stenc...
python
def set_stencil_func(self, func='always', ref=0, mask=8, face='front_and_back'): """Set front or back function and reference value Parameters ---------- func : str See set_stencil_func. ref : int Reference value for the stenc...
[ "def", "set_stencil_func", "(", "self", ",", "func", "=", "'always'", ",", "ref", "=", "0", ",", "mask", "=", "8", ",", "face", "=", "'front_and_back'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilFuncSeparate'", ",", ...
Set front or back function and reference value Parameters ---------- func : str See set_stencil_func. ref : int Reference value for the stencil test. mask : int Mask that is ANDed with ref and stored stencil value. face : str ...
[ "Set", "front", "or", "back", "function", "and", "reference", "value", "Parameters", "----------", "func", ":", "str", "See", "set_stencil_func", ".", "ref", ":", "int", "Reference", "value", "for", "the", "stencil", "test", ".", "mask", ":", "int", "Mask", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L320-L336
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_mask
def set_stencil_mask(self, mask=8, face='front_and_back'): """Control the front or back writing of individual bits in the stencil Parameters ---------- mask : int Mask that is ANDed with ref and stored stencil value. face : str Can be 'front', 'back',...
python
def set_stencil_mask(self, mask=8, face='front_and_back'): """Control the front or back writing of individual bits in the stencil Parameters ---------- mask : int Mask that is ANDed with ref and stored stencil value. face : str Can be 'front', 'back',...
[ "def", "set_stencil_mask", "(", "self", ",", "mask", "=", "8", ",", "face", "=", "'front_and_back'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilMaskSeparate'", ",", "face", ",", "int", "(", "mask", ")", ")" ]
Control the front or back writing of individual bits in the stencil Parameters ---------- mask : int Mask that is ANDed with ref and stored stencil value. face : str Can be 'front', 'back', or 'front_and_back'.
[ "Control", "the", "front", "or", "back", "writing", "of", "individual", "bits", "in", "the", "stencil", "Parameters", "----------", "mask", ":", "int", "Mask", "that", "is", "ANDed", "with", "ref", "and", "stored", "stencil", "value", ".", "face", ":", "st...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L338-L348
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_stencil_op
def set_stencil_op(self, sfail='keep', dpfail='keep', dppass='keep', face='front_and_back'): """Set front or back stencil test actions Parameters ---------- sfail : str Action to take when the stencil fails. Must be one of 'keep', 'zero...
python
def set_stencil_op(self, sfail='keep', dpfail='keep', dppass='keep', face='front_and_back'): """Set front or back stencil test actions Parameters ---------- sfail : str Action to take when the stencil fails. Must be one of 'keep', 'zero...
[ "def", "set_stencil_op", "(", "self", ",", "sfail", "=", "'keep'", ",", "dpfail", "=", "'keep'", ",", "dppass", "=", "'keep'", ",", "face", "=", "'front_and_back'", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glStencilOpSeparate'",...
Set front or back stencil test actions Parameters ---------- sfail : str Action to take when the stencil fails. Must be one of 'keep', 'zero', 'replace', 'incr', 'incr_wrap', 'decr', 'decr_wrap', or 'invert'. dpfail : str Action to tak...
[ "Set", "front", "or", "back", "stencil", "test", "actions", "Parameters", "----------", "sfail", ":", "str", "Action", "to", "take", "when", "the", "stencil", "fails", ".", "Must", "be", "one", "of", "keep", "zero", "replace", "incr", "incr_wrap", "decr", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L350-L370
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_color_mask
def set_color_mask(self, red, green, blue, alpha): """Toggle writing of frame buffer color components Parameters ---------- red : bool Red toggle. green : bool Green toggle. blue : bool Blue toggle. alpha : bool ...
python
def set_color_mask(self, red, green, blue, alpha): """Toggle writing of frame buffer color components Parameters ---------- red : bool Red toggle. green : bool Green toggle. blue : bool Blue toggle. alpha : bool ...
[ "def", "set_color_mask", "(", "self", ",", "red", ",", "green", ",", "blue", ",", "alpha", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glColorMask'", ",", "bool", "(", "red", ")", ",", "bool", "(", "green", ")", ",", "bool"...
Toggle writing of frame buffer color components Parameters ---------- red : bool Red toggle. green : bool Green toggle. blue : bool Blue toggle. alpha : bool Alpha toggle.
[ "Toggle", "writing", "of", "frame", "buffer", "color", "components", "Parameters", "----------", "red", ":", "bool", "Red", "toggle", ".", "green", ":", "bool", "Green", "toggle", ".", "blue", ":", "bool", "Blue", "toggle", ".", "alpha", ":", "bool", "Alph...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L395-L410
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_sample_coverage
def set_sample_coverage(self, value=1.0, invert=False): """Specify multisample coverage parameters Parameters ---------- value : float Sample coverage value (will be clamped between 0. and 1.). invert : bool Specify if the coverage masks should be inv...
python
def set_sample_coverage(self, value=1.0, invert=False): """Specify multisample coverage parameters Parameters ---------- value : float Sample coverage value (will be clamped between 0. and 1.). invert : bool Specify if the coverage masks should be inv...
[ "def", "set_sample_coverage", "(", "self", ",", "value", "=", "1.0", ",", "invert", "=", "False", ")", ":", "self", ".", "glir", ".", "command", "(", "'FUNC'", ",", "'glSampleCoverage'", ",", "float", "(", "value", ")", ",", "bool", "(", "invert", ")",...
Specify multisample coverage parameters Parameters ---------- value : float Sample coverage value (will be clamped between 0. and 1.). invert : bool Specify if the coverage masks should be inverted.
[ "Specify", "multisample", "coverage", "parameters", "Parameters", "----------", "value", ":", "float", "Sample", "coverage", "value", "(", "will", "be", "clamped", "between", "0", ".", "and", "1", ".", ")", ".", "invert", ":", "bool", "Specify", "if", "the",...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L412-L423
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_state
def set_state(self, preset=None, **kwargs): """Set OpenGL rendering state, optionally using a preset Parameters ---------- preset : str | None Can be one of ('opaque', 'translucent', 'additive') to use use reasonable defaults for these typical use cases. ...
python
def set_state(self, preset=None, **kwargs): """Set OpenGL rendering state, optionally using a preset Parameters ---------- preset : str | None Can be one of ('opaque', 'translucent', 'additive') to use use reasonable defaults for these typical use cases. ...
[ "def", "set_state", "(", "self", ",", "preset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "deepcopy", "(", "kwargs", ")", "# Load preset, if supplied", "if", "preset", "is", "not", "None", ":", "_check_valid", "(", "'preset'", ",", "...
Set OpenGL rendering state, optionally using a preset Parameters ---------- preset : str | None Can be one of ('opaque', 'translucent', 'additive') to use use reasonable defaults for these typical use cases. **kwargs : keyword arguments Other supp...
[ "Set", "OpenGL", "rendering", "state", "optionally", "using", "a", "preset", "Parameters", "----------", "preset", ":", "str", "|", "None", "Can", "be", "one", "of", "(", "opaque", "translucent", "additive", ")", "to", "use", "use", "reasonable", "defaults", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L442-L527
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.finish
def finish(self): """Wait for GL commands to to finish This creates a GLIR command for glFinish and then processes the GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this function will return before GL has finished processing the commands. """ if ...
python
def finish(self): """Wait for GL commands to to finish This creates a GLIR command for glFinish and then processes the GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this function will return before GL has finished processing the commands. """ if ...
[ "def", "finish", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'flush_commands'", ")", ":", "context", "=", "self", "else", ":", "context", "=", "get_current_canvas", "(", ")", ".", "context", "context", ".", "glir", ".", "command", "(", "...
Wait for GL commands to to finish This creates a GLIR command for glFinish and then processes the GLIR commands. If the GLIR interpreter is remote (e.g. WebGL), this function will return before GL has finished processing the commands.
[ "Wait", "for", "GL", "commands", "to", "to", "finish", "This", "creates", "a", "GLIR", "command", "for", "glFinish", "and", "then", "processes", "the", "GLIR", "commands", ".", "If", "the", "GLIR", "interpreter", "is", "remote", "(", "e", ".", "g", ".", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L533-L545
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.flush
def flush(self): """Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue. """ if hasattr(self, 'flush_commands'): context = self else: context = get_current_canvas().context context.glir.command('...
python
def flush(self): """Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue. """ if hasattr(self, 'flush_commands'): context = self else: context = get_current_canvas().context context.glir.command('...
[ "def", "flush", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'flush_commands'", ")", ":", "context", "=", "self", "else", ":", "context", "=", "get_current_canvas", "(", ")", ".", "context", "context", ".", "glir", ".", "command", "(", "'...
Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue.
[ "Flush", "GL", "commands", "This", "is", "a", "wrapper", "for", "glFlush", "()", ".", "This", "also", "flushes", "the", "GLIR", "command", "queue", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L547-L558
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
BaseGlooFunctions.set_hint
def set_hint(self, target, mode): """Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care'). ...
python
def set_hint(self, target, mode): """Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care'). ...
[ "def", "set_hint", "(", "self", ",", "target", ",", "mode", ")", ":", "if", "not", "all", "(", "isinstance", "(", "tm", ",", "string_types", ")", "for", "tm", "in", "(", "target", ",", "mode", ")", ")", ":", "raise", "TypeError", "(", "'target and mo...
Set OpenGL drawing hint Parameters ---------- target : str The target, e.g. 'fog_hint', 'line_smooth_hint', 'point_smooth_hint'. mode : str The mode to set (e.g., 'fastest', 'nicest', 'dont_care').
[ "Set", "OpenGL", "drawing", "hint", "Parameters", "----------", "target", ":", "str", "The", "target", "e", ".", "g", ".", "fog_hint", "line_smooth_hint", "point_smooth_hint", ".", "mode", ":", "str", "The", "mode", "to", "set", "(", "e", ".", "g", ".", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L560-L573
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
GlooFunctions.glir
def glir(self): """ The GLIR queue corresponding to the current canvas """ canvas = get_current_canvas() if canvas is None: msg = ("If you want to use gloo without vispy.app, " + "use a gloo.context.FakeCanvas.") raise RuntimeError('Gloo requir...
python
def glir(self): """ The GLIR queue corresponding to the current canvas """ canvas = get_current_canvas() if canvas is None: msg = ("If you want to use gloo without vispy.app, " + "use a gloo.context.FakeCanvas.") raise RuntimeError('Gloo requir...
[ "def", "glir", "(", "self", ")", ":", "canvas", "=", "get_current_canvas", "(", ")", "if", "canvas", "is", "None", ":", "msg", "=", "(", "\"If you want to use gloo without vispy.app, \"", "+", "\"use a gloo.context.FakeCanvas.\"", ")", "raise", "RuntimeError", "(", ...
The GLIR queue corresponding to the current canvas
[ "The", "GLIR", "queue", "corresponding", "to", "the", "current", "canvas" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L579-L587
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
use_gl
def use_gl(target='gl2'): """ Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the ...
python
def use_gl(target='gl2'): """ Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the ...
[ "def", "use_gl", "(", "target", "=", "'gl2'", ")", ":", "target", "=", "target", "or", "'gl2'", "target", "=", "target", ".", "replace", "(", "'+'", ",", "'plus'", ")", "# Get options", "target", ",", "_", ",", "options", "=", "target", ".", "partition...
Let Vispy use the target OpenGL ES 2.0 implementation Also see ``vispy.use()``. Parameters ---------- target : str The target GL backend to use. Available backends: * gl2 - Use ES 2.0 subset of desktop (i.e. normal) OpenGL * gl+ - Use the desktop ES 2.0 subset plus all non...
[ "Let", "Vispy", "use", "the", "target", "OpenGL", "ES", "2", ".", "0", "implementation", "Also", "see", "vispy", ".", "use", "()", ".", "Parameters", "----------", "target", ":", "str", "The", "target", "GL", "backend", "to", "use", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L102-L150
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
_clear_namespace
def _clear_namespace(): """ Clear names that are not part of the strict ES API """ ok_names = set(default_backend.__dict__) ok_names.update(['gl2', 'glplus']) # don't remove the module NS = globals() for name in list(NS.keys()): if name.lower().startswith('gl'): if name not ...
python
def _clear_namespace(): """ Clear names that are not part of the strict ES API """ ok_names = set(default_backend.__dict__) ok_names.update(['gl2', 'glplus']) # don't remove the module NS = globals() for name in list(NS.keys()): if name.lower().startswith('gl'): if name not ...
[ "def", "_clear_namespace", "(", ")", ":", "ok_names", "=", "set", "(", "default_backend", ".", "__dict__", ")", "ok_names", ".", "update", "(", "[", "'gl2'", ",", "'glplus'", "]", ")", "# don't remove the module", "NS", "=", "globals", "(", ")", "for", "na...
Clear names that are not part of the strict ES API
[ "Clear", "names", "that", "are", "not", "part", "of", "the", "strict", "ES", "API" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L153-L162
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
_copy_gl_functions
def _copy_gl_functions(source, dest, constants=False): """ Inject all objects that start with 'gl' from the source into the dest. source and dest can be dicts, modules or BaseGLProxy's. """ # Get dicts if isinstance(source, BaseGLProxy): s = {} for key in dir(source): s[k...
python
def _copy_gl_functions(source, dest, constants=False): """ Inject all objects that start with 'gl' from the source into the dest. source and dest can be dicts, modules or BaseGLProxy's. """ # Get dicts if isinstance(source, BaseGLProxy): s = {} for key in dir(source): s[k...
[ "def", "_copy_gl_functions", "(", "source", ",", "dest", ",", "constants", "=", "False", ")", ":", "# Get dicts", "if", "isinstance", "(", "source", ",", "BaseGLProxy", ")", ":", "s", "=", "{", "}", "for", "key", "in", "dir", "(", "source", ")", ":", ...
Inject all objects that start with 'gl' from the source into the dest. source and dest can be dicts, modules or BaseGLProxy's.
[ "Inject", "all", "objects", "that", "start", "with", "gl", "from", "the", "source", "into", "the", "dest", ".", "source", "and", "dest", "can", "be", "dicts", "modules", "or", "BaseGLProxy", "s", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L165-L187
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
check_error
def check_error(when='periodic check'): """ Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done. """ errors = [] while True: err = glGetError() if ...
python
def check_error(when='periodic check'): """ Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done. """ errors = [] while True: err = glGetError() if ...
[ "def", "check_error", "(", "when", "=", "'periodic check'", ")", ":", "errors", "=", "[", "]", "while", "True", ":", "err", "=", "glGetError", "(", ")", "if", "err", "==", "GL_NO_ERROR", "or", "(", "errors", "and", "err", "==", "errors", "[", "-", "1...
Check this from time to time to detect GL errors. Parameters ---------- when : str Shown in the exception to help the developer determine when this check was done.
[ "Check", "this", "from", "time", "to", "time", "to", "detect", "GL", "errors", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L190-L211
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
DebugProxy._arg_repr
def _arg_repr(self, arg): """ Get a useful (and not too large) represetation of an argument. """ r = repr(arg) max = 40 if len(r) > max: if hasattr(arg, 'shape'): r = 'array:' + 'x'.join([repr(s) for s in arg.shape]) else: r...
python
def _arg_repr(self, arg): """ Get a useful (and not too large) represetation of an argument. """ r = repr(arg) max = 40 if len(r) > max: if hasattr(arg, 'shape'): r = 'array:' + 'x'.join([repr(s) for s in arg.shape]) else: r...
[ "def", "_arg_repr", "(", "self", ",", "arg", ")", ":", "r", "=", "repr", "(", "arg", ")", "max", "=", "40", "if", "len", "(", "r", ")", ">", "max", ":", "if", "hasattr", "(", "arg", ",", "'shape'", ")", ":", "r", "=", "'array:'", "+", "'x'", ...
Get a useful (and not too large) represetation of an argument.
[ "Get", "a", "useful", "(", "and", "not", "too", "large", ")", "represetation", "of", "an", "argument", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L65-L75
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual.set_data
def set_data(self, data): """ Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``. """ self._data = data ...
python
def set_data(self, data): """ Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``. """ self._data = data ...
[ "def", "set_data", "(", "self", ",", "data", ")", ":", "self", ".", "_data", "=", "data", "# if using matplotlib isoline algorithm we have to check for meshgrid", "# and we can setup the tracer object here", "if", "_HAS_MPL", ":", "if", "self", ".", "_X", "is", "None", ...
Set the scalar array data Parameters ---------- data : ndarray A 2D array of scalar values. The isocurve is constructed to show all locations in the scalar field equal to ``self.levels``.
[ "Set", "the", "scalar", "array", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L96-L127
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual._get_verts_and_connect
def _get_verts_and_connect(self, paths): """ retrieve vertices and connects from given paths-list """ verts = np.vstack(paths) gaps = np.add.accumulate(np.array([len(x) for x in paths])) - 1 connect = np.ones(gaps[-1], dtype=bool) connect[gaps[:-1]] = False return...
python
def _get_verts_and_connect(self, paths): """ retrieve vertices and connects from given paths-list """ verts = np.vstack(paths) gaps = np.add.accumulate(np.array([len(x) for x in paths])) - 1 connect = np.ones(gaps[-1], dtype=bool) connect[gaps[:-1]] = False return...
[ "def", "_get_verts_and_connect", "(", "self", ",", "paths", ")", ":", "verts", "=", "np", ".", "vstack", "(", "paths", ")", "gaps", "=", "np", ".", "add", ".", "accumulate", "(", "np", ".", "array", "(", "[", "len", "(", "x", ")", "for", "x", "in...
retrieve vertices and connects from given paths-list
[ "retrieve", "vertices", "and", "connects", "from", "given", "paths", "-", "list" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L129-L136
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
IsocurveVisual._compute_iso_line
def _compute_iso_line(self): """ compute LineVisual vertices, connects and color-index """ level_index = [] connects = [] verts = [] # calculate which level are within data range # this works for now and the existing examples, but should be tested # thoro...
python
def _compute_iso_line(self): """ compute LineVisual vertices, connects and color-index """ level_index = [] connects = [] verts = [] # calculate which level are within data range # this works for now and the existing examples, but should be tested # thoro...
[ "def", "_compute_iso_line", "(", "self", ")", ":", "level_index", "=", "[", "]", "connects", "=", "[", "]", "verts", "=", "[", "]", "# calculate which level are within data range", "# this works for now and the existing examples, but should be tested", "# thoroughly also with...
compute LineVisual vertices, connects and color-index
[ "compute", "LineVisual", "vertices", "connects", "and", "color", "-", "index" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L138-L175
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.connect
def connect(self, callback, ref=False, position='first', before=None, after=None): """Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_nam...
python
def connect(self, callback, ref=False, position='first', before=None, after=None): """Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_nam...
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "callbacks", "=", "self", ".", "callbacks", "callback_refs", "=", "self", ".", ...
Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_name) where object.attr_name will point to a callable object. Note that only a weak reference to ``ob...
[ "Connect", "this", "emitter", "to", "a", "new", "callback", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L266-L373
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.disconnect
def disconnect(self, callback=None): """Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing. """ if callback is None: self._callbacks = [] ...
python
def disconnect(self, callback=None): """Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing. """ if callback is None: self._callbacks = [] ...
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "_callbacks", "=", "[", "]", "self", ".", "_callback_refs", "=", "[", "]", "else", ":", "callback", "=", "self", ".", "_normal...
Disconnect a callback from this emitter. If no callback is specified, then *all* callbacks are removed. If the callback was not already connected, then the call does nothing.
[ "Disconnect", "a", "callback", "from", "this", "emitter", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L375-L389
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.block
def block(self, callback=None): """Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same ...
python
def block(self, callback=None): """Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same ...
[ "def", "block", "(", "self", ",", "callback", "=", "None", ")", ":", "self", ".", "_blocked", "[", "callback", "]", "=", "self", ".", "_blocked", ".", "get", "(", "callback", ",", "0", ")", "+", "1" ]
Block this emitter. Any attempts to emit an event while blocked will be silently ignored. If *callback* is given, then the emitter is only blocked for that specific callback. Calls to block are cumulative; the emitter must be unblocked the same number of times as it is blocked.
[ "Block", "this", "emitter", ".", "Any", "attempts", "to", "emit", "an", "event", "while", "blocked", "will", "be", "silently", "ignored", ".", "If", "*", "callback", "*", "is", "given", "then", "the", "emitter", "is", "only", "blocked", "for", "that", "s...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L500-L508
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EventEmitter.unblock
def unblock(self, callback=None): """ Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``. """ ...
python
def unblock(self, callback=None): """ Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``. """ ...
[ "def", "unblock", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "not", "in", "self", ".", "_blocked", "or", "self", ".", "_blocked", "[", "callback", "]", "==", "0", ":", "raise", "RuntimeError", "(", "\"Cannot unblock %s for callb...
Unblock this emitter. See :func:`event.EventEmitter.block`. Note: Use of ``unblock(None)`` only reverses the effect of ``block(None)``; it does not unblock callbacks that were explicitly blocked using ``block(callback)``.
[ "Unblock", "this", "emitter", ".", "See", ":", "func", ":", "event", ".", "EventEmitter", ".", "block", ".", "Note", ":", "Use", "of", "unblock", "(", "None", ")", "only", "reverses", "the", "effect", "of", "block", "(", "None", ")", ";", "it", "does...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L510-L525
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.add
def add(self, auto_connect=None, **kwargs): """ Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # Thi...
python
def add(self, auto_connect=None, **kwargs): """ Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # Thi...
[ "def", "add", "(", "self", ",", "auto_connect", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "auto_connect", "is", "None", ":", "auto_connect", "=", "self", ".", "auto_connect", "# check all names before adding anything", "for", "name", "in", "kwargs"...
Add one or more EventEmitter instances to this emitter group. Each keyword argument may be specified as either an EventEmitter instance or an Event subclass, in which case an EventEmitter will be generated automatically:: # This statement: group.add(mouse_press=MouseEven...
[ "Add", "one", "or", "more", "EventEmitter", "instances", "to", "this", "emitter", "group", ".", "Each", "keyword", "argument", "may", "be", "specified", "as", "either", "an", "EventEmitter", "instance", "or", "an", "Event", "subclass", "in", "which", "case", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L633-L690
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.block_all
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
python
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
[ "def", "block_all", "(", "self", ")", ":", "self", ".", "block", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "block", "(", ")" ]
Block all emitters in this group.
[ "Block", "all", "emitters", "in", "this", "group", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L705-L710
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.unblock_all
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
python
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
[ "def", "unblock_all", "(", "self", ")", ":", "self", ".", "unblock", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "unblock", "(", ")" ]
Unblock all emitters in this group.
[ "Unblock", "all", "emitters", "in", "this", "group", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L712-L717
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.connect
def connect(self, callback, ref=False, position='first', before=None, after=None): """ Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` ...
python
def connect(self, callback, ref=False, position='first', before=None, after=None): """ Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` ...
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "self", ".", "_connect_emitters", "(", "True", ")", "return", "EventEmitter", "....
Connect the callback to the event group. The callback will receive events from *all* of the emitters in the group. See :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for arguments.
[ "Connect", "the", "callback", "to", "the", "event", "group", ".", "The", "callback", "will", "receive", "events", "from", "*", "all", "*", "of", "the", "emitters", "in", "the", "group", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L719-L729
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/event.py
EmitterGroup.disconnect
def disconnect(self, callback=None): """ Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information. """ ret = EventEmitter.disconnect(self, c...
python
def disconnect(self, callback=None): """ Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information. """ ret = EventEmitter.disconnect(self, c...
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "ret", "=", "EventEmitter", ".", "disconnect", "(", "self", ",", "callback", ")", "if", "len", "(", "self", ".", "_callbacks", ")", "==", "0", ":", "self", ".", "_connect_emitter...
Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information.
[ "Disconnect", "the", "callback", "from", "this", "group", ".", "See", ":", "func", ":", "connect", "()", "<vispy", ".", "event", ".", "EmitterGroup", ".", "connect", ">", "and", ":", "func", ":", "EventEmitter", ".", "connect", "()", "<vispy", ".", "even...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L731-L740
anjishnu/ask-alexa-pykit
ask/write_sample.py
validate_input_format
def validate_input_format(utterance, intent): """ TODO add handling for bad input""" slots = {slot["name"] for slot in intent["slots"]} split_utt = re.split("{(.*)}", utterance) banned = set("-/\\()^%$#@~`-_=+><;:") # Banned characters for token in split_utt: if (banned & set(token)): ...
python
def validate_input_format(utterance, intent): """ TODO add handling for bad input""" slots = {slot["name"] for slot in intent["slots"]} split_utt = re.split("{(.*)}", utterance) banned = set("-/\\()^%$#@~`-_=+><;:") # Banned characters for token in split_utt: if (banned & set(token)): ...
[ "def", "validate_input_format", "(", "utterance", ",", "intent", ")", ":", "slots", "=", "{", "slot", "[", "\"name\"", "]", "for", "slot", "in", "intent", "[", "\"slots\"", "]", "}", "split_utt", "=", "re", ".", "split", "(", "\"{(.*)}\"", ",", "utteranc...
TODO add handling for bad input
[ "TODO", "add", "handling", "for", "bad", "input" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/write_sample.py#L25-L47
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/isosurface.py
isosurface
def isosurface(data, level): """ Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurf...
python
def isosurface(data, level): """ Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurf...
[ "def", "isosurface", "(", "data", ",", "level", ")", ":", "# For improvement, see:", "# ", "# Efficient implementation of Marching Cubes' cases with topological ", "# guarantees.", "# Thomas Lewiner, Helio Lopes, Antonio Wilson Vieira and Geovan Tavares.", "# Journal of Graphics Tools 8(2)...
Generate isosurface from volumetric data using marching cubes algorithm. See Paul Bourke, "Polygonising a Scalar Field" (http://paulbourke.net/geometry/polygonise/) *data* 3D numpy array of scalar values *level* The level at which to generate an isosurface Returns an array of vertex c...
[ "Generate", "isosurface", "from", "volumetric", "data", "using", "marching", "cubes", "algorithm", ".", "See", "Paul", "Bourke", "Polygonising", "a", "Scalar", "Field", "(", "http", ":", "//", "paulbourke", ".", "net", "/", "geometry", "/", "polygonise", "/", ...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isosurface.py#L6-L135
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
_extract_buffers
def _extract_buffers(commands): """Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.""" # First, filter all DATA commands. data_commands = [command for co...
python
def _extract_buffers(commands): """Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.""" # First, filter all DATA commands. data_commands = [command for co...
[ "def", "_extract_buffers", "(", "commands", ")", ":", "# First, filter all DATA commands.", "data_commands", "=", "[", "command", "for", "command", "in", "commands", "if", "command", "[", "0", "]", "==", "'DATA'", "]", "# Extract the arrays.", "buffers", "=", "[",...
Extract all data buffers from the list of GLIR commands, and replace them by buffer pointers {buffer: <buffer_index>}. Return the modified list # of GILR commands and the list of buffers as well.
[ "Extract", "all", "data", "buffers", "from", "the", "list", "of", "GLIR", "commands", "and", "replace", "them", "by", "buffer", "pointers", "{", "buffer", ":", "<buffer_index", ">", "}", ".", "Return", "the", "modified", "list", "#", "of", "GILR", "command...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L19-L35
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
_serialize_item
def _serialize_item(item): """Internal function: serialize native types.""" # Recursively serialize lists, tuples, and dicts. if isinstance(item, (list, tuple)): return [_serialize_item(subitem) for subitem in item] elif isinstance(item, dict): return dict([(key, _serialize_item(value)) ...
python
def _serialize_item(item): """Internal function: serialize native types.""" # Recursively serialize lists, tuples, and dicts. if isinstance(item, (list, tuple)): return [_serialize_item(subitem) for subitem in item] elif isinstance(item, dict): return dict([(key, _serialize_item(value)) ...
[ "def", "_serialize_item", "(", "item", ")", ":", "# Recursively serialize lists, tuples, and dicts.", "if", "isinstance", "(", "item", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "_serialize_item", "(", "subitem", ")", "for", "subitem", "in", ...
Internal function: serialize native types.
[ "Internal", "function", ":", "serialize", "native", "types", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L38-L64
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
create_glir_message
def create_glir_message(commands, array_serialization=None): """Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Se...
python
def create_glir_message(commands, array_serialization=None): """Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Se...
[ "def", "create_glir_message", "(", "commands", ",", "array_serialization", "=", "None", ")", ":", "# Default serialization method for NumPy arrays.", "if", "array_serialization", "is", "None", ":", "array_serialization", "=", "'binary'", "# Extract the buffers.", "commands_mo...
Create a JSON-serializable message of GLIR commands. NumPy arrays are serialized according to the specified method. Arguments --------- commands : list List of GLIR commands. array_serialization : string or None Serialization method for NumPy arrays. Possible values are: ...
[ "Create", "a", "JSON", "-", "serializable", "message", "of", "GLIR", "commands", ".", "NumPy", "arrays", "are", "serialized", "according", "to", "the", "specified", "method", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L73-L104
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.start_session
def start_session(self): """ Start Session """ response = self.request("hello") bits = response.split(" ") self.server_info.update({ "server_version": bits[2], "protocol_version": bits[4], "screen_width": int(bits[7]), "screen_height": int...
python
def start_session(self): """ Start Session """ response = self.request("hello") bits = response.split(" ") self.server_info.update({ "server_version": bits[2], "protocol_version": bits[4], "screen_width": int(bits[7]), "screen_height": int...
[ "def", "start_session", "(", "self", ")", ":", "response", "=", "self", ".", "request", "(", "\"hello\"", ")", "bits", "=", "response", ".", "split", "(", "\" \"", ")", "self", ".", "server_info", ".", "update", "(", "{", "\"server_version\"", ":", "bits...
Start Session
[ "Start", "Session" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L53-L66
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.request
def request(self, command_string): """ Request """ self.send(command_string) if self.debug: print("Telnet Request: %s" % (command_string)) while True: response = urllib.parse.unquote(self.tn.read_until(b"\n").decode()) if "success" in response: # N...
python
def request(self, command_string): """ Request """ self.send(command_string) if self.debug: print("Telnet Request: %s" % (command_string)) while True: response = urllib.parse.unquote(self.tn.read_until(b"\n").decode()) if "success" in response: # N...
[ "def", "request", "(", "self", ",", "command_string", ")", ":", "self", ".", "send", "(", "command_string", ")", "if", "self", ".", "debug", ":", "print", "(", "\"Telnet Request: %s\"", "%", "(", "command_string", ")", ")", "while", "True", ":", "response...
Request
[ "Request" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L90-L108
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.add_screen
def add_screen(self, ref): """ Add Screen """ if ref not in self.screens: screen = Screen(self, ref) screen.clear() # TODO Check this is needed, new screens should be clear. self.screens[ref] = screen return self.screens[ref]
python
def add_screen(self, ref): """ Add Screen """ if ref not in self.screens: screen = Screen(self, ref) screen.clear() # TODO Check this is needed, new screens should be clear. self.screens[ref] = screen return self.screens[ref]
[ "def", "add_screen", "(", "self", ",", "ref", ")", ":", "if", "ref", "not", "in", "self", ".", "screens", ":", "screen", "=", "Screen", "(", "self", ",", "ref", ")", "screen", ".", "clear", "(", ")", "# TODO Check this is needed, new screens should be clear....
Add Screen
[ "Add", "Screen" ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L126-L134
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.add_key
def add_key(self, ref, mode="shared"): """ Add a key. (ref) Return key name or None on error """ if ref not in self.keys: response = self.request("client_add_key %s -%s" % (ref, mode)) if "success" not in response: return None ...
python
def add_key(self, ref, mode="shared"): """ Add a key. (ref) Return key name or None on error """ if ref not in self.keys: response = self.request("client_add_key %s -%s" % (ref, mode)) if "success" not in response: return None ...
[ "def", "add_key", "(", "self", ",", "ref", ",", "mode", "=", "\"shared\"", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_add_key %s -%s\"", "%", "(", "ref", ",", "mode", ")", ")"...
Add a key. (ref) Return key name or None on error
[ "Add", "a", "key", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L141-L153
rbarrois/mpdlcd
mpdlcd/vendor/lcdproc/server.py
Server.del_key
def del_key(self, ref): """ Delete a key. (ref) Return None or LCDd response on error """ if ref not in self.keys: response = self.request("client_del_key %s" % (ref)) self.keys.remove(ref) if "success" in response: ret...
python
def del_key(self, ref): """ Delete a key. (ref) Return None or LCDd response on error """ if ref not in self.keys: response = self.request("client_del_key %s" % (ref)) self.keys.remove(ref) if "success" in response: ret...
[ "def", "del_key", "(", "self", ",", "ref", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_del_key %s\"", "%", "(", "ref", ")", ")", "self", ".", "keys", ".", "remove", "(", "ref...
Delete a key. (ref) Return None or LCDd response on error
[ "Delete", "a", "key", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L155-L168
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.launch
def launch(self): """launch browser and virtual display, first of all to be launched""" try: # init virtual Display self.vbro = Display() self.vbro.start() logger.debug("virtual display launched") except Exception: raise exceptions.VBro...
python
def launch(self): """launch browser and virtual display, first of all to be launched""" try: # init virtual Display self.vbro = Display() self.vbro.start() logger.debug("virtual display launched") except Exception: raise exceptions.VBro...
[ "def", "launch", "(", "self", ")", ":", "try", ":", "# init virtual Display", "self", ".", "vbro", "=", "Display", "(", ")", "self", ".", "vbro", ".", "start", "(", ")", "logger", ".", "debug", "(", "\"virtual display launched\"", ")", "except", "Exception...
launch browser and virtual display, first of all to be launched
[ "launch", "browser", "and", "virtual", "display", "first", "of", "all", "to", "be", "launched" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L73-L88
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.css
def css(self, css_path, dom=None): """css find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_css, args=[css_path])
python
def css(self, css_path, dom=None): """css find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_css, args=[css_path])
[ "def", "css", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_css", ",", "args", "=", "[", "css_path", "]", ")" ]
css find function abbreviation
[ "css", "find", "function", "abbreviation" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L90-L94
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.css1
def css1(self, css_path, dom=None): """return the first value of self.css""" if dom is None: dom = self.browser def _css1(path, domm): """virtual local func""" return self.css(path, domm)[0] return expect(_css1, args=[css_path, dom])
python
def css1(self, css_path, dom=None): """return the first value of self.css""" if dom is None: dom = self.browser def _css1(path, domm): """virtual local func""" return self.css(path, domm)[0] return expect(_css1, args=[css_path, dom])
[ "def", "css1", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "def", "_css1", "(", "path", ",", "domm", ")", ":", "\"\"\"virtual local func\"\"\"", "return", "self", ...
return the first value of self.css
[ "return", "the", "first", "value", "of", "self", ".", "css" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L96-L105
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.search_name
def search_name(self, name, dom=None): """name find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_name, args=[name])
python
def search_name(self, name, dom=None): """name find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_name, args=[name])
[ "def", "search_name", "(", "self", ",", "name", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_name", ",", "args", "=", "[", "name", "]", ")" ]
name find function abbreviation
[ "name", "find", "function", "abbreviation" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L107-L111
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.xpath
def xpath(self, xpath, dom=None): """xpath find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_xpath, args=[xpath])
python
def xpath(self, xpath, dom=None): """xpath find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_xpath, args=[xpath])
[ "def", "xpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_xpath", ",", "args", "=", "[", "xpath", "]", ")" ]
xpath find function abbreviation
[ "xpath", "find", "function", "abbreviation" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L113-L117
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.elCss
def elCss(self, css_path, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_css, args=[css_path])
python
def elCss(self, css_path, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_css, args=[css_path])
[ "def", "elCss", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "is_element_present_by_css", ",", "args", "=", "[", "css_path", ...
check if element is present by css
[ "check", "if", "element", "is", "present", "by", "css" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L119-L123
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.elXpath
def elXpath(self, xpath, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_xpath, args=[xpath])
python
def elXpath(self, xpath, dom=None): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_xpath, args=[xpath])
[ "def", "elXpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "is_element_present_by_xpath", ",", "args", "=", "[", "xpath", "]...
check if element is present by css
[ "check", "if", "element", "is", "present", "by", "css" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L125-L129
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.login
def login(self, username, password, mode="demo"): """login function""" url = "https://trading212.com/it/login" try: logger.debug(f"visiting %s" % url) self.browser.visit(url) logger.debug(f"connected to %s" % url) except selenium.common.exceptions.WebD...
python
def login(self, username, password, mode="demo"): """login function""" url = "https://trading212.com/it/login" try: logger.debug(f"visiting %s" % url) self.browser.visit(url) logger.debug(f"connected to %s" % url) except selenium.common.exceptions.WebD...
[ "def", "login", "(", "self", ",", "username", ",", "password", ",", "mode", "=", "\"demo\"", ")", ":", "url", "=", "\"https://trading212.com/it/login\"", "try", ":", "logger", ".", "debug", "(", "f\"visiting %s\"", "%", "url", ")", "self", ".", "browser", ...
login function
[ "login", "function" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L131-L166
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.logout
def logout(self): """logout func (quit browser)""" try: self.browser.quit() except Exception: raise exceptions.BrowserException(self.brow_name, "not started") return False self.vbro.stop() logger.info("logged out") return True
python
def logout(self): """logout func (quit browser)""" try: self.browser.quit() except Exception: raise exceptions.BrowserException(self.brow_name, "not started") return False self.vbro.stop() logger.info("logged out") return True
[ "def", "logout", "(", "self", ")", ":", "try", ":", "self", ".", "browser", ".", "quit", "(", ")", "except", "Exception", ":", "raise", "exceptions", ".", "BrowserException", "(", "self", ".", "brow_name", ",", "\"not started\"", ")", "return", "False", ...
logout func (quit browser)
[ "logout", "func", "(", "quit", "browser", ")" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L168-L177
federico123579/Trading212-API
tradingAPI/low_level.py
LowLevelAPI.new_pos
def new_pos(self, html_div): """factory method pattern""" pos = self.Position(self, html_div) pos.bind_mov() self.positions.append(pos) return pos
python
def new_pos(self, html_div): """factory method pattern""" pos = self.Position(self, html_div) pos.bind_mov() self.positions.append(pos) return pos
[ "def", "new_pos", "(", "self", ",", "html_div", ")", ":", "pos", "=", "self", ".", "Position", "(", "self", ",", "html_div", ")", "pos", ".", "bind_mov", "(", ")", "self", ".", "positions", ".", "append", "(", "pos", ")", "return", "pos" ]
factory method pattern
[ "factory", "method", "pattern" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L526-L531
rbarrois/mpdlcd
mpdlcd/cli.py
_make_hostport
def _make_hostport(conn, default_host, default_port, default_user='', default_password=None): """Convert a '[user[:pass]@]host:port' string to a Connection tuple. If the given connection is empty, use defaults. If no port is given, use the default. Args: conn (str): the string describing the t...
python
def _make_hostport(conn, default_host, default_port, default_user='', default_password=None): """Convert a '[user[:pass]@]host:port' string to a Connection tuple. If the given connection is empty, use defaults. If no port is given, use the default. Args: conn (str): the string describing the t...
[ "def", "_make_hostport", "(", "conn", ",", "default_host", ",", "default_port", ",", "default_user", "=", "''", ",", "default_password", "=", "None", ")", ":", "parsed", "=", "urllib", ".", "parse", ".", "urlparse", "(", "'//%s'", "%", "conn", ")", "return...
Convert a '[user[:pass]@]host:port' string to a Connection tuple. If the given connection is empty, use defaults. If no port is given, use the default. Args: conn (str): the string describing the target hsot/port default_host (str): the host to use if ``conn`` is empty default_port...
[ "Convert", "a", "[", "user", "[", ":", "pass", "]", "@", "]", "host", ":", "port", "string", "to", "a", "Connection", "tuple", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L106-L126
rbarrois/mpdlcd
mpdlcd/cli.py
_make_lcdproc
def _make_lcdproc( lcd_host, lcd_port, retry_config, charset=DEFAULT_LCDPROC_CHARSET, lcdd_debug=False): """Create and connect to the LCDd server. Args: lcd_host (str): the hostname to connect to lcd_prot (int): the port to connect to charset (str): the charset to use wh...
python
def _make_lcdproc( lcd_host, lcd_port, retry_config, charset=DEFAULT_LCDPROC_CHARSET, lcdd_debug=False): """Create and connect to the LCDd server. Args: lcd_host (str): the hostname to connect to lcd_prot (int): the port to connect to charset (str): the charset to use wh...
[ "def", "_make_lcdproc", "(", "lcd_host", ",", "lcd_port", ",", "retry_config", ",", "charset", "=", "DEFAULT_LCDPROC_CHARSET", ",", "lcdd_debug", "=", "False", ")", ":", "class", "ServerSpawner", "(", "utils", ".", "AutoRetryCandidate", ")", ":", "\"\"\"Spawn the ...
Create and connect to the LCDd server. Args: lcd_host (str): the hostname to connect to lcd_prot (int): the port to connect to charset (str): the charset to use when sending messages to lcdproc lcdd_debug (bool): whether to enable full LCDd debug retry_attempts (int): the nu...
[ "Create", "and", "connect", "to", "the", "LCDd", "server", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L129-L161
rbarrois/mpdlcd
mpdlcd/cli.py
_make_patterns
def _make_patterns(patterns): """Create a ScreenPatternList from a given pattern text. Args: pattern_txt (str list): the patterns Returns: mpdlcd.display_pattern.ScreenPatternList: a list of patterns from the given entries. """ field_registry = display_fields.FieldRegis...
python
def _make_patterns(patterns): """Create a ScreenPatternList from a given pattern text. Args: pattern_txt (str list): the patterns Returns: mpdlcd.display_pattern.ScreenPatternList: a list of patterns from the given entries. """ field_registry = display_fields.FieldRegis...
[ "def", "_make_patterns", "(", "patterns", ")", ":", "field_registry", "=", "display_fields", ".", "FieldRegistry", "(", ")", "pattern_list", "=", "display_pattern", ".", "ScreenPatternList", "(", "field_registry", "=", "field_registry", ",", ")", "for", "pattern", ...
Create a ScreenPatternList from a given pattern text. Args: pattern_txt (str list): the patterns Returns: mpdlcd.display_pattern.ScreenPatternList: a list of patterns from the given entries.
[ "Create", "a", "ScreenPatternList", "from", "a", "given", "pattern", "text", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L164-L181
rbarrois/mpdlcd
mpdlcd/cli.py
run_forever
def run_forever( lcdproc='', mpd='', lcdproc_screen=DEFAULT_LCD_SCREEN_NAME, lcdproc_charset=DEFAULT_LCDPROC_CHARSET, lcdd_debug=False, pattern='', patterns=[], refresh=DEFAULT_REFRESH, backlight_on=DEFAULT_BACKLIGHT_ON, priority_playing=DEFAULT_PRIORITY, ...
python
def run_forever( lcdproc='', mpd='', lcdproc_screen=DEFAULT_LCD_SCREEN_NAME, lcdproc_charset=DEFAULT_LCDPROC_CHARSET, lcdd_debug=False, pattern='', patterns=[], refresh=DEFAULT_REFRESH, backlight_on=DEFAULT_BACKLIGHT_ON, priority_playing=DEFAULT_PRIORITY, ...
[ "def", "run_forever", "(", "lcdproc", "=", "''", ",", "mpd", "=", "''", ",", "lcdproc_screen", "=", "DEFAULT_LCD_SCREEN_NAME", ",", "lcdproc_charset", "=", "DEFAULT_LCDPROC_CHARSET", ",", "lcdd_debug", "=", "False", ",", "pattern", "=", "''", ",", "patterns", ...
Run the server. Args: lcdproc (str): the target connection (host:port) for lcdproc mpd (str): the target connection ([pwd@]host:port) for mpd lcdproc_screen (str): the name of the screen to use for lcdproc lcdproc_charset (str): the charset to use with lcdproc lcdd_debug (bo...
[ "Run", "the", "server", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L184-L266
rbarrois/mpdlcd
mpdlcd/cli.py
_read_config
def _read_config(filename): """Read configuration from the given file. Parsing is performed through the configparser library. Returns: dict: a flattened dict of (option_name, value), using defaults. """ parser = configparser.RawConfigParser() if filename and not parser.read(filename): ...
python
def _read_config(filename): """Read configuration from the given file. Parsing is performed through the configparser library. Returns: dict: a flattened dict of (option_name, value), using defaults. """ parser = configparser.RawConfigParser() if filename and not parser.read(filename): ...
[ "def", "_read_config", "(", "filename", ")", ":", "parser", "=", "configparser", ".", "RawConfigParser", "(", ")", "if", "filename", "and", "not", "parser", ".", "read", "(", "filename", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"Unable to open ...
Read configuration from the given file. Parsing is performed through the configparser library. Returns: dict: a flattened dict of (option_name, value), using defaults.
[ "Read", "configuration", "from", "the", "given", "file", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L438-L478
rbarrois/mpdlcd
mpdlcd/cli.py
_extract_options
def _extract_options(config, options, *args): """Extract options values from a configparser, optparse pair. Options given on command line take precedence over options read in the configuration file. Args: config (dict): option values read from a config file through configparser ...
python
def _extract_options(config, options, *args): """Extract options values from a configparser, optparse pair. Options given on command line take precedence over options read in the configuration file. Args: config (dict): option values read from a config file through configparser ...
[ "def", "_extract_options", "(", "config", ",", "options", ",", "*", "args", ")", ":", "extract", "=", "{", "}", "for", "key", "in", "args", ":", "if", "key", "not", "in", "args", ":", "continue", "extract", "[", "key", "]", "=", "config", "[", "key...
Extract options values from a configparser, optparse pair. Options given on command line take precedence over options read in the configuration file. Args: config (dict): option values read from a config file through configparser options (optparse.Options): optparse 'options' o...
[ "Extract", "options", "values", "from", "a", "configparser", "optparse", "pair", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L481-L502
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
RenderBuffer.resize
def resize(self, shape, format=None): """ Set the render-buffer size and format Parameters ---------- shape : tuple of integers New shape in yx order. A render buffer is always 2D. For symmetry with the texture class, a 3-element tuple can also be giv...
python
def resize(self, shape, format=None): """ Set the render-buffer size and format Parameters ---------- shape : tuple of integers New shape in yx order. A render buffer is always 2D. For symmetry with the texture class, a 3-element tuple can also be giv...
[ "def", "resize", "(", "self", ",", "shape", ",", "format", "=", "None", ")", ":", "if", "not", "self", ".", "_resizeable", ":", "raise", "RuntimeError", "(", "\"RenderBuffer is not resizeable\"", ")", "# Check shape", "if", "not", "(", "isinstance", "(", "sh...
Set the render-buffer size and format Parameters ---------- shape : tuple of integers New shape in yx order. A render buffer is always 2D. For symmetry with the texture class, a 3-element tuple can also be given, in which case the last dimension is ignored. ...
[ "Set", "the", "render", "-", "buffer", "size", "and", "format" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L52-L90
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
FrameBuffer.activate
def activate(self): """ Activate/use this frame buffer. """ # Send command self._glir.command('FRAMEBUFFER', self._id, True) # Associate canvas now canvas = get_current_canvas() if canvas is not None: canvas.context.glir.associate(self.glir)
python
def activate(self): """ Activate/use this frame buffer. """ # Send command self._glir.command('FRAMEBUFFER', self._id, True) # Associate canvas now canvas = get_current_canvas() if canvas is not None: canvas.context.glir.associate(self.glir)
[ "def", "activate", "(", "self", ")", ":", "# Send command", "self", ".", "_glir", ".", "command", "(", "'FRAMEBUFFER'", ",", "self", ".", "_id", ",", "True", ")", "# Associate canvas now", "canvas", "=", "get_current_canvas", "(", ")", "if", "canvas", "is", ...
Activate/use this frame buffer.
[ "Activate", "/", "use", "this", "frame", "buffer", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L123-L131
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
FrameBuffer.shape
def shape(self): """ The shape of the Texture/RenderBuffer attached to this FrameBuffer """ if self.color_buffer is not None: return self.color_buffer.shape[:2] # in case its a texture if self.depth_buffer is not None: return self.depth_buffer.shape[:2] i...
python
def shape(self): """ The shape of the Texture/RenderBuffer attached to this FrameBuffer """ if self.color_buffer is not None: return self.color_buffer.shape[:2] # in case its a texture if self.depth_buffer is not None: return self.depth_buffer.shape[:2] i...
[ "def", "shape", "(", "self", ")", ":", "if", "self", ".", "color_buffer", "is", "not", "None", ":", "return", "self", ".", "color_buffer", ".", "shape", "[", ":", "2", "]", "# in case its a texture", "if", "self", ".", "depth_buffer", "is", "not", "None"...
The shape of the Texture/RenderBuffer attached to this FrameBuffer
[ "The", "shape", "of", "the", "Texture", "/", "RenderBuffer", "attached", "to", "this", "FrameBuffer" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L196-L205
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
FrameBuffer.resize
def resize(self, shape): """ Resize all attached buffers with the given shape Parameters ---------- shape : tuple of two integers New buffer shape (h, w), to be applied to all currently attached buffers. For buffers that are a texture, the number of c...
python
def resize(self, shape): """ Resize all attached buffers with the given shape Parameters ---------- shape : tuple of two integers New buffer shape (h, w), to be applied to all currently attached buffers. For buffers that are a texture, the number of c...
[ "def", "resize", "(", "self", ",", "shape", ")", ":", "# Check", "if", "not", "(", "isinstance", "(", "shape", ",", "tuple", ")", "and", "len", "(", "shape", ")", "==", "2", ")", ":", "raise", "ValueError", "(", "'RenderBuffer shape must be a 2-element tup...
Resize all attached buffers with the given shape Parameters ---------- shape : tuple of two integers New buffer shape (h, w), to be applied to all currently attached buffers. For buffers that are a texture, the number of color channels is preserved.
[ "Resize", "all", "attached", "buffers", "with", "the", "given", "shape" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L207-L227
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
FrameBuffer.read
def read(self, mode='color', alpha=True): """ Return array of pixel values in an attached buffer Parameters ---------- mode : str The buffer type to read. May be 'color', 'depth', or 'stencil'. alpha : bool If True, returns RGBA array. Otherwise, ...
python
def read(self, mode='color', alpha=True): """ Return array of pixel values in an attached buffer Parameters ---------- mode : str The buffer type to read. May be 'color', 'depth', or 'stencil'. alpha : bool If True, returns RGBA array. Otherwise, ...
[ "def", "read", "(", "self", ",", "mode", "=", "'color'", ",", "alpha", "=", "True", ")", ":", "_check_valid", "(", "'mode'", ",", "mode", ",", "[", "'color'", ",", "'depth'", ",", "'stencil'", "]", ")", "buffer", "=", "getattr", "(", "self", ",", "...
Return array of pixel values in an attached buffer Parameters ---------- mode : str The buffer type to read. May be 'color', 'depth', or 'stencil'. alpha : bool If True, returns RGBA array. Otherwise, returns RGB. Returns ------- ...
[ "Return", "array", "of", "pixel", "values", "in", "an", "attached", "buffer", "Parameters", "----------", "mode", ":", "str", "The", "buffer", "type", "to", "read", ".", "May", "be", "color", "depth", "or", "stencil", ".", "alpha", ":", "bool", "If", "Tr...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L229-L254
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/line/line.py
LineVisual.set_data
def set_data(self, pos=None, color=None, width=None, connect=None): """ Set the data used to draw this visual. Parameters ---------- pos : array Array of shape (..., 2) or (..., 3) specifying vertex coordinates. color : Color, tuple, or array The color to...
python
def set_data(self, pos=None, color=None, width=None, connect=None): """ Set the data used to draw this visual. Parameters ---------- pos : array Array of shape (..., 2) or (..., 3) specifying vertex coordinates. color : Color, tuple, or array The color to...
[ "def", "set_data", "(", "self", ",", "pos", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "connect", "=", "None", ")", ":", "if", "pos", "is", "not", "None", ":", "self", ".", "_bounds", "=", "None", "self", ".", "_pos",...
Set the data used to draw this visual. Parameters ---------- pos : array Array of shape (..., 2) or (..., 3) specifying vertex coordinates. color : Color, tuple, or array The color to use when drawing the line. If an array is given, it must be of shap...
[ "Set", "the", "data", "used", "to", "draw", "this", "visual", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L150-L190
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/line/line.py
LineVisual._compute_bounds
def _compute_bounds(self, axis, view): """Get the bounds Parameters ---------- mode : str Describes the type of boundary requested. Can be "visual", "data", or "mouse". axis : 0, 1, 2 The axis along which to measure the bounding values, in ...
python
def _compute_bounds(self, axis, view): """Get the bounds Parameters ---------- mode : str Describes the type of boundary requested. Can be "visual", "data", or "mouse". axis : 0, 1, 2 The axis along which to measure the bounding values, in ...
[ "def", "_compute_bounds", "(", "self", ",", "axis", ",", "view", ")", ":", "# Can and should we calculate bounds?", "if", "(", "self", ".", "_bounds", "is", "None", ")", "and", "self", ".", "_pos", "is", "not", "None", ":", "pos", "=", "self", ".", "_pos...
Get the bounds Parameters ---------- mode : str Describes the type of boundary requested. Can be "visual", "data", or "mouse". axis : 0, 1, 2 The axis along which to measure the bounding values, in x-y-z order.
[ "Get", "the", "bounds" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L240-L264
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/line/line.py
_AggLineVisual._agg_bake
def _agg_bake(cls, vertices, color, closed=False): """ Bake a list of 2D vertices for rendering them as thick line. Each line segment must have its own vertices because of antialias (this means no vertex sharing between two adjacent line segments). """ n = len(vertices) ...
python
def _agg_bake(cls, vertices, color, closed=False): """ Bake a list of 2D vertices for rendering them as thick line. Each line segment must have its own vertices because of antialias (this means no vertex sharing between two adjacent line segments). """ n = len(vertices) ...
[ "def", "_agg_bake", "(", "cls", ",", "vertices", ",", "color", ",", "closed", "=", "False", ")", ":", "n", "=", "len", "(", "vertices", ")", "P", "=", "np", ".", "array", "(", "vertices", ")", ".", "reshape", "(", "n", ",", "2", ")", ".", "asty...
Bake a list of 2D vertices for rendering them as thick line. Each line segment must have its own vertices because of antialias (this means no vertex sharing between two adjacent line segments).
[ "Bake", "a", "list", "of", "2D", "vertices", "for", "rendering", "them", "as", "thick", "line", ".", "Each", "line", "segment", "must", "have", "its", "own", "vertices", "because", "of", "antialias", "(", "this", "means", "no", "vertex", "sharing", "betwee...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L469-L547