partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
BaseGlooFunctions.flush
Flush GL commands This is a wrapper for glFlush(). This also flushes the GLIR command queue.
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
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): """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('...
[ "Flush", "GL", "commands", "This", "is", "a", "wrapper", "for", "glFlush", "()", ".", "This", "also", "flushes", "the", "GLIR", "command", "queue", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L547-L558
[ "def", "flush", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'flush_commands'", ")", ":", "context", "=", "self", "else", ":", "context", "=", "get_current_canvas", "(", ")", ".", "context", "context", ".", "glir", ".", "command", "(", "'...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
BaseGlooFunctions.set_hint
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').
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
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): """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", ".", ...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L560-L573
[ "def", "set_hint", "(", "self", ",", "target", ",", "mode", ")", ":", "if", "not", "all", "(", "isinstance", "(", "tm", ",", "string_types", ")", "for", "tm", "in", "(", "target", ",", "mode", ")", ")", ":", "raise", "TypeError", "(", "'target and mo...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
GlooFunctions.glir
The GLIR queue corresponding to the current canvas
glue_vispy_viewers/extern/vispy/gloo/wrappers.py
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): """ 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...
[ "The", "GLIR", "queue", "corresponding", "to", "the", "current", "canvas" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/wrappers.py#L579-L587
[ "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", "(", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
use_gl
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...
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
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'): """ 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 ...
[ "Let", "Vispy", "use", "the", "target", "OpenGL", "ES", "2", ".", "0", "implementation", "Also", "see", "vispy", ".", "use", "()", ".", "Parameters", "----------", "target", ":", "str", "The", "target", "GL", "backend", "to", "use", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L102-L150
[ "def", "use_gl", "(", "target", "=", "'gl2'", ")", ":", "target", "=", "target", "or", "'gl2'", "target", "=", "target", ".", "replace", "(", "'+'", ",", "'plus'", ")", "# Get options", "target", ",", "_", ",", "options", "=", "target", ".", "partition...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_clear_namespace
Clear names that are not part of the strict ES API
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
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(): """ 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 ...
[ "Clear", "names", "that", "are", "not", "part", "of", "the", "strict", "ES", "API" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L153-L162
[ "def", "_clear_namespace", "(", ")", ":", "ok_names", "=", "set", "(", "default_backend", ".", "__dict__", ")", "ok_names", ".", "update", "(", "[", "'gl2'", ",", "'glplus'", "]", ")", "# don't remove the module", "NS", "=", "globals", "(", ")", "for", "na...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_copy_gl_functions
Inject all objects that start with 'gl' from the source into the dest. source and dest can be dicts, modules or BaseGLProxy's.
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
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): """ 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...
[ "Inject", "all", "objects", "that", "start", "with", "gl", "from", "the", "source", "into", "the", "dest", ".", "source", "and", "dest", "can", "be", "dicts", "modules", "or", "BaseGLProxy", "s", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L165-L187
[ "def", "_copy_gl_functions", "(", "source", ",", "dest", ",", "constants", "=", "False", ")", ":", "# Get dicts", "if", "isinstance", "(", "source", ",", "BaseGLProxy", ")", ":", "s", "=", "{", "}", "for", "key", "in", "dir", "(", "source", ")", ":", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
check_error
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.
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
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'): """ 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 ...
[ "Check", "this", "from", "time", "to", "time", "to", "detect", "GL", "errors", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L190-L211
[ "def", "check_error", "(", "when", "=", "'periodic check'", ")", ":", "errors", "=", "[", "]", "while", "True", ":", "err", "=", "glGetError", "(", ")", "if", "err", "==", "GL_NO_ERROR", "or", "(", "errors", "and", "err", "==", "errors", "[", "-", "1...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
DebugProxy._arg_repr
Get a useful (and not too large) represetation of an argument.
glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py
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): """ 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...
[ "Get", "a", "useful", "(", "and", "not", "too", "large", ")", "represetation", "of", "an", "argument", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/__init__.py#L65-L75
[ "def", "_arg_repr", "(", "self", ",", "arg", ")", ":", "r", "=", "repr", "(", "arg", ")", "max", "=", "40", "if", "len", "(", "r", ")", ">", "max", ":", "if", "hasattr", "(", "arg", ",", "'shape'", ")", ":", "r", "=", "'array:'", "+", "'x'", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
IsocurveVisual.set_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``.
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
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): """ 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 ...
[ "Set", "the", "scalar", "array", "data" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L96-L127
[ "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", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
IsocurveVisual._get_verts_and_connect
retrieve vertices and connects from given paths-list
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
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): """ 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...
[ "retrieve", "vertices", "and", "connects", "from", "given", "paths", "-", "list" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L129-L136
[ "def", "_get_verts_and_connect", "(", "self", ",", "paths", ")", ":", "verts", "=", "np", ".", "vstack", "(", "paths", ")", "gaps", "=", "np", ".", "add", ".", "accumulate", "(", "np", ".", "array", "(", "[", "len", "(", "x", ")", "for", "x", "in...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
IsocurveVisual._compute_iso_line
compute LineVisual vertices, connects and color-index
glue_vispy_viewers/extern/vispy/visuals/isocurve.py
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): """ 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...
[ "compute", "LineVisual", "vertices", "connects", "and", "color", "-", "index" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/isocurve.py#L138-L175
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EventEmitter.connect
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...
glue_vispy_viewers/extern/vispy/util/event.py
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): """Connect this emitter to a new callback. Parameters ---------- callback : function | tuple *callback* may be either a callable object or a tuple (object, attr_nam...
[ "Connect", "this", "emitter", "to", "a", "new", "callback", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L266-L373
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "callbacks", "=", "self", ".", "callbacks", "callback_refs", "=", "self", ".", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EventEmitter.disconnect
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.
glue_vispy_viewers/extern/vispy/util/event.py
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): """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 = [] ...
[ "Disconnect", "a", "callback", "from", "this", "emitter", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L375-L389
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "is", "None", ":", "self", ".", "_callbacks", "=", "[", "]", "self", ".", "_callback_refs", "=", "[", "]", "else", ":", "callback", "=", "self", ".", "_normal...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EventEmitter.block
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.
glue_vispy_viewers/extern/vispy/util/event.py
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): """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 ...
[ "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...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L500-L508
[ "def", "block", "(", "self", ",", "callback", "=", "None", ")", ":", "self", ".", "_blocked", "[", "callback", "]", "=", "self", ".", "_blocked", ".", "get", "(", "callback", ",", "0", ")", "+", "1" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EventEmitter.unblock
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)``.
glue_vispy_viewers/extern/vispy/util/event.py
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): """ 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...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L510-L525
[ "def", "unblock", "(", "self", ",", "callback", "=", "None", ")", ":", "if", "callback", "not", "in", "self", ".", "_blocked", "or", "self", ".", "_blocked", "[", "callback", "]", "==", "0", ":", "raise", "RuntimeError", "(", "\"Cannot unblock %s for callb...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EmitterGroup.add
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...
glue_vispy_viewers/extern/vispy/util/event.py
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): """ 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...
[ "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", ...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L633-L690
[ "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"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EmitterGroup.block_all
Block all emitters in this group.
glue_vispy_viewers/extern/vispy/util/event.py
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
def block_all(self): """ Block all emitters in this group. """ self.block() for em in self._emitters.values(): em.block()
[ "Block", "all", "emitters", "in", "this", "group", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L705-L710
[ "def", "block_all", "(", "self", ")", ":", "self", ".", "block", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "block", "(", ")" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EmitterGroup.unblock_all
Unblock all emitters in this group.
glue_vispy_viewers/extern/vispy/util/event.py
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
def unblock_all(self): """ Unblock all emitters in this group. """ self.unblock() for em in self._emitters.values(): em.unblock()
[ "Unblock", "all", "emitters", "in", "this", "group", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L712-L717
[ "def", "unblock_all", "(", "self", ")", ":", "self", ".", "unblock", "(", ")", "for", "em", "in", "self", ".", "_emitters", ".", "values", "(", ")", ":", "em", ".", "unblock", "(", ")" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EmitterGroup.connect
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.
glue_vispy_viewers/extern/vispy/util/event.py
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): """ 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>` ...
[ "Connect", "the", "callback", "to", "the", "event", "group", ".", "The", "callback", "will", "receive", "events", "from", "*", "all", "*", "of", "the", "emitters", "in", "the", "group", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L719-L729
[ "def", "connect", "(", "self", ",", "callback", ",", "ref", "=", "False", ",", "position", "=", "'first'", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "self", ".", "_connect_emitters", "(", "True", ")", "return", "EventEmitter", "....
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
EmitterGroup.disconnect
Disconnect the callback from this group. See :func:`connect() <vispy.event.EmitterGroup.connect>` and :func:`EventEmitter.connect() <vispy.event.EventEmitter.connect>` for more information.
glue_vispy_viewers/extern/vispy/util/event.py
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): """ 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...
[ "Disconnect", "the", "callback", "from", "this", "group", ".", "See", ":", "func", ":", "connect", "()", "<vispy", ".", "event", ".", "EmitterGroup", ".", "connect", ">", "and", ":", "func", ":", "EventEmitter", ".", "connect", "()", "<vispy", ".", "even...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/event.py#L731-L740
[ "def", "disconnect", "(", "self", ",", "callback", "=", "None", ")", ":", "ret", "=", "EventEmitter", ".", "disconnect", "(", "self", ",", "callback", ")", "if", "len", "(", "self", ".", "_callbacks", ")", "==", "0", ":", "self", ".", "_connect_emitter...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
validate_input_format
TODO add handling for bad input
ask/write_sample.py
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): """ 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)): ...
[ "TODO", "add", "handling", "for", "bad", "input" ]
anjishnu/ask-alexa-pykit
python
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/write_sample.py#L25-L47
[ "def", "validate_input_format", "(", "utterance", ",", "intent", ")", ":", "slots", "=", "{", "slot", "[", "\"name\"", "]", "for", "slot", "in", "intent", "[", "\"slots\"", "]", "}", "split_utt", "=", "re", ".", "split", "(", "\"{(.*)}\"", ",", "utteranc...
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
train
isosurface
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...
glue_vispy_viewers/extern/vispy/geometry/isosurface.py
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): """ 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...
[ "Generate", "isosurface", "from", "volumetric", "data", "using", "marching", "cubes", "algorithm", ".", "See", "Paul", "Bourke", "Polygonising", "a", "Scalar", "Field", "(", "http", ":", "//", "paulbourke", ".", "net", "/", "geometry", "/", "polygonise", "/", ...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isosurface.py#L6-L135
[ "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)...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_extract_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.
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
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): """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...
[ "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...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L19-L35
[ "def", "_extract_buffers", "(", "commands", ")", ":", "# First, filter all DATA commands.", "data_commands", "=", "[", "command", "for", "command", "in", "commands", "if", "command", "[", "0", "]", "==", "'DATA'", "]", "# Extract the arrays.", "buffers", "=", "[",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_serialize_item
Internal function: serialize native types.
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
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): """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)) ...
[ "Internal", "function", ":", "serialize", "native", "types", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L38-L64
[ "def", "_serialize_item", "(", "item", ")", ":", "# Recursively serialize lists, tuples, and dicts.", "if", "isinstance", "(", "item", ",", "(", "list", ",", "tuple", ")", ")", ":", "return", "[", "_serialize_item", "(", "subitem", ")", "for", "subitem", "in", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_glir_message
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: ...
glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py
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): """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...
[ "Create", "a", "JSON", "-", "serializable", "message", "of", "GLIR", "commands", ".", "NumPy", "arrays", "are", "serialized", "according", "to", "the", "specified", "method", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_ipynb_util.py#L73-L104
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
Server.start_session
Start Session
mpdlcd/vendor/lcdproc/server.py
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): """ 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...
[ "Start", "Session" ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L53-L66
[ "def", "start_session", "(", "self", ")", ":", "response", "=", "self", ".", "request", "(", "\"hello\"", ")", "bits", "=", "response", ".", "split", "(", "\" \"", ")", "self", ".", "server_info", ".", "update", "(", "{", "\"server_version\"", ":", "bits...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
Server.request
Request
mpdlcd/vendor/lcdproc/server.py
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): """ 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...
[ "Request" ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L90-L108
[ "def", "request", "(", "self", ",", "command_string", ")", ":", "self", ".", "send", "(", "command_string", ")", "if", "self", ".", "debug", ":", "print", "(", "\"Telnet Request: %s\"", "%", "(", "command_string", ")", ")", "while", "True", ":", "response...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
Server.add_screen
Add Screen
mpdlcd/vendor/lcdproc/server.py
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): """ 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]
[ "Add", "Screen" ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L126-L134
[ "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....
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
Server.add_key
Add a key. (ref) Return key name or None on error
mpdlcd/vendor/lcdproc/server.py
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"): """ 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 ...
[ "Add", "a", "key", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L141-L153
[ "def", "add_key", "(", "self", ",", "ref", ",", "mode", "=", "\"shared\"", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_add_key %s -%s\"", "%", "(", "ref", ",", "mode", ")", ")"...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
Server.del_key
Delete a key. (ref) Return None or LCDd response on error
mpdlcd/vendor/lcdproc/server.py
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): """ 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...
[ "Delete", "a", "key", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/vendor/lcdproc/server.py#L155-L168
[ "def", "del_key", "(", "self", ",", "ref", ")", ":", "if", "ref", "not", "in", "self", ".", "keys", ":", "response", "=", "self", ".", "request", "(", "\"client_del_key %s\"", "%", "(", "ref", ")", ")", "self", ".", "keys", ".", "remove", "(", "ref...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
LowLevelAPI.launch
launch browser and virtual display, first of all to be launched
tradingAPI/low_level.py
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): """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...
[ "launch", "browser", "and", "virtual", "display", "first", "of", "all", "to", "be", "launched" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L73-L88
[ "def", "launch", "(", "self", ")", ":", "try", ":", "# init virtual Display", "self", ".", "vbro", "=", "Display", "(", ")", "self", ".", "vbro", ".", "start", "(", ")", "logger", ".", "debug", "(", "\"virtual display launched\"", ")", "except", "Exception...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.css
css find function abbreviation
tradingAPI/low_level.py
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): """css find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_css, args=[css_path])
[ "css", "find", "function", "abbreviation" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L90-L94
[ "def", "css", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_css", ",", "args", "=", "[", "css_path", "]", ")" ]
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.css1
return the first value of self.css
tradingAPI/low_level.py
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): """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])
[ "return", "the", "first", "value", "of", "self", ".", "css" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L96-L105
[ "def", "css1", "(", "self", ",", "css_path", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "def", "_css1", "(", "path", ",", "domm", ")", ":", "\"\"\"virtual local func\"\"\"", "return", "self", ...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.search_name
name find function abbreviation
tradingAPI/low_level.py
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): """name find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_name, args=[name])
[ "name", "find", "function", "abbreviation" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L107-L111
[ "def", "search_name", "(", "self", ",", "name", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_name", ",", "args", "=", "[", "name", "]", ")" ]
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.xpath
xpath find function abbreviation
tradingAPI/low_level.py
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): """xpath find function abbreviation""" if dom is None: dom = self.browser return expect(dom.find_by_xpath, args=[xpath])
[ "xpath", "find", "function", "abbreviation" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L113-L117
[ "def", "xpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "find_by_xpath", ",", "args", "=", "[", "xpath", "]", ")" ]
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.elCss
check if element is present by css
tradingAPI/low_level.py
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): """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])
[ "check", "if", "element", "is", "present", "by", "css" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L119-L123
[ "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", ...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.elXpath
check if element is present by css
tradingAPI/low_level.py
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): """check if element is present by css""" if dom is None: dom = self.browser return expect(dom.is_element_present_by_xpath, args=[xpath])
[ "check", "if", "element", "is", "present", "by", "css" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L125-L129
[ "def", "elXpath", "(", "self", ",", "xpath", ",", "dom", "=", "None", ")", ":", "if", "dom", "is", "None", ":", "dom", "=", "self", ".", "browser", "return", "expect", "(", "dom", ".", "is_element_present_by_xpath", ",", "args", "=", "[", "xpath", "]...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.login
login function
tradingAPI/low_level.py
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"): """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...
[ "login", "function" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L131-L166
[ "def", "login", "(", "self", ",", "username", ",", "password", ",", "mode", "=", "\"demo\"", ")", ":", "url", "=", "\"https://trading212.com/it/login\"", "try", ":", "logger", ".", "debug", "(", "f\"visiting %s\"", "%", "url", ")", "self", ".", "browser", ...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.logout
logout func (quit browser)
tradingAPI/low_level.py
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): """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
[ "logout", "func", "(", "quit", "browser", ")" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L168-L177
[ "def", "logout", "(", "self", ")", ":", "try", ":", "self", ".", "browser", ".", "quit", "(", ")", "except", "Exception", ":", "raise", "exceptions", ".", "BrowserException", "(", "self", ".", "brow_name", ",", "\"not started\"", ")", "return", "False", ...
0fab20b71a2348e72bbe76071b81f3692128851f
train
LowLevelAPI.new_pos
factory method pattern
tradingAPI/low_level.py
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): """factory method pattern""" pos = self.Position(self, html_div) pos.bind_mov() self.positions.append(pos) return pos
[ "factory", "method", "pattern" ]
federico123579/Trading212-API
python
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/low_level.py#L526-L531
[ "def", "new_pos", "(", "self", ",", "html_div", ")", ":", "pos", "=", "self", ".", "Position", "(", "self", ",", "html_div", ")", "pos", ".", "bind_mov", "(", ")", "self", ".", "positions", ".", "append", "(", "pos", ")", "return", "pos" ]
0fab20b71a2348e72bbe76071b81f3692128851f
train
_make_hostport
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...
mpdlcd/cli.py
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): """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...
[ "Convert", "a", "[", "user", "[", ":", "pass", "]", "@", "]", "host", ":", "port", "string", "to", "a", "Connection", "tuple", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L106-L126
[ "def", "_make_hostport", "(", "conn", ",", "default_host", ",", "default_port", ",", "default_user", "=", "''", ",", "default_password", "=", "None", ")", ":", "parsed", "=", "urllib", ".", "parse", ".", "urlparse", "(", "'//%s'", "%", "conn", ")", "return...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
_make_lcdproc
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...
mpdlcd/cli.py
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): """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...
[ "Create", "and", "connect", "to", "the", "LCDd", "server", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L129-L161
[ "def", "_make_lcdproc", "(", "lcd_host", ",", "lcd_port", ",", "retry_config", ",", "charset", "=", "DEFAULT_LCDPROC_CHARSET", ",", "lcdd_debug", "=", "False", ")", ":", "class", "ServerSpawner", "(", "utils", ".", "AutoRetryCandidate", ")", ":", "\"\"\"Spawn the ...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
_make_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.
mpdlcd/cli.py
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): """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...
[ "Create", "a", "ScreenPatternList", "from", "a", "given", "pattern", "text", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L164-L181
[ "def", "_make_patterns", "(", "patterns", ")", ":", "field_registry", "=", "display_fields", ".", "FieldRegistry", "(", ")", "pattern_list", "=", "display_pattern", ".", "ScreenPatternList", "(", "field_registry", "=", "field_registry", ",", ")", "for", "pattern", ...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
run_forever
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...
mpdlcd/cli.py
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=[], refresh=DEFAULT_REFRESH, backlight_on=DEFAULT_BACKLIGHT_ON, priority_playing=DEFAULT_PRIORITY, ...
[ "Run", "the", "server", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L184-L266
[ "def", "run_forever", "(", "lcdproc", "=", "''", ",", "mpd", "=", "''", ",", "lcdproc_screen", "=", "DEFAULT_LCD_SCREEN_NAME", ",", "lcdproc_charset", "=", "DEFAULT_LCDPROC_CHARSET", ",", "lcdd_debug", "=", "False", ",", "pattern", "=", "''", ",", "patterns", ...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
_read_config
Read configuration from the given file. Parsing is performed through the configparser library. Returns: dict: a flattened dict of (option_name, value), using defaults.
mpdlcd/cli.py
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): """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): ...
[ "Read", "configuration", "from", "the", "given", "file", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L438-L478
[ "def", "_read_config", "(", "filename", ")", ":", "parser", "=", "configparser", ".", "RawConfigParser", "(", ")", "if", "filename", "and", "not", "parser", ".", "read", "(", "filename", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"Unable to open ...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
_extract_options
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...
mpdlcd/cli.py
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 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 ...
[ "Extract", "options", "values", "from", "a", "configparser", "optparse", "pair", "." ]
rbarrois/mpdlcd
python
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/cli.py#L481-L502
[ "def", "_extract_options", "(", "config", ",", "options", ",", "*", "args", ")", ":", "extract", "=", "{", "}", "for", "key", "in", "args", ":", "if", "key", "not", "in", "args", ":", "continue", "extract", "[", "key", "]", "=", "config", "[", "key...
85f16c8cc0883f8abb4c2cc7f69729c3e2f857da
train
RenderBuffer.resize
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. ...
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
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): """ 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...
[ "Set", "the", "render", "-", "buffer", "size", "and", "format" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L52-L90
[ "def", "resize", "(", "self", ",", "shape", ",", "format", "=", "None", ")", ":", "if", "not", "self", ".", "_resizeable", ":", "raise", "RuntimeError", "(", "\"RenderBuffer is not resizeable\"", ")", "# Check shape", "if", "not", "(", "isinstance", "(", "sh...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
FrameBuffer.activate
Activate/use this frame buffer.
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
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): """ 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)
[ "Activate", "/", "use", "this", "frame", "buffer", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L123-L131
[ "def", "activate", "(", "self", ")", ":", "# Send command", "self", ".", "_glir", ".", "command", "(", "'FRAMEBUFFER'", ",", "self", ".", "_id", ",", "True", ")", "# Associate canvas now", "canvas", "=", "get_current_canvas", "(", ")", "if", "canvas", "is", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
FrameBuffer.shape
The shape of the Texture/RenderBuffer attached to this FrameBuffer
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
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): """ 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...
[ "The", "shape", "of", "the", "Texture", "/", "RenderBuffer", "attached", "to", "this", "FrameBuffer" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L196-L205
[ "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"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
FrameBuffer.resize
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.
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
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): """ 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...
[ "Resize", "all", "attached", "buffers", "with", "the", "given", "shape" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L207-L227
[ "def", "resize", "(", "self", ",", "shape", ")", ":", "# Check", "if", "not", "(", "isinstance", "(", "shape", ",", "tuple", ")", "and", "len", "(", "shape", ")", "==", "2", ")", ":", "raise", "ValueError", "(", "'RenderBuffer shape must be a 2-element tup...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
FrameBuffer.read
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 ------- ...
glue_vispy_viewers/extern/vispy/gloo/framebuffer.py
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): """ 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, ...
[ "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...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/framebuffer.py#L229-L254
[ "def", "read", "(", "self", ",", "mode", "=", "'color'", ",", "alpha", "=", "True", ")", ":", "_check_valid", "(", "'mode'", ",", "mode", ",", "[", "'color'", ",", "'depth'", ",", "'stencil'", "]", ")", "buffer", "=", "getattr", "(", "self", ",", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
LineVisual.set_data
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...
glue_vispy_viewers/extern/vispy/visuals/line/line.py
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): """ 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...
[ "Set", "the", "data", "used", "to", "draw", "this", "visual", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L150-L190
[ "def", "set_data", "(", "self", ",", "pos", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "connect", "=", "None", ")", ":", "if", "pos", "is", "not", "None", ":", "self", ".", "_bounds", "=", "None", "self", ".", "_pos",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
LineVisual._compute_bounds
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.
glue_vispy_viewers/extern/vispy/visuals/line/line.py
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): """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 ...
[ "Get", "the", "bounds" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L240-L264
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_AggLineVisual._agg_bake
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).
glue_vispy_viewers/extern/vispy/visuals/line/line.py
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): """ 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) ...
[ "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...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line/line.py#L469-L547
[ "def", "_agg_bake", "(", "cls", ",", "vertices", ",", "color", ",", "closed", "=", "False", ")", ":", "n", "=", "len", "(", "vertices", ")", "P", "=", "np", ".", "array", "(", "vertices", ")", ".", "reshape", "(", "n", ",", "2", ")", ".", "asty...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_get_k_p_a
This actually calculates the kerning + advance
glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py
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): """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...
[ "This", "actually", "calculates", "the", "kerning", "+", "advance" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_quartz.py#L164-L184
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
GridMeshVisual.set_data
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...
glue_vispy_viewers/extern/vispy/visuals/gridmesh.py
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): '''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...
[ "Update", "the", "mesh", "data", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/gridmesh.py#L55-L99
[ "def", "set_data", "(", "self", ",", "xs", "=", "None", ",", "ys", "=", "None", ",", "zs", "=", "None", ",", "colors", "=", "None", ")", ":", "if", "xs", "is", "None", ":", "xs", "=", "self", ".", "_xs", "self", ".", "__vertices", "=", "None", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_make_png
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: ...
glue_vispy_viewers/extern/vispy/io/image.py
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): """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...
[ "Convert", "numpy", "array", "to", "PNG", "byte", "array", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L17-L98
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
read_png
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
glue_vispy_viewers/extern/vispy/io/image.py
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): """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" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L101-L133
[ "def", "read_png", "(", "filename", ")", ":", "x", "=", "Reader", "(", "filename", ")", "try", ":", "alpha", "=", "x", ".", "asDirect", "(", ")", "[", "3", "]", "[", "'alpha'", "]", "if", "alpha", ":", "y", "=", "x", ".", "asRGBA8", "(", ")", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
write_png
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
glue_vispy_viewers/extern/vispy/io/image.py
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): """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) ...
[ "Write", "a", "PNG", "file" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L136-L156
[ "def", "write_png", "(", "filename", ",", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "if", "not", "data", ".", "ndim", "==", "3", "and", "data", ".", "shape", "[", "-", "1", "]", "in", "(", "3", ",", "4", ")", ":",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
imread
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 --------...
glue_vispy_viewers/extern/vispy/io/image.py
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): """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 ...
[ "Read", "image", "data", "from", "disk" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L159-L194
[ "def", "imread", "(", "filename", ",", "format", "=", "None", ")", ":", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imread", "(", "filename", ",", "format", ")", "elif", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
imsave
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...
glue_vispy_viewers/extern/vispy/io/image.py
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): """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...
[ "Save", "image", "data", "to", "disk" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L197-L223
[ "def", "imsave", "(", "filename", ",", "im", ",", "format", "=", "None", ")", ":", "# Import imageio or PIL", "imageio", ",", "PIL", "=", "_check_img_lib", "(", ")", "if", "imageio", "is", "not", "None", ":", "return", "imageio", ".", "imsave", "(", "fil...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_check_img_lib
Utility to search for imageio or PIL
glue_vispy_viewers/extern/vispy/io/image.py
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(): """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
[ "Utility", "to", "search", "for", "imageio", "or", "PIL" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/io/image.py#L226-L237
[ "def", "_check_img_lib", "(", ")", ":", "# Import imageio or PIL", "imageio", "=", "PIL", "=", "None", "try", ":", "import", "imageio", "except", "ImportError", ":", "try", ":", "import", "PIL", ".", "Image", "except", "ImportError", ":", "pass", "return", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
read_from_user
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.
ask/config/config.py
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): ''' 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...
[ "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", "."...
anjishnu/ask-alexa-pykit
python
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L18-L33
[ "def", "read_from_user", "(", "input_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "_read_in", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "try", ":", "tmp", "=", "raw_input", "(", "*", "args", ...
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
train
load_builtin_slots
Helper function to load builtin slots from the data location
ask/config/config.py
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(): ''' 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...
[ "Helper", "function", "to", "load", "builtin", "slots", "from", "the", "data", "location" ]
anjishnu/ask-alexa-pykit
python
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/config/config.py#L38-L47
[ "def", "load_builtin_slots", "(", ")", ":", "builtin_slots", "=", "{", "}", "for", "index", ",", "line", "in", "enumerate", "(", "open", "(", "BUILTIN_SLOTS_LOCATION", ")", ")", ":", "o", "=", "line", ".", "strip", "(", ")", ".", "split", "(", "'\\t'",...
a47c278ca7a60532bbe1a9b789f6c37e609fea8b
train
timer
Function decorator displaying the function execution time All kwargs are the arguments taken by the Timer class constructor.
contexttimer/__init__.py
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): """ 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" ]
brouberol/contexttimer
python
https://github.com/brouberol/contexttimer/blob/a866f420ed4c10f29abf252c58b11f9db6706100/contexttimer/__init__.py#L108-L141
[ "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...
a866f420ed4c10f29abf252c58b11f9db6706100
train
RawTriangleCollection.append
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...
glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py
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): """ 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...
[ "Append", "a", "new", "set", "of", "vertices", "to", "the", "collection", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/raw_triangle_collection.py#L40-L81
[ "def", "append", "(", "self", ",", "points", ",", "indices", ",", "*", "*", "kwargs", ")", ":", "itemsize", "=", "len", "(", "points", ")", "itemcount", "=", "1", "V", "=", "np", ".", "empty", "(", "itemcount", "*", "itemsize", ",", "dtype", "=", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_mpl_to_vispy
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...
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
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): """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...
[ "Convert", "a", "given", "matplotlib", "figure", "to", "vispy" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L155-L176
[ "def", "_mpl_to_vispy", "(", "fig", ")", ":", "renderer", "=", "VispyRenderer", "(", ")", "exporter", "=", "Exporter", "(", "renderer", ")", "with", "warnings", ".", "catch_warnings", "(", "record", "=", "True", ")", ":", "# py3k mpl warning", "exporter", "....
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
show
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.
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
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): """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...
[ "Show", "current", "figures", "using", "vispy" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L179-L198
[ "def", "show", "(", "block", "=", "False", ")", ":", "if", "not", "has_matplotlib", "(", ")", ":", "raise", "ImportError", "(", "'Requires matplotlib version >= 1.2'", ")", "cs", "=", "[", "_mpl_to_vispy", "(", "plt", ".", "figure", "(", "ii", ")", ")", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
VispyRenderer._mpl_ax_to
Helper to get the parent axes of a given mplobj
glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py
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'): """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!')
[ "Helper", "to", "get", "the", "parent", "axes", "of", "a", "given", "mplobj" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/mpl_plot/_mpl_to_vispy.py#L138-L143
[ "def", "_mpl_ax_to", "(", "self", ",", "mplobj", ",", "output", "=", "'vb'", ")", ":", "for", "ax", "in", "self", ".", "_axs", ".", "values", "(", ")", ":", "if", "ax", "[", "'ax'", "]", "is", "mplobj", ".", "axes", ":", "return", "ax", "[", "o...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
random
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....
glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py
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): """ 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...
[ "Place", "the", "graph", "nodes", "at", "random", "places", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/random.py#L16-L52
[ "def", "random", "(", "adjacency_mat", ",", "directed", "=", "False", ",", "random_state", "=", "None", ")", ":", "if", "random_state", "is", "None", ":", "random_state", "=", "np", ".", "random", "elif", "not", "isinstance", "(", "random_state", ",", "np"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
isocurve
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...
glue_vispy_viewers/extern/vispy/geometry/isocurve.py
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): """ 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 : ...
[ "Generate", "isocurve", "from", "2D", "data", "using", "marching", "squares", "algorithm", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/isocurve.py#L12-L175
[ "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", "(", "(", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
SceneMouseEvent.pos
The position of this event in the local coordinate system of the visual.
glue_vispy_viewers/extern/vispy/scene/events.py
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): """ 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
[ "The", "position", "of", "this", "event", "in", "the", "local", "coordinate", "system", "of", "the", "visual", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L29-L36
[ "def", "pos", "(", "self", ")", ":", "if", "self", ".", "_pos", "is", "None", ":", "tr", "=", "self", ".", "visual", ".", "get_transform", "(", "'canvas'", ",", "'visual'", ")", "self", ".", "_pos", "=", "tr", ".", "map", "(", "self", ".", "mouse...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
SceneMouseEvent.last_event
The mouse event immediately prior to this one. This property is None when no mouse buttons are pressed.
glue_vispy_viewers/extern/vispy/scene/events.py
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): """ 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...
[ "The", "mouse", "event", "immediately", "prior", "to", "this", "one", ".", "This", "property", "is", "None", "when", "no", "mouse", "buttons", "are", "pressed", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L39-L47
[ "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"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
SceneMouseEvent.press_event
The mouse press event that initiated a mouse drag, if any.
glue_vispy_viewers/extern/vispy/scene/events.py
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): """ 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
[ "The", "mouse", "press", "event", "that", "initiated", "a", "mouse", "drag", "if", "any", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/events.py#L50-L57
[ "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...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
check_enum
Get lowercase string representation of enum.
glue_vispy_viewers/extern/vispy/gloo/util.py
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): """ 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...
[ "Get", "lowercase", "string", "representation", "of", "enum", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L76-L94
[ "def", "check_enum", "(", "enum", ",", "name", "=", "None", ",", "valid", "=", "None", ")", ":", "name", "=", "name", "or", "'enum'", "# Try to convert", "res", "=", "None", "if", "isinstance", "(", "enum", ",", "int", ")", ":", "if", "hasattr", "(",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
draw_texture
Draw a 2D texture to the current viewport Parameters ---------- tex : instance of Texture2D The texture to draw.
glue_vispy_viewers/extern/vispy/gloo/util.py
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): """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.],...
[ "Draw", "a", "2D", "texture", "to", "the", "current", "viewport" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/util.py#L118-L131
[ "def", "draw_texture", "(", "tex", ")", ":", "from", ".", "program", "import", "Program", "program", "=", "Program", "(", "vert_draw", ",", "frag_draw", ")", "program", "[", "'u_texture'", "]", "=", "tex", "program", "[", "'a_position'", "]", "=", "[", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_get_dpi_from
Match pattern against the output of func, passing the results as floats to func. If anything fails, return None.
glue_vispy_viewers/extern/vispy/util/dpi/_linux.py
def _get_dpi_from(cmd, pattern, func): """Match pattern against the output of func, passing the results as floats to func. If anything fails, return None. """ try: out, _ = run_subprocess([cmd]) except (OSError, CalledProcessError): pass else: match = re.search(pattern, ...
def _get_dpi_from(cmd, pattern, func): """Match pattern against the output of func, passing the results as floats to func. If anything fails, return None. """ try: out, _ = run_subprocess([cmd]) except (OSError, CalledProcessError): pass else: match = re.search(pattern, ...
[ "Match", "pattern", "against", "the", "output", "of", "func", "passing", "the", "results", "as", "floats", "to", "func", ".", "If", "anything", "fails", "return", "None", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/dpi/_linux.py#L15-L26
[ "def", "_get_dpi_from", "(", "cmd", ",", "pattern", ",", "func", ")", ":", "try", ":", "out", ",", "_", "=", "run_subprocess", "(", "[", "cmd", "]", ")", "except", "(", "OSError", ",", "CalledProcessError", ")", ":", "pass", "else", ":", "match", "="...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
get_dpi
Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen.
glue_vispy_viewers/extern/vispy/util/dpi/_linux.py
def get_dpi(raise_error=True): """Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen. """ # If we are running without an X server...
def get_dpi(raise_error=True): """Get screen DPI from the OS Parameters ---------- raise_error : bool If True, raise an error if DPI could not be determined. Returns ------- dpi : float Dots per inch of the primary screen. """ # If we are running without an X server...
[ "Get", "screen", "DPI", "from", "the", "OS" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/dpi/_linux.py#L29-L61
[ "def", "get_dpi", "(", "raise_error", "=", "True", ")", ":", "# If we are running without an X server (e.g. OSMesa), use a fixed DPI", "if", "'DISPLAY'", "not", "in", "os", ".", "environ", ":", "return", "96.", "from_xdpyinfo", "=", "_get_dpi_from", "(", "'xdpyinfo'", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
GraphVisual.set_data
Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows.
glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py
def set_data(self, adjacency_mat=None, **kwargs): """Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows. """ if adjacency_mat is not None: ...
def set_data(self, adjacency_mat=None, **kwargs): """Set the data Parameters ---------- adjacency_mat : ndarray | None The adjacency matrix. **kwargs : dict Keyword arguments to pass to the arrows. """ if adjacency_mat is not None: ...
[ "Set", "the", "data" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/graph.py#L177-L226
[ "def", "set_data", "(", "self", ",", "adjacency_mat", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "adjacency_mat", "is", "not", "None", ":", "if", "adjacency_mat", ".", "shape", "[", "0", "]", "!=", "adjacency_mat", ".", "shape", "[", "1", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
ColorBarWidget.calc_size
Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top".
glue_vispy_viewers/extern/vispy/scene/widgets/colorbar.py
def calc_size(rect, orientation): """Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top". """ (total_halfx, total_halfy) = rect.center if orientation in ["bottom", "top"...
def calc_size(rect, orientation): """Calculate a size Parameters ---------- rect : rectangle The rectangle. orientation : str Either "bottom" or "top". """ (total_halfx, total_halfy) = rect.center if orientation in ["bottom", "top"...
[ "Calculate", "a", "size" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/colorbar.py#L101-L126
[ "def", "calc_size", "(", "rect", ",", "orientation", ")", ":", "(", "total_halfx", ",", "total_halfy", ")", "=", "rect", ".", "center", "if", "orientation", "in", "[", "\"bottom\"", ",", "\"top\"", "]", ":", "(", "total_major_axis", ",", "total_minor_axis", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
dtype_reduce
Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'), ('a', 'f4')])] level ...
glue_vispy_viewers/extern/vispy/visuals/collections/util.py
def dtype_reduce(dtype, level=0, depth=0): """ Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'),...
def dtype_reduce(dtype, level=0, depth=0): """ Try to reduce dtype up to a given level when it is possible dtype = [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('normal', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]), ('color', [('r', 'f4'), ('g', 'f4'), ('b', 'f4'),...
[ "Try", "to", "reduce", "dtype", "up", "to", "a", "given", "level", "when", "it", "is", "possible" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/util.py#L13-L72
[ "def", "dtype_reduce", "(", "dtype", ",", "level", "=", "0", ",", "depth", "=", "0", ")", ":", "dtype", "=", "np", ".", "dtype", "(", "dtype", ")", "fields", "=", "dtype", ".", "fields", "# No fields", "if", "fields", "is", "None", ":", "if", "len"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
fetchcode
Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched. collection_index: float Attribu...
glue_vispy_viewers/extern/vispy/visuals/collections/util.py
def fetchcode(utype, prefix=""): """ Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched....
def fetchcode(utype, prefix=""): """ Generate the GLSL code needed to retrieve fake uniform values from a texture. uniforms : sampler2D Texture to fetch uniforms from uniforms_shape: vec3 Size of texture (width,height,count) where count is the number of float to be fetched....
[ "Generate", "the", "GLSL", "code", "needed", "to", "retrieve", "fake", "uniform", "values", "from", "a", "texture", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/util.py#L75-L163
[ "def", "fetchcode", "(", "utype", ",", "prefix", "=", "\"\"", ")", ":", "utype", "=", "np", ".", "dtype", "(", "utype", ")", "_utype", "=", "dtype_reduce", "(", "utype", ",", "level", "=", "1", ")", "header", "=", "\"\"\"\nuniform sampler2D uniforms;\nun...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_cube
Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an outline of the cube.
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_cube(): """ Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an o...
def create_cube(): """ Generate vertices & indices for a filled and outlined cube Returns ------- vertices : array Array of vertices suitable for use as a VertexBuffer. filled : array Indices to use to produce a filled cube. outline : array Indices to use to produce an o...
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "cube" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L16-L89
[ "def", "create_cube", "(", ")", ":", "vtype", "=", "[", "(", "'position'", ",", "np", ".", "float32", ",", "3", ")", ",", "(", "'texcoord'", ",", "np", ".", "float32", ",", "2", ")", ",", "(", "'normal'", ",", "np", ".", "float32", ",", "3", ")...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_plane
Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int Plane segments count along the width. height_segments : float Plane segments count along the height. ...
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_plane(width=1, height=1, width_segments=1, height_segments=1, direction='+z'): """ Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int ...
def create_plane(width=1, height=1, width_segments=1, height_segments=1, direction='+z'): """ Generate vertices & indices for a filled and outlined plane. Parameters ---------- width : float Plane width. height : float Plane height. width_segments : int ...
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "plane", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L92-L198
[ "def", "create_plane", "(", "width", "=", "1", ",", "height", "=", "1", ",", "width_segments", "=", "1", ",", "height_segments", "=", "1", ",", "direction", "=", "'+z'", ")", ":", "x_grid", "=", "width_segments", "y_grid", "=", "height_segments", "x_grid1"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_box
Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float Box depth. width_segments : int Box segments count along the width. height_segments : float Box segments...
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_box(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1, planes=None): """ Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float ...
def create_box(width=1, height=1, depth=1, width_segments=1, height_segments=1, depth_segments=1, planes=None): """ Generate vertices & indices for a filled and outlined box. Parameters ---------- width : float Box width. height : float Box height. depth : float ...
[ "Generate", "vertices", "&", "indices", "for", "a", "filled", "and", "outlined", "box", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L201-L297
[ "def", "create_box", "(", "width", "=", "1", ",", "height", "=", "1", ",", "depth", "=", "1", ",", "width_segments", "=", "1", ",", "height_segments", "=", "1", ",", "depth_segments", "=", "1", ",", "planes", "=", "None", ")", ":", "planes", "=", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_sphere
Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and 'cube'). depth : int Number of depth segments (for method='cube'). radius : float Sphere radius. offset...
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_sphere(rows=10, cols=10, depth=10, radius=1.0, offset=True, subdivisions=3, method='latitude'): """Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and...
def create_sphere(rows=10, cols=10, depth=10, radius=1.0, offset=True, subdivisions=3, method='latitude'): """Create a sphere Parameters ---------- rows : int Number of rows (for method='latitude' and 'cube'). cols : int Number of columns (for method='latitude' and...
[ "Create", "a", "sphere" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L415-L450
[ "def", "create_sphere", "(", "rows", "=", "10", ",", "cols", "=", "10", ",", "depth", "=", "10", ",", "radius", "=", "1.0", ",", "offset", "=", "True", ",", "subdivisions", "=", "3", ",", "method", "=", "'latitude'", ")", ":", "if", "method", "==",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_cylinder
Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. offset : bool Rotate each row by half a column. Returns ------- ...
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False): """Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. ...
def create_cylinder(rows, cols, radius=[1.0, 1.0], length=1.0, offset=False): """Create a cylinder Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : tuple of float Cylinder radii. length : float Length of the cylinder. ...
[ "Create", "a", "cylinder" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L453-L504
[ "def", "create_cylinder", "(", "rows", ",", "cols", ",", "radius", "=", "[", "1.0", ",", "1.0", "]", ",", "length", "=", "1.0", ",", "offset", "=", "False", ")", ":", "verts", "=", "np", ".", "empty", "(", "(", "rows", "+", "1", ",", "cols", ",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_cone
Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a cone surface.
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_cone(cols, radius=1.0, length=1.0): """Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a co...
def create_cone(cols, radius=1.0, length=1.0): """Create a cone Parameters ---------- cols : int Number of faces. radius : float Base cone radius. length : float Length of the cone. Returns ------- cone : MeshData Vertices and faces computed for a co...
[ "Create", "a", "cone" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L507-L543
[ "def", "create_cone", "(", "cols", ",", "radius", "=", "1.0", ",", "length", "=", "1.0", ")", ":", "verts", "=", "np", ".", "empty", "(", "(", "cols", "+", "1", ",", "3", ")", ",", "dtype", "=", "np", ".", "float32", ")", "# compute vertexes", "t...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_arrow
Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. length : float Length of the arrow. cone_radius : float Radius of the cone base. ...
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_arrow(rows, cols, radius=0.1, length=1.0, cone_radius=None, cone_length=None): """Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. ...
def create_arrow(rows, cols, radius=0.1, length=1.0, cone_radius=None, cone_length=None): """Create a 3D arrow using a cylinder plus cone Parameters ---------- rows : int Number of rows. cols : int Number of columns. radius : float Base cylinder radius. ...
[ "Create", "a", "3D", "arrow", "using", "a", "cylinder", "plus", "cone" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L546-L595
[ "def", "create_arrow", "(", "rows", ",", "cols", ",", "radius", "=", "0.1", ",", "length", "=", "1.0", ",", "cone_radius", "=", "None", ",", "cone_length", "=", "None", ")", ":", "# create the cylinder", "md_cyl", "=", "None", "if", "cone_radius", "is", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
create_grid_mesh
Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must have the same dimensions as ys and zs....
glue_vispy_viewers/extern/vispy/geometry/generation.py
def create_grid_mesh(xs, ys, zs): '''Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must ...
def create_grid_mesh(xs, ys, zs): '''Generate vertices and indices for an implicitly connected mesh. The intention is that this makes it simple to generate a mesh from meshgrid data. Parameters ---------- xs : ndarray A 2d array of x coordinates for the vertices of the mesh. Must ...
[ "Generate", "vertices", "and", "indices", "for", "an", "implicitly", "connected", "mesh", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/generation.py#L598-L646
[ "def", "create_grid_mesh", "(", "xs", ",", "ys", ",", "zs", ")", ":", "shape", "=", "xs", ".", "shape", "length", "=", "shape", "[", "0", "]", "*", "shape", "[", "1", "]", "vertices", "=", "np", ".", "zeros", "(", "(", "length", ",", "3", ")", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_straight_line_vertices
Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array The adjacency matrix of the graph node_coords : array The current coordi...
glue_vispy_viewers/extern/vispy/visuals/graphs/util.py
def _straight_line_vertices(adjacency_mat, node_coords, directed=False): """ Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array ...
def _straight_line_vertices(adjacency_mat, node_coords, directed=False): """ Generate the vertices for straight lines between nodes. If it is a directed graph, it also generates the vertices which can be passed to an :class:`ArrowVisual`. Parameters ---------- adjacency_mat : array ...
[ "Generate", "the", "vertices", "for", "straight", "lines", "between", "nodes", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/util.py#L54-L95
[ "def", "_straight_line_vertices", "(", "adjacency_mat", ",", "node_coords", ",", "directed", "=", "False", ")", ":", "if", "not", "issparse", "(", "adjacency_mat", ")", ":", "adjacency_mat", "=", "np", ".", "asarray", "(", "adjacency_mat", ",", "float", ")", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
_rescale_layout
Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (normalized) coordinates in the range [0, `scale`]...
glue_vispy_viewers/extern/vispy/visuals/graphs/util.py
def _rescale_layout(pos, scale=1): """ Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (no...
def _rescale_layout(pos, scale=1): """ Normalize the given coordinate list to the range [0, `scale`]. Parameters ---------- pos : array Coordinate list scale : number The upperbound value for the coordinates range Returns ------- pos : array The rescaled (no...
[ "Normalize", "the", "given", "coordinate", "list", "to", "the", "range", "[", "0", "scale", "]", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/util.py#L98-L122
[ "def", "_rescale_layout", "(", "pos", ",", "scale", "=", "1", ")", ":", "pos", "-=", "pos", ".", "min", "(", "axis", "=", "0", ")", "pos", "*=", "scale", "/", "pos", ".", "max", "(", ")", "return", "pos" ]
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
get_handle
Get unique FT_Library handle
glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py
def get_handle(): ''' Get unique FT_Library handle ''' global __handle__ if not __handle__: __handle__ = FT_Library() error = FT_Init_FreeType(byref(__handle__)) if error: raise RuntimeError(hex(error)) return __handle__
def get_handle(): ''' Get unique FT_Library handle ''' global __handle__ if not __handle__: __handle__ = FT_Library() error = FT_Init_FreeType(byref(__handle__)) if error: raise RuntimeError(hex(error)) return __handle__
[ "Get", "unique", "FT_Library", "handle" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py#L205-L215
[ "def", "get_handle", "(", ")", ":", "global", "__handle__", "if", "not", "__handle__", ":", "__handle__", "=", "FT_Library", "(", ")", "error", "=", "FT_Init_FreeType", "(", "byref", "(", "__handle__", ")", ")", "if", "error", ":", "raise", "RuntimeError", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
version
Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number )
glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py
def version(): ''' Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number ) ''' amajor = FT_Int() aminor = FT_Int() apatch = FT_Int() library = get_handle() FT_Library_Version(library, byref(amajor), byre...
def version(): ''' Return the version of the FreeType library being used as a tuple of ( major version number, minor version number, patch version number ) ''' amajor = FT_Int() aminor = FT_Int() apatch = FT_Int() library = get_handle() FT_Library_Version(library, byref(amajor), byre...
[ "Return", "the", "version", "of", "the", "FreeType", "library", "being", "used", "as", "a", "tuple", "of", "(", "major", "version", "number", "minor", "version", "number", "patch", "version", "number", ")" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/freetype.py#L218-L228
[ "def", "version", "(", ")", ":", "amajor", "=", "FT_Int", "(", ")", "aminor", "=", "FT_Int", "(", ")", "apatch", "=", "FT_Int", "(", ")", "library", "=", "get_handle", "(", ")", "FT_Library_Version", "(", "library", ",", "byref", "(", "amajor", ")", ...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
make_camera
Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` * None : Creates :class:`Camera` Notes -----...
glue_vispy_viewers/extern/vispy/scene/cameras/_base.py
def make_camera(cam_type, *args, **kwargs): """ Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` *...
def make_camera(cam_type, *args, **kwargs): """ Factory function for creating new cameras using a string name. Parameters ---------- cam_type : str May be one of: * 'panzoom' : Creates :class:`PanZoomCamera` * 'turntable' : Creates :class:`TurntableCamera` *...
[ "Factory", "function", "for", "creating", "new", "cameras", "using", "a", "string", "name", "." ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/_base.py#L12-L38
[ "def", "make_camera", "(", "cam_type", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "cam_types", "=", "{", "None", ":", "BaseCamera", "}", "for", "camType", "in", "(", "BaseCamera", ",", "PanZoomCamera", ",", "PerspectiveCamera", ",", "TurntableCam...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
MultiColorScatter.set_data_values
Set the position of the datapoints
glue_vispy_viewers/scatter/multi_scatter.py
def set_data_values(self, label, x, y, z): """ Set the position of the datapoints """ # TODO: avoid re-allocating an array every time self.layers[label]['data'] = np.array([x, y, z]).transpose() self._update()
def set_data_values(self, label, x, y, z): """ Set the position of the datapoints """ # TODO: avoid re-allocating an array every time self.layers[label]['data'] = np.array([x, y, z]).transpose() self._update()
[ "Set", "the", "position", "of", "the", "datapoints" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/scatter/multi_scatter.py#L49-L55
[ "def", "set_data_values", "(", "self", ",", "label", ",", "x", ",", "y", ",", "z", ")", ":", "# TODO: avoid re-allocating an array every time", "self", ".", "layers", "[", "label", "]", "[", "'data'", "]", "=", "np", ".", "array", "(", "[", "x", ",", "...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
SegmentCollection
mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash)
glue_vispy_viewers/extern/vispy/visuals/collections/segment_collection.py
def SegmentCollection(mode="agg-fast", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash) """ if mode == "raw": return RawSegmentCollection(*args...
def SegmentCollection(mode="agg-fast", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: slower, size: medium, output: perfect, no dash) """ if mode == "raw": return RawSegmentCollection(*args...
[ "mode", ":", "string", "-", "raw", "(", "speed", ":", "fastest", "size", ":", "small", "output", ":", "ugly", "no", "dash", "no", "thickness", ")", "-", "agg", "(", "speed", ":", "slower", "size", ":", "medium", "output", ":", "perfect", "no", "dash"...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/segment_collection.py#L10-L20
[ "def", "SegmentCollection", "(", "mode", "=", "\"agg-fast\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "==", "\"raw\"", ":", "return", "RawSegmentCollection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "AggSegment...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
surface
Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface
glue_vispy_viewers/extern/vispy/geometry/parametric.py
def surface(func, umin=0, umax=2 * np.pi, ucount=64, urepeat=1.0, vmin=0, vmax=2 * np.pi, vcount=64, vrepeat=1.0): """ Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface """ vtype = [('position', np.float32, 3...
def surface(func, umin=0, umax=2 * np.pi, ucount=64, urepeat=1.0, vmin=0, vmax=2 * np.pi, vcount=64, vrepeat=1.0): """ Computes the parameterization of a parametric surface func: function(u,v) Parametric function used to build the surface """ vtype = [('position', np.float32, 3...
[ "Computes", "the", "parameterization", "of", "a", "parametric", "surface" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/parametric.py#L11-L57
[ "def", "surface", "(", "func", ",", "umin", "=", "0", ",", "umax", "=", "2", "*", "np", ".", "pi", ",", "ucount", "=", "64", ",", "urepeat", "=", "1.0", ",", "vmin", "=", "0", ",", "vmax", "=", "2", "*", "np", ".", "pi", ",", "vcount", "=",...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
PointCollection
mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful)
glue_vispy_viewers/extern/vispy/visuals/collections/point_collection.py
def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) """ if mode == "raw": return RawPointCollection(*args, **kwargs) return AggPointCollection(*args,...
def PointCollection(mode="raw", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly) - "agg" (speed: fast, size: small, output: beautiful) """ if mode == "raw": return RawPointCollection(*args, **kwargs) return AggPointCollection(*args,...
[ "mode", ":", "string", "-", "raw", "(", "speed", ":", "fastest", "size", ":", "small", "output", ":", "ugly", ")", "-", "agg", "(", "speed", ":", "fast", "size", ":", "small", "output", ":", "beautiful", ")" ]
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/point_collection.py#L11-L20
[ "def", "PointCollection", "(", "mode", "=", "\"raw\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "==", "\"raw\"", ":", "return", "RawPointCollection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "AggPointCollection"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea
train
ScrollingLinesVisual.roll_data
Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append.
glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py
def roll_data(self, data): """Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append. """ data = data.astype('float32')[..., np.newaxis] ...
def roll_data(self, data): """Append new data to the right side of every line strip and remove as much data from the left. Parameters ---------- data : array-like A data array to append. """ data = data.astype('float32')[..., np.newaxis] ...
[ "Append", "new", "data", "to", "the", "right", "side", "of", "every", "line", "strip", "and", "remove", "as", "much", "data", "from", "the", "left", ".", "Parameters", "----------", "data", ":", "array", "-", "like", "A", "data", "array", "to", "append",...
glue-viz/glue-vispy-viewers
python
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/scrolling_lines.py#L160-L179
[ "def", "roll_data", "(", "self", ",", "data", ")", ":", "data", "=", "data", ".", "astype", "(", "'float32'", ")", "[", "...", ",", "np", ".", "newaxis", "]", "s1", "=", "self", ".", "_data_shape", "[", "1", "]", "-", "self", ".", "_offset", "if"...
54a4351d98c1f90dfb1a557d1b447c1f57470eea