repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/plot/plotwidget.py#L425-L499
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L96-L102
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/layer_artist.py#L110-L122
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L64-L68
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L71-L75
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L78-L84
train
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"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L606-L663
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L666-L708
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L100-L112
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L114-L124
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L146-L157
train
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", ":...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L159-L172
train
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", "."...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L181-L211
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L213-L225
train
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", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L253-L271
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L283-L299
train
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", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L304-L318
train
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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L320-L336
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L338-L348
train
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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L350-L370
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L395-L410
train
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",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L412-L423
train
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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L442-L527
train
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", ".", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L533-L545
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L547-L558
train
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", ".", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L560-L573
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L579-L587
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L102-L150
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L153-L162
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L165-L187
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L190-L211
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L65-L75
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L96-L127
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L129-L136
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L138-L175
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L266-L373
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L375-L389
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L500-L508
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L510-L525
train
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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L633-L690
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L705-L710
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L712-L717
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L719-L729
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L731-L740
train
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" ]
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/write_sample.py#L25-L47
train
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", "/", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isosurface.py#L6-L135
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L19-L35
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L38-L64
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L73-L104
train
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" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L53-L66
train
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" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L90-L108
train
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" ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L126-L134
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L141-L153
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L155-L168
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L73-L88
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L90-L94
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L96-L105
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L107-L111
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L113-L117
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L119-L123
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L125-L129
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L131-L166
train
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", ")" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L168-L177
train
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" ]
0fab20b71a2348e72bbe76071b81f3692128851f
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L526-L531
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L106-L126
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L129-L161
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L164-L181
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L184-L266
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L438-L478
train
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", "." ]
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L481-L502
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L52-L90
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L123-L131
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L196-L205
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L207-L227
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L229-L254
train
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", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L150-L190
train
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" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L240-L264
train
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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L469-L547
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py
_get_k_p_a
def _get_k_p_a(font, left, right): """This actually calculates the kerning + advance""" # http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html # 1) set up a CTTypesetter chars = left + right args = [None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBa...
python
def _get_k_p_a(font, left, right): """This actually calculates the kerning + advance""" # http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html # 1) set up a CTTypesetter chars = left + right args = [None, 1, cf.kCFTypeDictionaryKeyCallBacks, cf.kCFTypeDictionaryValueCallBa...
[ "def", "_get_k_p_a", "(", "font", ",", "left", ",", "right", ")", ":", "# http://lists.apple.com/archives/coretext-dev/2010/Dec/msg00020.html", "# 1) set up a CTTypesetter", "chars", "=", "left", "+", "right", "args", "=", "[", "None", ",", "1", ",", "cf", ".", "k...
This actually calculates the kerning + advance
[ "This", "actually", "calculates", "the", "kerning", "+", "advance" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py#L164-L184
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/gridmesh.py
GridMeshVisual.set_data
def set_data(self, xs=None, ys=None, zs=None, colors=None): '''Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of th...
python
def set_data(self, xs=None, ys=None, zs=None, colors=None): '''Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of th...
[ "def", "set_data", "(", "self", ",", "xs", "=", "None", ",", "ys", "=", "None", ",", "zs", "=", "None", ",", "colors", "=", "None", ")", ":", "if", "xs", "is", "None", ":", "xs", "=", "self", ".", "_xs", "self", ".", "__vertices", "=", "None", ...
Update the mesh data. Parameters ---------- xs : ndarray | None A 2d array of x coordinates for the vertices of the mesh. ys : ndarray | None A 2d array of y coordinates for the vertices of the mesh. zs : ndarray | None A 2d array of z coordin...
[ "Update", "the", "mesh", "data", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/gridmesh.py#L55-L99
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
_make_png
def _make_png(data, level=6): """Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 control...
python
def _make_png(data, level=6): """Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 control...
[ "def", "_make_png", "(", "data", ",", "level", "=", "6", ")", ":", "# Eventually we might want to use ext/png.py for this, but this", "# routine *should* be faster b/c it's speacialized for our use case", "def", "mkchunk", "(", "data", ",", "name", ")", ":", "if", "isinstan...
Convert numpy array to PNG byte array. Parameters ---------- data : numpy.ndarray Data must be (H, W, 3 | 4) with dtype = np.ubyte (np.uint8) level : int https://docs.python.org/2/library/zlib.html#zlib.compress An integer from 0 to 9 controlling the level of compression: ...
[ "Convert", "numpy", "array", "to", "PNG", "byte", "array", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L17-L98
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
read_png
def read_png(filename): """Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave "...
python
def read_png(filename): """Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave "...
[ "def", "read_png", "(", "filename", ")", ":", "x", "=", "Reader", "(", "filename", ")", "try", ":", "alpha", "=", "x", ".", "asDirect", "(", ")", "[", "3", "]", "[", "'alpha'", "]", "if", "alpha", ":", "y", "=", "x", ".", "asRGBA8", "(", ")", ...
Read a PNG file to RGB8 or RGBA8 Unlike imread, this requires no external dependencies. Parameters ---------- filename : str File to read. Returns ------- data : array Image data. See also -------- write_png, imread, imsave
[ "Read", "a", "PNG", "file", "to", "RGB8", "or", "RGBA8" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L101-L133
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
write_png
def write_png(filename, data): """Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave """ data = np.asarray(data) ...
python
def write_png(filename, data): """Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave """ data = np.asarray(data) ...
[ "def", "write_png", "(", "filename", ",", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "not", "data", ".", "ndim", "==", "3", "and", "data", ".", "shape", "[", "-", "1", "]", "in", "(", "3", ",", "4", ")", ":",...
Write a PNG file Unlike imsave, this requires no external dependencies. Parameters ---------- filename : str File to save to. data : array Image data. See also -------- read_png, imread, imsave
[ "Write", "a", "PNG", "file" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L136-L156
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
imread
def imread(filename, format=None): """Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array ...
python
def imread(filename, format=None): """Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array ...
[ "def", "imread", "(", "filename", ",", "format", "=", "None", ")", ":", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imread", "(", "filename", ",", "format", ")", "elif", ...
Read image data from disk Requires imageio or PIL. Parameters ---------- filename : str Filename to read. format : str | None Format of the file. If None, it will be inferred from the filename. Returns ------- data : array Image data. See also --------...
[ "Read", "image", "data", "from", "disk" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L159-L194
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
imsave
def imsave(filename, im, format=None): """Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See...
python
def imsave(filename, im, format=None): """Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See...
[ "def", "imsave", "(", "filename", ",", "im", ",", "format", "=", "None", ")", ":", "# Import imageio or PIL", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imsave", "(", "fil...
Save image data to disk Requires imageio or PIL. Parameters ---------- filename : str Filename to write. im : array Image data. format : str | None Format of the file. If None, it will be inferred from the filename. See also -------- imread, read_png, write...
[ "Save", "image", "data", "to", "disk" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L197-L223
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/io/image.py
_check_img_lib
def _check_img_lib(): """Utility to search for imageio or PIL""" # Import imageio or PIL imageio = PIL = None try: import imageio except ImportError: try: import PIL.Image except ImportError: pass return imageio, PIL
python
def _check_img_lib(): """Utility to search for imageio or PIL""" # Import imageio or PIL imageio = PIL = None try: import imageio except ImportError: try: import PIL.Image except ImportError: pass return imageio, PIL
[ "def", "_check_img_lib", "(", ")", ":", "# Import imageio or PIL", "imageio", "=", "PIL", "=", "None", "try", ":", "import", "imageio", "except", "ImportError", ":", "try", ":", "import", "PIL", ".", "Image", "except", "ImportError", ":", "pass", "return", "...
Utility to search for imageio or PIL
[ "Utility", "to", "search", "for", "imageio", "or", "PIL" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L226-L237
train
anjishnu/ask-alexa-pykit
ask/config/config.py
read_from_user
def read_from_user(input_type, *args, **kwargs): ''' Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly. ''' def _read_in(*args, **kwargs): while True: try: tmp = raw_inpu...
python
def read_from_user(input_type, *args, **kwargs): ''' Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly. ''' def _read_in(*args, **kwargs): while True: try: tmp = raw_inpu...
[ "def", "read_from_user", "(", "input_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_read_in", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "try", ":", "tmp", "=", "raw_input", "(", "*", "args", ...
Helper function to prompt user for input of a specific type e.g. float, str, int Designed to work with both python 2 and 3 Yes I know this is ugly.
[ "Helper", "function", "to", "prompt", "user", "for", "input", "of", "a", "specific", "type", "e", ".", "g", ".", "float", "str", "int", "Designed", "to", "work", "with", "both", "python", "2", "and", "3", "Yes", "I", "know", "this", "is", "ugly", "."...
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L18-L33
train
anjishnu/ask-alexa-pykit
ask/config/config.py
load_builtin_slots
def load_builtin_slots(): ''' Helper function to load builtin slots from the data location ''' builtin_slots = {} for index, line in enumerate(open(BUILTIN_SLOTS_LOCATION)): o = line.strip().split('\t') builtin_slots[index] = {'name' : o[0], 'descript...
python
def load_builtin_slots(): ''' Helper function to load builtin slots from the data location ''' builtin_slots = {} for index, line in enumerate(open(BUILTIN_SLOTS_LOCATION)): o = line.strip().split('\t') builtin_slots[index] = {'name' : o[0], 'descript...
[ "def", "load_builtin_slots", "(", ")", ":", "builtin_slots", "=", "{", "}", "for", "index", ",", "line", "in", "enumerate", "(", "open", "(", "BUILTIN_SLOTS_LOCATION", ")", ")", ":", "o", "=", "line", ".", "strip", "(", ")", ".", "split", "(", "'\\t'",...
Helper function to load builtin slots from the data location
[ "Helper", "function", "to", "load", "builtin", "slots", "from", "the", "data", "location" ]
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L38-L47
train
brouberol/contexttimer
contexttimer/__init__.py
timer
def timer(logger=None, level=logging.INFO, fmt="function %(function_name)s execution time: %(execution_time).3f", *func_or_func_args, **timer_kwargs): """ Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor. """ ...
python
def timer(logger=None, level=logging.INFO, fmt="function %(function_name)s execution time: %(execution_time).3f", *func_or_func_args, **timer_kwargs): """ Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor. """ ...
[ "def", "timer", "(", "logger", "=", "None", ",", "level", "=", "logging", ".", "INFO", ",", "fmt", "=", "\"function %(function_name)s execution time: %(execution_time).3f\"", ",", "*", "func_or_func_args", ",", "*", "*", "timer_kwargs", ")", ":", "# store Timer kwar...
Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor.
[ "Function", "decorator", "displaying", "the", "function", "execution", "time" ]
a866f420ed4c10f29abf252c58b11f9db6706100
https://github.com/brouberol/contexttimer/blob/a866f420ed4c10f29abf252c58b11f9db6706100/contexttimer/__init__.py#L108-L141
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py
RawTriangleCollection.append
def append(self, points, indices, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the t...
python
def append(self, points, indices, **kwargs): """ Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the t...
[ "def", "append", "(", "self", ",", "points", ",", "indices", ",", "*", "*", "kwargs", ")", ":", "itemsize", "=", "len", "(", "points", ")", "itemcount", "=", "1", "V", "=", "np", ".", "empty", "(", "itemcount", "*", "itemsize", ",", "dtype", "=", ...
Append a new set of vertices to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- points : np.array Vertices composing the triangles indices : np.array Indices describi...
[ "Append", "a", "new", "set", "of", "vertices", "to", "the", "collection", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py#L40-L81
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
_mpl_to_vispy
def _mpl_to_vispy(fig): """Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas...
python
def _mpl_to_vispy(fig): """Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas...
[ "def", "_mpl_to_vispy", "(", "fig", ")", ":", "renderer", "=", "VispyRenderer", "(", ")", "exporter", "=", "Exporter", "(", "renderer", ")", "with", "warnings", ".", "catch_warnings", "(", "record", "=", "True", ")", ":", "# py3k mpl warning", "exporter", "....
Convert a given matplotlib figure to vispy This function is experimental and subject to change! Requires matplotlib and mplexporter. Parameters ---------- fig : instance of matplotlib Figure The populated figure to display. Returns ------- canvas : instance of Canvas T...
[ "Convert", "a", "given", "matplotlib", "figure", "to", "vispy" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L155-L176
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
show
def show(block=False): """Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were creat...
python
def show(block=False): """Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were creat...
[ "def", "show", "(", "block", "=", "False", ")", ":", "if", "not", "has_matplotlib", "(", ")", ":", "raise", "ImportError", "(", "'Requires matplotlib version >= 1.2'", ")", "cs", "=", "[", "_mpl_to_vispy", "(", "plt", ".", "figure", "(", "ii", ")", ")", ...
Show current figures using vispy Parameters ---------- block : bool If True, blocking mode will be used. If False, then non-blocking / interactive mode will be used. Returns ------- canvases : list List of the vispy canvases that were created.
[ "Show", "current", "figures", "using", "vispy" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L179-L198
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
VispyRenderer._mpl_ax_to
def _mpl_ax_to(self, mplobj, output='vb'): """Helper to get the parent axes of a given mplobj""" for ax in self._axs.values(): if ax['ax'] is mplobj.axes: return ax[output] raise RuntimeError('Parent axes could not be found!')
python
def _mpl_ax_to(self, mplobj, output='vb'): """Helper to get the parent axes of a given mplobj""" for ax in self._axs.values(): if ax['ax'] is mplobj.axes: return ax[output] raise RuntimeError('Parent axes could not be found!')
[ "def", "_mpl_ax_to", "(", "self", ",", "mplobj", ",", "output", "=", "'vb'", ")", ":", "for", "ax", "in", "self", ".", "_axs", ".", "values", "(", ")", ":", "if", "ax", "[", "'ax'", "]", "is", "mplobj", ".", "axes", ":", "return", "ax", "[", "o...
Helper to get the parent axes of a given mplobj
[ "Helper", "to", "get", "the", "parent", "axes", "of", "a", "given", "mplobj" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L138-L143
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py
random
def random(adjacency_mat, directed=False, random_state=None): """ Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also genera...
python
def random(adjacency_mat, directed=False, random_state=None): """ Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also genera...
[ "def", "random", "(", "adjacency_mat", ",", "directed", "=", "False", ",", "random_state", "=", "None", ")", ":", "if", "random_state", "is", "None", ":", "random_state", "=", "np", ".", "random", "elif", "not", "isinstance", "(", "random_state", ",", "np"...
Place the graph nodes at random places. Parameters ---------- adjacency_mat : matrix or sparse The graph adjacency matrix directed : bool Whether the graph is directed. If this is True, is will also generate the vertices for arrows, which can be passed to an ArrowVisual....
[ "Place", "the", "graph", "nodes", "at", "random", "places", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py#L16-L52
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/isocurve.py
isocurve
def isocurve(data, level, connected=False, extend_to_edge=False): """ Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : ...
python
def isocurve(data, level, connected=False, extend_to_edge=False): """ Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : ...
[ "def", "isocurve", "(", "data", ",", "level", ",", "connected", "=", "False", ",", "extend_to_edge", "=", "False", ")", ":", "# This function is SLOW; plenty of room for optimization here.", "if", "extend_to_edge", ":", "d2", "=", "np", ".", "empty", "(", "(", "...
Generate isocurve from 2D data using marching squares algorithm. Parameters ---------- data : ndarray 2D numpy array of scalar values level : float The level at which to generate an isosurface connected : bool If False, return a single long list of point pairs If Tru...
[ "Generate", "isocurve", "from", "2D", "data", "using", "marching", "squares", "algorithm", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isocurve.py#L12-L175
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.pos
def pos(self): """ The position of this event in the local coordinate system of the visual. """ if self._pos is None: tr = self.visual.get_transform('canvas', 'visual') self._pos = tr.map(self.mouse_event.pos) return self._pos
python
def pos(self): """ The position of this event in the local coordinate system of the visual. """ if self._pos is None: tr = self.visual.get_transform('canvas', 'visual') self._pos = tr.map(self.mouse_event.pos) return self._pos
[ "def", "pos", "(", "self", ")", ":", "if", "self", ".", "_pos", "is", "None", ":", "tr", "=", "self", ".", "visual", ".", "get_transform", "(", "'canvas'", ",", "'visual'", ")", "self", ".", "_pos", "=", "tr", ".", "map", "(", "self", ".", "mouse...
The position of this event in the local coordinate system of the visual.
[ "The", "position", "of", "this", "event", "in", "the", "local", "coordinate", "system", "of", "the", "visual", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L29-L36
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.last_event
def last_event(self): """ The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed. """ if self.mouse_event.last_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.last_event retu...
python
def last_event(self): """ The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed. """ if self.mouse_event.last_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.last_event retu...
[ "def", "last_event", "(", "self", ")", ":", "if", "self", ".", "mouse_event", ".", "last_event", "is", "None", ":", "return", "None", "ev", "=", "self", ".", "copy", "(", ")", "ev", ".", "mouse_event", "=", "self", ".", "mouse_event", ".", "last_event"...
The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed.
[ "The", "mouse", "event", "immediately", "prior", "to", "this", "one", ".", "This", "property", "is", "None", "when", "no", "mouse", "buttons", "are", "pressed", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L39-L47
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/events.py
SceneMouseEvent.press_event
def press_event(self): """ The mouse press event that initiated a mouse drag, if any. """ if self.mouse_event.press_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.press_event return ev
python
def press_event(self): """ The mouse press event that initiated a mouse drag, if any. """ if self.mouse_event.press_event is None: return None ev = self.copy() ev.mouse_event = self.mouse_event.press_event return ev
[ "def", "press_event", "(", "self", ")", ":", "if", "self", ".", "mouse_event", ".", "press_event", "is", "None", ":", "return", "None", "ev", "=", "self", ".", "copy", "(", ")", "ev", ".", "mouse_event", "=", "self", ".", "mouse_event", ".", "press_eve...
The mouse press event that initiated a mouse drag, if any.
[ "The", "mouse", "press", "event", "that", "initiated", "a", "mouse", "drag", "if", "any", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L50-L57
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/util.py
check_enum
def check_enum(enum, name=None, valid=None): """ Get lowercase string representation of enum. """ name = name or 'enum' # Try to convert res = None if isinstance(enum, int): if hasattr(enum, 'name') and enum.name.startswith('GL_'): res = enum.name[3:].lower() elif isinsta...
python
def check_enum(enum, name=None, valid=None): """ Get lowercase string representation of enum. """ name = name or 'enum' # Try to convert res = None if isinstance(enum, int): if hasattr(enum, 'name') and enum.name.startswith('GL_'): res = enum.name[3:].lower() elif isinsta...
[ "def", "check_enum", "(", "enum", ",", "name", "=", "None", ",", "valid", "=", "None", ")", ":", "name", "=", "name", "or", "'enum'", "# Try to convert", "res", "=", "None", "if", "isinstance", "(", "enum", ",", "int", ")", ":", "if", "hasattr", "(",...
Get lowercase string representation of enum.
[ "Get", "lowercase", "string", "representation", "of", "enum", "." ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L76-L94
train
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/util.py
draw_texture
def draw_texture(tex): """Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw. """ from .program import Program program = Program(vert_draw, frag_draw) program['u_texture'] = tex program['a_position'] = [[-1., -1.],...
python
def draw_texture(tex): """Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw. """ from .program import Program program = Program(vert_draw, frag_draw) program['u_texture'] = tex program['a_position'] = [[-1., -1.],...
[ "def", "draw_texture", "(", "tex", ")", ":", "from", ".", "program", "import", "Program", "program", "=", "Program", "(", "vert_draw", ",", "frag_draw", ")", "program", "[", "'u_texture'", "]", "=", "tex", "program", "[", "'a_position'", "]", "=", "[", "...
Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw.
[ "Draw", "a", "2D", "texture", "to", "the", "current", "viewport" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L118-L131
train