repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_hex_to_rgba
def _hex_to_rgba(hexs): """Convert hex to rgba, permitting alpha values in hex""" hexs = np.atleast_1d(np.array(hexs, '|U9')) out = np.ones((len(hexs), 4), np.float32) for hi, h in enumerate(hexs): assert isinstance(h, string_types) off = 1 if h[0] == '#' else 0 assert len(h) in ...
python
def _hex_to_rgba(hexs): """Convert hex to rgba, permitting alpha values in hex""" hexs = np.atleast_1d(np.array(hexs, '|U9')) out = np.ones((len(hexs), 4), np.float32) for hi, h in enumerate(hexs): assert isinstance(h, string_types) off = 1 if h[0] == '#' else 0 assert len(h) in ...
[ "def", "_hex_to_rgba", "(", "hexs", ")", ":", "hexs", "=", "np", ".", "atleast_1d", "(", "np", ".", "array", "(", "hexs", ",", "'|U9'", ")", ")", "out", "=", "np", ".", "ones", "(", "(", "len", "(", "hexs", ")", ",", "4", ")", ",", "np", ".",...
Convert hex to rgba, permitting alpha values in hex
[ "Convert", "hex", "to", "rgba", "permitting", "alpha", "values", "in", "hex" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L25-L36
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_rgb_to_hex
def _rgb_to_hex(rgbs): """Convert rgb to hex triplet""" rgbs, n_dim = _check_color_dim(rgbs) return np.array(['#%02x%02x%02x' % tuple((255*rgb[:3]).astype(np.uint8)) for rgb in rgbs], '|U7')
python
def _rgb_to_hex(rgbs): """Convert rgb to hex triplet""" rgbs, n_dim = _check_color_dim(rgbs) return np.array(['#%02x%02x%02x' % tuple((255*rgb[:3]).astype(np.uint8)) for rgb in rgbs], '|U7')
[ "def", "_rgb_to_hex", "(", "rgbs", ")", ":", "rgbs", ",", "n_dim", "=", "_check_color_dim", "(", "rgbs", ")", "return", "np", ".", "array", "(", "[", "'#%02x%02x%02x'", "%", "tuple", "(", "(", "255", "*", "rgb", "[", ":", "3", "]", ")", ".", "astyp...
Convert rgb to hex triplet
[ "Convert", "rgb", "to", "hex", "triplet" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L39-L43
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_rgb_to_hsv
def _rgb_to_hsv(rgbs): """Convert Nx3 or Nx4 rgb to hsv""" rgbs, n_dim = _check_color_dim(rgbs) hsvs = list() for rgb in rgbs: rgb = rgb[:3] # don't use alpha here idx = np.argmax(rgb) val = rgb[idx] c = val - np.min(rgb) if c == 0: hue = 0 ...
python
def _rgb_to_hsv(rgbs): """Convert Nx3 or Nx4 rgb to hsv""" rgbs, n_dim = _check_color_dim(rgbs) hsvs = list() for rgb in rgbs: rgb = rgb[:3] # don't use alpha here idx = np.argmax(rgb) val = rgb[idx] c = val - np.min(rgb) if c == 0: hue = 0 ...
[ "def", "_rgb_to_hsv", "(", "rgbs", ")", ":", "rgbs", ",", "n_dim", "=", "_check_color_dim", "(", "rgbs", ")", "hsvs", "=", "list", "(", ")", "for", "rgb", "in", "rgbs", ":", "rgb", "=", "rgb", "[", ":", "3", "]", "# don't use alpha here", "idx", "=",...
Convert Nx3 or Nx4 rgb to hsv
[ "Convert", "Nx3", "or", "Nx4", "rgb", "to", "hsv" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L49-L75
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_hsv_to_rgb
def _hsv_to_rgb(hsvs): """Convert Nx3 or Nx4 hsv to rgb""" hsvs, n_dim = _check_color_dim(hsvs) # In principle, we *might* be able to vectorize this, but might as well # wait until a compelling use case appears rgbs = list() for hsv in hsvs: c = hsv[1] * hsv[2] m = hsv[2] - c ...
python
def _hsv_to_rgb(hsvs): """Convert Nx3 or Nx4 hsv to rgb""" hsvs, n_dim = _check_color_dim(hsvs) # In principle, we *might* be able to vectorize this, but might as well # wait until a compelling use case appears rgbs = list() for hsv in hsvs: c = hsv[1] * hsv[2] m = hsv[2] - c ...
[ "def", "_hsv_to_rgb", "(", "hsvs", ")", ":", "hsvs", ",", "n_dim", "=", "_check_color_dim", "(", "hsvs", ")", "# In principle, we *might* be able to vectorize this, but might as well", "# wait until a compelling use case appears", "rgbs", "=", "list", "(", ")", "for", "hs...
Convert Nx3 or Nx4 hsv to rgb
[ "Convert", "Nx3", "or", "Nx4", "hsv", "to", "rgb" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L78-L106
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/color/color_space.py
_lab_to_rgb
def _lab_to_rgb(labs): """Convert Nx3 or Nx4 lab to rgb""" # adapted from BSD-licensed work in MATLAB by Mark Ruzon # Based on ITU-R Recommendation BT.709 using the D65 labs, n_dim = _check_color_dim(labs) # Convert Lab->XYZ (silly indexing used to preserve dimensionality) y = (labs[:, 0] + 16....
python
def _lab_to_rgb(labs): """Convert Nx3 or Nx4 lab to rgb""" # adapted from BSD-licensed work in MATLAB by Mark Ruzon # Based on ITU-R Recommendation BT.709 using the D65 labs, n_dim = _check_color_dim(labs) # Convert Lab->XYZ (silly indexing used to preserve dimensionality) y = (labs[:, 0] + 16....
[ "def", "_lab_to_rgb", "(", "labs", ")", ":", "# adapted from BSD-licensed work in MATLAB by Mark Ruzon", "# Based on ITU-R Recommendation BT.709 using the D65", "labs", ",", "n_dim", "=", "_check_color_dim", "(", "labs", ")", "# Convert Lab->XYZ (silly indexing used to preserve dimen...
Convert Nx3 or Nx4 lab to rgb
[ "Convert", "Nx3", "or", "Nx4", "lab", "to", "rgb" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/color_space.py#L160-L183
rbarrois/mpdlcd
mpdlcd/mpdwrapper.py
SongTag.get
def get(self, tags): """Find an adequate value for this field from a dict of tags.""" # Try to find our name value = tags.get(self.name, '') for name in self.alternate_tags: # Iterate of alternates until a non-empty value is found value = value or tags.get(name, ...
python
def get(self, tags): """Find an adequate value for this field from a dict of tags.""" # Try to find our name value = tags.get(self.name, '') for name in self.alternate_tags: # Iterate of alternates until a non-empty value is found value = value or tags.get(name, ...
[ "def", "get", "(", "self", ",", "tags", ")", ":", "# Try to find our name", "value", "=", "tags", ".", "get", "(", "self", ".", "name", ",", "''", ")", "for", "name", "in", "self", ".", "alternate_tags", ":", "# Iterate of alternates until a non-empty value is...
Find an adequate value for this field from a dict of tags.
[ "Find", "an", "adequate", "value", "for", "this", "field", "from", "a", "dict", "of", "tags", "." ]
train
https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/mpdwrapper.py#L135-L146
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py
parse_function_signature
def parse_function_signature(code): """ Return the name, arguments, and return type of the first function definition found in *code*. Arguments are returned as [(type, name), ...]. """ m = re.search("^\s*" + re_func_decl + "\s*{", code, re.M) if m is None: print(code) raise Excep...
python
def parse_function_signature(code): """ Return the name, arguments, and return type of the first function definition found in *code*. Arguments are returned as [(type, name), ...]. """ m = re.search("^\s*" + re_func_decl + "\s*{", code, re.M) if m is None: print(code) raise Excep...
[ "def", "parse_function_signature", "(", "code", ")", ":", "m", "=", "re", ".", "search", "(", "\"^\\s*\"", "+", "re_func_decl", "+", "\"\\s*{\"", ",", "code", ",", "re", ".", "M", ")", "if", "m", "is", "None", ":", "print", "(", "code", ")", "raise",...
Return the name, arguments, and return type of the first function definition found in *code*. Arguments are returned as [(type, name), ...].
[ "Return", "the", "name", "arguments", "and", "return", "type", "of", "the", "first", "function", "definition", "found", "in", "*", "code", "*", ".", "Arguments", "are", "returned", "as", "[", "(", "type", "name", ")", "...", "]", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L55-L70
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py
find_functions
def find_functions(code): """ Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...]. """ regex = "^\s*" + re_func_decl + "\s*{" funcs = [] while True: m = re.search(regex, code, re.M) ...
python
def find_functions(code): """ Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...]. """ regex = "^\s*" + re_func_decl + "\s*{" funcs = [] while True: m = re.search(regex, code, re.M) ...
[ "def", "find_functions", "(", "code", ")", ":", "regex", "=", "\"^\\s*\"", "+", "re_func_decl", "+", "\"\\s*{\"", "funcs", "=", "[", "]", "while", "True", ":", "m", "=", "re", ".", "search", "(", "regex", ",", "code", ",", "re", ".", "M", ")", "if"...
Return a list of (name, arguments, return type) for all function definition2 found in *code*. Arguments are returned as [(type, name), ...].
[ "Return", "a", "list", "of", "(", "name", "arguments", "return", "type", ")", "for", "all", "function", "definition2", "found", "in", "*", "code", "*", ".", "Arguments", "are", "returned", "as", "[", "(", "type", "name", ")", "...", "]", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L73-L93
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py
find_prototypes
def find_prototypes(code): """ Return a list of signatures for each function prototype declared in *code*. Format is [(name, [args], rtype), ...]. """ prots = [] lines = code.split('\n') for line in lines: m = re.match("\s*" + re_func_prot, line) if m is not None: ...
python
def find_prototypes(code): """ Return a list of signatures for each function prototype declared in *code*. Format is [(name, [args], rtype), ...]. """ prots = [] lines = code.split('\n') for line in lines: m = re.match("\s*" + re_func_prot, line) if m is not None: ...
[ "def", "find_prototypes", "(", "code", ")", ":", "prots", "=", "[", "]", "lines", "=", "code", ".", "split", "(", "'\\n'", ")", "for", "line", "in", "lines", ":", "m", "=", "re", ".", "match", "(", "\"\\s*\"", "+", "re_func_prot", ",", "line", ")",...
Return a list of signatures for each function prototype declared in *code*. Format is [(name, [args], rtype), ...].
[ "Return", "a", "list", "of", "signatures", "for", "each", "function", "prototype", "declared", "in", "*", "code", "*", ".", "Format", "is", "[", "(", "name", "[", "args", "]", "rtype", ")", "...", "]", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L96-L115
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py
find_program_variables
def find_program_variables(code): """ Return a dict describing program variables:: {'var_name': ('uniform|attribute|varying', type), ...} """ vars = {} lines = code.split('\n') for line in lines: m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line) if m is...
python
def find_program_variables(code): """ Return a dict describing program variables:: {'var_name': ('uniform|attribute|varying', type), ...} """ vars = {} lines = code.split('\n') for line in lines: m = re.match(r"\s*" + re_prog_var_declaration + r"\s*(=|;)", line) if m is...
[ "def", "find_program_variables", "(", "code", ")", ":", "vars", "=", "{", "}", "lines", "=", "code", ".", "split", "(", "'\\n'", ")", "for", "line", "in", "lines", ":", "m", "=", "re", ".", "match", "(", "r\"\\s*\"", "+", "re_prog_var_declaration", "+"...
Return a dict describing program variables:: {'var_name': ('uniform|attribute|varying', type), ...}
[ "Return", "a", "dict", "describing", "program", "variables", "::" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/parsing.py#L118-L133
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_sdl2.py
_set_config
def _set_config(c): """Set gl configuration for SDL2""" func = sdl2.SDL_GL_SetAttribute func(sdl2.SDL_GL_RED_SIZE, c['red_size']) func(sdl2.SDL_GL_GREEN_SIZE, c['green_size']) func(sdl2.SDL_GL_BLUE_SIZE, c['blue_size']) func(sdl2.SDL_GL_ALPHA_SIZE, c['alpha_size']) func(sdl2.SDL_GL_DEPTH_SIZ...
python
def _set_config(c): """Set gl configuration for SDL2""" func = sdl2.SDL_GL_SetAttribute func(sdl2.SDL_GL_RED_SIZE, c['red_size']) func(sdl2.SDL_GL_GREEN_SIZE, c['green_size']) func(sdl2.SDL_GL_BLUE_SIZE, c['blue_size']) func(sdl2.SDL_GL_ALPHA_SIZE, c['alpha_size']) func(sdl2.SDL_GL_DEPTH_SIZ...
[ "def", "_set_config", "(", "c", ")", ":", "func", "=", "sdl2", ".", "SDL_GL_SetAttribute", "func", "(", "sdl2", ".", "SDL_GL_RED_SIZE", ",", "c", "[", "'red_size'", "]", ")", "func", "(", "sdl2", ".", "SDL_GL_GREEN_SIZE", ",", "c", "[", "'green_size'", "...
Set gl configuration for SDL2
[ "Set", "gl", "configuration", "for", "SDL2" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_sdl2.py#L119-L132
anjishnu/ask-alexa-pykit
ask/alexa_io.py
ResponseBuilder.create_response
def create_response(self, message=None, end_session=False, card_obj=None, reprompt_message=None, is_ssml=None): """ message - text message to be spoken out by the Echo end_session - flag to determine whether this interaction should end the session card_obj = JSON ...
python
def create_response(self, message=None, end_session=False, card_obj=None, reprompt_message=None, is_ssml=None): """ message - text message to be spoken out by the Echo end_session - flag to determine whether this interaction should end the session card_obj = JSON ...
[ "def", "create_response", "(", "self", ",", "message", "=", "None", ",", "end_session", "=", "False", ",", "card_obj", "=", "None", ",", "reprompt_message", "=", "None", ",", "is_ssml", "=", "None", ")", ":", "response", "=", "dict", "(", "self", ".", ...
message - text message to be spoken out by the Echo end_session - flag to determine whether this interaction should end the session card_obj = JSON card object to substitute the 'card' field in the raw_response
[ "message", "-", "text", "message", "to", "be", "spoken", "out", "by", "the", "Echo", "end_session", "-", "flag", "to", "determine", "whether", "this", "interaction", "should", "end", "the", "session", "card_obj", "=", "JSON", "card", "object", "to", "substit...
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L103-L118
anjishnu/ask-alexa-pykit
ask/alexa_io.py
ResponseBuilder.create_card
def create_card(self, title=None, subtitle=None, content=None, card_type="Simple"): """ card_obj = JSON card object to substitute the 'card' field in the raw_response format: { "type": "Simple", #COMPULSORY "title": "string", #OPTIONAL "subtitle": "string", ...
python
def create_card(self, title=None, subtitle=None, content=None, card_type="Simple"): """ card_obj = JSON card object to substitute the 'card' field in the raw_response format: { "type": "Simple", #COMPULSORY "title": "string", #OPTIONAL "subtitle": "string", ...
[ "def", "create_card", "(", "self", ",", "title", "=", "None", ",", "subtitle", "=", "None", ",", "content", "=", "None", ",", "card_type", "=", "\"Simple\"", ")", ":", "card", "=", "{", "\"type\"", ":", "card_type", "}", "if", "title", ":", "card", "...
card_obj = JSON card object to substitute the 'card' field in the raw_response format: { "type": "Simple", #COMPULSORY "title": "string", #OPTIONAL "subtitle": "string", #OPTIONAL "content": "string" #OPTIONAL }
[ "card_obj", "=", "JSON", "card", "object", "to", "substitute", "the", "card", "field", "in", "the", "raw_response", "format", ":", "{", "type", ":", "Simple", "#COMPULSORY", "title", ":", "string", "#OPTIONAL", "subtitle", ":", "string", "#OPTIONAL", "content"...
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L135-L150
anjishnu/ask-alexa-pykit
ask/alexa_io.py
VoiceHandler.intent
def intent(self, intent): ''' Decorator to register intent handler''' def _handler(func): self._handlers['IntentRequest'][intent] = func return func return _handler
python
def intent(self, intent): ''' Decorator to register intent handler''' def _handler(func): self._handlers['IntentRequest'][intent] = func return func return _handler
[ "def", "intent", "(", "self", ",", "intent", ")", ":", "def", "_handler", "(", "func", ")", ":", "self", ".", "_handlers", "[", "'IntentRequest'", "]", "[", "intent", "]", "=", "func", "return", "func", "return", "_handler" ]
Decorator to register intent handler
[ "Decorator", "to", "register", "intent", "handler" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L177-L184
anjishnu/ask-alexa-pykit
ask/alexa_io.py
VoiceHandler.request
def request(self, request_type): ''' Decorator to register generic request handler ''' def _handler(func): self._handlers[request_type] = func return func return _handler
python
def request(self, request_type): ''' Decorator to register generic request handler ''' def _handler(func): self._handlers[request_type] = func return func return _handler
[ "def", "request", "(", "self", ",", "request_type", ")", ":", "def", "_handler", "(", "func", ")", ":", "self", ".", "_handlers", "[", "request_type", "]", "=", "func", "return", "func", "return", "_handler" ]
Decorator to register generic request handler
[ "Decorator", "to", "register", "generic", "request", "handler" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L186-L193
anjishnu/ask-alexa-pykit
ask/alexa_io.py
VoiceHandler.route_request
def route_request(self, request_json, metadata=None): ''' Route the request object to the right handler function ''' request = Request(request_json) request.metadata = metadata # add reprompt handler or some such for default? handler_fn = self._handlers[self._default] # Set defa...
python
def route_request(self, request_json, metadata=None): ''' Route the request object to the right handler function ''' request = Request(request_json) request.metadata = metadata # add reprompt handler or some such for default? handler_fn = self._handlers[self._default] # Set defa...
[ "def", "route_request", "(", "self", ",", "request_json", ",", "metadata", "=", "None", ")", ":", "request", "=", "Request", "(", "request_json", ")", "request", ".", "metadata", "=", "metadata", "# add reprompt handler or some such for default?", "handler_fn", "=",...
Route the request object to the right handler function
[ "Route", "the", "request", "object", "to", "the", "right", "handler", "function" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/alexa_io.py#L195-L213
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera._viewbox_set
def _viewbox_set(self, viewbox): """ Friend method of viewbox to register itself. """ self._viewbox = viewbox # Connect viewbox.events.mouse_press.connect(self.viewbox_mouse_event) viewbox.events.mouse_release.connect(self.viewbox_mouse_event) viewbox.events.mouse...
python
def _viewbox_set(self, viewbox): """ Friend method of viewbox to register itself. """ self._viewbox = viewbox # Connect viewbox.events.mouse_press.connect(self.viewbox_mouse_event) viewbox.events.mouse_release.connect(self.viewbox_mouse_event) viewbox.events.mouse...
[ "def", "_viewbox_set", "(", "self", ",", "viewbox", ")", ":", "self", ".", "_viewbox", "=", "viewbox", "# Connect", "viewbox", ".", "events", ".", "mouse_press", ".", "connect", "(", "self", ".", "viewbox_mouse_event", ")", "viewbox", ".", "events", ".", "...
Friend method of viewbox to register itself.
[ "Friend", "method", "of", "viewbox", "to", "register", "itself", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L118-L127
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera._viewbox_unset
def _viewbox_unset(self, viewbox): """ Friend method of viewbox to unregister itself. """ self._viewbox = None # Disconnect viewbox.events.mouse_press.disconnect(self.viewbox_mouse_event) viewbox.events.mouse_release.disconnect(self.viewbox_mouse_event) viewbox.ev...
python
def _viewbox_unset(self, viewbox): """ Friend method of viewbox to unregister itself. """ self._viewbox = None # Disconnect viewbox.events.mouse_press.disconnect(self.viewbox_mouse_event) viewbox.events.mouse_release.disconnect(self.viewbox_mouse_event) viewbox.ev...
[ "def", "_viewbox_unset", "(", "self", ",", "viewbox", ")", ":", "self", ".", "_viewbox", "=", "None", "# Disconnect", "viewbox", ".", "events", ".", "mouse_press", ".", "disconnect", "(", "self", ".", "viewbox_mouse_event", ")", "viewbox", ".", "events", "."...
Friend method of viewbox to unregister itself.
[ "Friend", "method", "of", "viewbox", "to", "unregister", "itself", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L130-L139
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.set_range
def set_range(self, x=None, y=None, z=None, margin=0.05): """ Set the range of the view region for the camera Parameters ---------- x : tuple | None X range. y : tuple | None Y range. z : tuple | None Z range. margin : float ...
python
def set_range(self, x=None, y=None, z=None, margin=0.05): """ Set the range of the view region for the camera Parameters ---------- x : tuple | None X range. y : tuple | None Y range. z : tuple | None Z range. margin : float ...
[ "def", "set_range", "(", "self", ",", "x", "=", "None", ",", "y", "=", "None", ",", "z", "=", "None", ",", "margin", "=", "0.05", ")", ":", "# Flag to indicate that this is an initializing (not user-invoked)", "init", "=", "self", ".", "_xlim", "is", "None",...
Set the range of the view region for the camera Parameters ---------- x : tuple | None X range. y : tuple | None Y range. z : tuple | None Z range. margin : float Margin to use. Notes ----- The view...
[ "Set", "the", "range", "of", "the", "view", "region", "for", "the", "camera" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L228-L294
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.get_state
def get_state(self): """ Get the current view state of the camera Returns a dict of key-value pairs. The exact keys depend on the camera. Can be passed to set_state() (of this or another camera of the same type) to reproduce the state. """ D = {} for key in self....
python
def get_state(self): """ Get the current view state of the camera Returns a dict of key-value pairs. The exact keys depend on the camera. Can be passed to set_state() (of this or another camera of the same type) to reproduce the state. """ D = {} for key in self....
[ "def", "get_state", "(", "self", ")", ":", "D", "=", "{", "}", "for", "key", "in", "self", ".", "_state_props", ":", "D", "[", "key", "]", "=", "getattr", "(", "self", ",", "key", ")", "return", "D" ]
Get the current view state of the camera Returns a dict of key-value pairs. The exact keys depend on the camera. Can be passed to set_state() (of this or another camera of the same type) to reproduce the state.
[ "Get", "the", "current", "view", "state", "of", "the", "camera" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L310-L320
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.set_state
def set_state(self, state=None, **kwargs): """ Set the view state of the camera Should be a dict (or kwargs) as returned by get_state. It can be an incomlete dict, in which case only the specified properties are set. Parameters ---------- state : dict ...
python
def set_state(self, state=None, **kwargs): """ Set the view state of the camera Should be a dict (or kwargs) as returned by get_state. It can be an incomlete dict, in which case only the specified properties are set. Parameters ---------- state : dict ...
[ "def", "set_state", "(", "self", ",", "state", "=", "None", ",", "*", "*", "kwargs", ")", ":", "D", "=", "state", "or", "{", "}", "D", ".", "update", "(", "kwargs", ")", "for", "key", ",", "val", "in", "D", ".", "items", "(", ")", ":", "if", ...
Set the view state of the camera Should be a dict (or kwargs) as returned by get_state. It can be an incomlete dict, in which case only the specified properties are set. Parameters ---------- state : dict The camera state. **kwargs : dict ...
[ "Set", "the", "view", "state", "of", "the", "camera" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L322-L341
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.link
def link(self, camera): """ Link this camera with another camera of the same type Linked camera's keep each-others' state in sync. Parameters ---------- camera : instance of Camera The other camera to link. """ cam1, cam2 = self, camera # Rem...
python
def link(self, camera): """ Link this camera with another camera of the same type Linked camera's keep each-others' state in sync. Parameters ---------- camera : instance of Camera The other camera to link. """ cam1, cam2 = self, camera # Rem...
[ "def", "link", "(", "self", ",", "camera", ")", ":", "cam1", ",", "cam2", "=", "self", ",", "camera", "# Remove if already linked", "while", "cam1", "in", "cam2", ".", "_linked_cameras", ":", "cam2", ".", "_linked_cameras", ".", "remove", "(", "cam1", ")",...
Link this camera with another camera of the same type Linked camera's keep each-others' state in sync. Parameters ---------- camera : instance of Camera The other camera to link.
[ "Link", "this", "camera", "with", "another", "camera", "of", "the", "same", "type" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L343-L361
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.view_changed
def view_changed(self): """ Called when this camera is changes its view. Also called when its associated with a viewbox. """ if self._resetting: return # don't update anything while resetting (are in set_range) if self._viewbox: # Set range if necessary ...
python
def view_changed(self): """ Called when this camera is changes its view. Also called when its associated with a viewbox. """ if self._resetting: return # don't update anything while resetting (are in set_range) if self._viewbox: # Set range if necessary ...
[ "def", "view_changed", "(", "self", ")", ":", "if", "self", ".", "_resetting", ":", "return", "# don't update anything while resetting (are in set_range)", "if", "self", ".", "_viewbox", ":", "# Set range if necessary", "if", "self", ".", "_xlim", "is", "None", ":",...
Called when this camera is changes its view. Also called when its associated with a viewbox.
[ "Called", "when", "this", "camera", "is", "changes", "its", "view", ".", "Also", "called", "when", "its", "associated", "with", "a", "viewbox", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L365-L380
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera.on_canvas_change
def on_canvas_change(self, event): """Canvas change event handler Parameters ---------- event : instance of Event The event. """ # Connect key events from canvas to camera. # TODO: canvas should keep track of a single node with keyboard focus. ...
python
def on_canvas_change(self, event): """Canvas change event handler Parameters ---------- event : instance of Event The event. """ # Connect key events from canvas to camera. # TODO: canvas should keep track of a single node with keyboard focus. ...
[ "def", "on_canvas_change", "(", "self", ",", "event", ")", ":", "# Connect key events from canvas to camera. ", "# TODO: canvas should keep track of a single node with keyboard focus.", "if", "event", ".", "old", "is", "not", "None", ":", "event", ".", "old", ".", "events...
Canvas change event handler Parameters ---------- event : instance of Event The event.
[ "Canvas", "change", "event", "handler" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L404-L419
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py
BaseCamera._set_scene_transform
def _set_scene_transform(self, tr): """ Called by subclasses to configure the viewbox scene transform. """ # todo: check whether transform has changed, connect to # transform.changed event pre_tr = self.pre_transform if pre_tr is None: self._scene_transform = ...
python
def _set_scene_transform(self, tr): """ Called by subclasses to configure the viewbox scene transform. """ # todo: check whether transform has changed, connect to # transform.changed event pre_tr = self.pre_transform if pre_tr is None: self._scene_transform = ...
[ "def", "_set_scene_transform", "(", "self", ",", "tr", ")", ":", "# todo: check whether transform has changed, connect to", "# transform.changed event", "pre_tr", "=", "self", ".", "pre_transform", "if", "pre_tr", "is", "None", ":", "self", ".", "_scene_transform", "=",...
Called by subclasses to configure the viewbox scene transform.
[ "Called", "by", "subclasses", "to", "configure", "the", "viewbox", "scene", "transform", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/base_camera.py#L448-L477
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_qt.py
_set_config
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c['red_size']) glformat.setGreenBufferSize(c['green_size']) glformat.setBlueBufferSize(c['blue_size']) glformat.setAlphaBufferSize(c['alpha_size']) if QT5_NEW_API: # Qt5 >= 5.4.0 -...
python
def _set_config(c): """Set the OpenGL configuration""" glformat = QGLFormat() glformat.setRedBufferSize(c['red_size']) glformat.setGreenBufferSize(c['green_size']) glformat.setBlueBufferSize(c['blue_size']) glformat.setAlphaBufferSize(c['alpha_size']) if QT5_NEW_API: # Qt5 >= 5.4.0 -...
[ "def", "_set_config", "(", "c", ")", ":", "glformat", "=", "QGLFormat", "(", ")", "glformat", ".", "setRedBufferSize", "(", "c", "[", "'red_size'", "]", ")", "glformat", ".", "setGreenBufferSize", "(", "c", "[", "'green_size'", "]", ")", "glformat", ".", ...
Set the OpenGL configuration
[ "Set", "the", "OpenGL", "configuration" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_qt.py#L195-L219
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/backends/_qt.py
CanvasBackendEgl.get_window_id
def get_window_id(self): """ Get the window id of a PySide Widget. Might also work for PyQt4. """ # Get Qt win id winid = self.winId() # On Linux this is it if IS_RPI: nw = (ctypes.c_int * 3)(winid, self.width(), self.height()) return ctypes.point...
python
def get_window_id(self): """ Get the window id of a PySide Widget. Might also work for PyQt4. """ # Get Qt win id winid = self.winId() # On Linux this is it if IS_RPI: nw = (ctypes.c_int * 3)(winid, self.width(), self.height()) return ctypes.point...
[ "def", "get_window_id", "(", "self", ")", ":", "# Get Qt win id", "winid", "=", "self", ".", "winId", "(", ")", "# On Linux this is it", "if", "IS_RPI", ":", "nw", "=", "(", "ctypes", ".", "c_int", "*", "3", ")", "(", "winid", ",", "self", ".", "width"...
Get the window id of a PySide Widget. Might also work for PyQt4.
[ "Get", "the", "window", "id", "of", "a", "PySide", "Widget", ".", "Might", "also", "work", "for", "PyQt4", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/_qt.py#L576-L603
andim/scipydirect
doc/tutorialfig.py
obj
def obj(x): """Six-hump camelback function""" x1 = x[0] x2 = x[1] f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2) return f
python
def obj(x): """Six-hump camelback function""" x1 = x[0] x2 = x[1] f = (4 - 2.1*(x1*x1) + (x1*x1*x1*x1)/3.0)*(x1*x1) + x1*x2 + (-4 + 4*(x2*x2))*(x2*x2) return f
[ "def", "obj", "(", "x", ")", ":", "x1", "=", "x", "[", "0", "]", "x2", "=", "x", "[", "1", "]", "f", "=", "(", "4", "-", "2.1", "*", "(", "x1", "*", "x1", ")", "+", "(", "x1", "*", "x1", "*", "x1", "*", "x1", ")", "/", "3.0", ")", ...
Six-hump camelback function
[ "Six", "-", "hump", "camelback", "function" ]
train
https://github.com/andim/scipydirect/blob/ad36ab19e6ad64054a1d2abd22f1c993fc4b87be/doc/tutorialfig.py#L9-L16
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/path_collection.py
PathCollection
def PathCollection(mode="agg", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: medium, size: medium output: nice, some flaws, no dash) - "agg+" (speed: slow, size: big, output: perfect, no dash)...
python
def PathCollection(mode="agg", *args, **kwargs): """ mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: medium, size: medium output: nice, some flaws, no dash) - "agg+" (speed: slow, size: big, output: perfect, no dash)...
[ "def", "PathCollection", "(", "mode", "=", "\"agg\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "==", "\"raw\"", ":", "return", "RawPathCollection", "(", "*", "args", ",", "*", "*", "kwargs", ")", "elif", "mode", "==", "\"agg...
mode: string - "raw" (speed: fastest, size: small, output: ugly, no dash, no thickness) - "agg" (speed: medium, size: medium output: nice, some flaws, no dash) - "agg+" (speed: slow, size: big, output: perfect, no dash)
[ "mode", ":", "string", "-", "raw", "(", "speed", ":", "fastest", "size", ":", "small", "output", ":", "ugly", "no", "dash", "no", "thickness", ")", "-", "agg", "(", "speed", ":", "medium", "size", ":", "medium", "output", ":", "nice", "some", "flaws"...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/path_collection.py#L11-L24
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
STTransform.map
def map(self, coords): """Map coordinates Parameters ---------- coords : array-like Coordinates to map. Returns ------- coords : ndarray Coordinates. """ m = np.empty(coords.shape) m[:, :3] = (coords[:, :3] * self....
python
def map(self, coords): """Map coordinates Parameters ---------- coords : array-like Coordinates to map. Returns ------- coords : ndarray Coordinates. """ m = np.empty(coords.shape) m[:, :3] = (coords[:, :3] * self....
[ "def", "map", "(", "self", ",", "coords", ")", ":", "m", "=", "np", ".", "empty", "(", "coords", ".", "shape", ")", "m", "[", ":", ",", ":", "3", "]", "=", "(", "coords", "[", ":", ",", ":", "3", "]", "*", "self", ".", "scale", "[", "np",...
Map coordinates Parameters ---------- coords : array-like Coordinates to map. Returns ------- coords : ndarray Coordinates.
[ "Map", "coordinates" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L96-L113
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
STTransform.move
def move(self, move): """Change the translation of this transform by the amount given. Parameters ---------- move : array-like The values to be added to the current translation of the transform. """ move = as_vec4(move, default=(0, 0, 0, 0)) self.tran...
python
def move(self, move): """Change the translation of this transform by the amount given. Parameters ---------- move : array-like The values to be added to the current translation of the transform. """ move = as_vec4(move, default=(0, 0, 0, 0)) self.tran...
[ "def", "move", "(", "self", ",", "move", ")", ":", "move", "=", "as_vec4", "(", "move", ",", "default", "=", "(", "0", ",", "0", ",", "0", ",", "0", ")", ")", "self", ".", "translate", "=", "self", ".", "translate", "+", "move" ]
Change the translation of this transform by the amount given. Parameters ---------- move : array-like The values to be added to the current translation of the transform.
[ "Change", "the", "translation", "of", "this", "transform", "by", "the", "amount", "given", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L181-L190
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
STTransform.zoom
def zoom(self, zoom, center=(0, 0, 0), mapped=True): """Update the transform such that its scale factor is changed, but the specified center point is left unchanged. Parameters ---------- zoom : array-like Values to multiply the transform's current scale ...
python
def zoom(self, zoom, center=(0, 0, 0), mapped=True): """Update the transform such that its scale factor is changed, but the specified center point is left unchanged. Parameters ---------- zoom : array-like Values to multiply the transform's current scale ...
[ "def", "zoom", "(", "self", ",", "zoom", ",", "center", "=", "(", "0", ",", "0", ",", "0", ")", ",", "mapped", "=", "True", ")", ":", "zoom", "=", "as_vec4", "(", "zoom", ",", "default", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", "...
Update the transform such that its scale factor is changed, but the specified center point is left unchanged. Parameters ---------- zoom : array-like Values to multiply the transform's current scale factors. center : array-like The center poin...
[ "Update", "the", "transform", "such", "that", "its", "scale", "factor", "is", "changed", "but", "the", "specified", "center", "point", "is", "left", "unchanged", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L192-L214
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
STTransform.from_mapping
def from_mapping(cls, x0, x1): """ Create an STTransform from the given mapping See `set_mapping` for details. Parameters ---------- x0 : array-like Start. x1 : array-like End. Returns ------- t : instance of STTransform ...
python
def from_mapping(cls, x0, x1): """ Create an STTransform from the given mapping See `set_mapping` for details. Parameters ---------- x0 : array-like Start. x1 : array-like End. Returns ------- t : instance of STTransform ...
[ "def", "from_mapping", "(", "cls", ",", "x0", ",", "x1", ")", ":", "t", "=", "cls", "(", ")", "t", ".", "set_mapping", "(", "x0", ",", "x1", ")", "return", "t" ]
Create an STTransform from the given mapping See `set_mapping` for details. Parameters ---------- x0 : array-like Start. x1 : array-like End. Returns ------- t : instance of STTransform The transform.
[ "Create", "an", "STTransform", "from", "the", "given", "mapping" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L223-L242
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
STTransform.set_mapping
def set_mapping(self, x0, x1, update=True): """Configure this transform such that it maps points x0 => x1 Parameters ---------- x0 : array-like, shape (2, 2) or (2, 3) Start location. x1 : array-like, shape (2, 2) or (2, 3) End location. update : ...
python
def set_mapping(self, x0, x1, update=True): """Configure this transform such that it maps points x0 => x1 Parameters ---------- x0 : array-like, shape (2, 2) or (2, 3) Start location. x1 : array-like, shape (2, 2) or (2, 3) End location. update : ...
[ "def", "set_mapping", "(", "self", ",", "x0", ",", "x1", ",", "update", "=", "True", ")", ":", "# if args are Rect, convert to array first", "if", "isinstance", "(", "x0", ",", "Rect", ")", ":", "x0", "=", "x0", ".", "_transform_in", "(", ")", "[", ":", ...
Configure this transform such that it maps points x0 => x1 Parameters ---------- x0 : array-like, shape (2, 2) or (2, 3) Start location. x1 : array-like, shape (2, 2) or (2, 3) End location. update : bool If False, then the update event is not...
[ "Configure", "this", "transform", "such", "that", "it", "maps", "points", "x0", "=", ">", "x1" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L244-L294
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.translate
def translate(self, pos): """ Translate the matrix The translation is applied *after* the transformations already present in the matrix. Parameters ---------- pos : arrayndarray Position to translate by. """ self.matrix = np.dot(self....
python
def translate(self, pos): """ Translate the matrix The translation is applied *after* the transformations already present in the matrix. Parameters ---------- pos : arrayndarray Position to translate by. """ self.matrix = np.dot(self....
[ "def", "translate", "(", "self", ",", "pos", ")", ":", "self", ".", "matrix", "=", "np", ".", "dot", "(", "self", ".", "matrix", ",", "transforms", ".", "translate", "(", "pos", "[", "0", ",", ":", "3", "]", ")", ")" ]
Translate the matrix The translation is applied *after* the transformations already present in the matrix. Parameters ---------- pos : arrayndarray Position to translate by.
[ "Translate", "the", "matrix" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L410-L422
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.scale
def scale(self, scale, center=None): """ Scale the matrix about a given origin. The scaling is applied *after* the transformations already present in the matrix. Parameters ---------- scale : array-like Scale factors along x, y and z axes. ce...
python
def scale(self, scale, center=None): """ Scale the matrix about a given origin. The scaling is applied *after* the transformations already present in the matrix. Parameters ---------- scale : array-like Scale factors along x, y and z axes. ce...
[ "def", "scale", "(", "self", ",", "scale", ",", "center", "=", "None", ")", ":", "scale", "=", "transforms", ".", "scale", "(", "as_vec4", "(", "scale", ",", "default", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ")", "[", "0", ",", ":"...
Scale the matrix about a given origin. The scaling is applied *after* the transformations already present in the matrix. Parameters ---------- scale : array-like Scale factors along x, y and z axes. center : array-like or None The x, y and z coor...
[ "Scale", "the", "matrix", "about", "a", "given", "origin", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L424-L444
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.rotate
def rotate(self, angle, axis): """ Rotate the matrix by some angle about a given axis. The rotation is applied *after* the transformations already present in the matrix. Parameters ---------- angle : float The angle of rotation, in degrees. a...
python
def rotate(self, angle, axis): """ Rotate the matrix by some angle about a given axis. The rotation is applied *after* the transformations already present in the matrix. Parameters ---------- angle : float The angle of rotation, in degrees. a...
[ "def", "rotate", "(", "self", ",", "angle", ",", "axis", ")", ":", "self", ".", "matrix", "=", "np", ".", "dot", "(", "self", ".", "matrix", ",", "transforms", ".", "rotate", "(", "angle", ",", "axis", ")", ")" ]
Rotate the matrix by some angle about a given axis. The rotation is applied *after* the transformations already present in the matrix. Parameters ---------- angle : float The angle of rotation, in degrees. axis : array-like The x, y and z coordin...
[ "Rotate", "the", "matrix", "by", "some", "angle", "about", "a", "given", "axis", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L446-L460
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.set_mapping
def set_mapping(self, points1, points2): """ Set to a 3D transformation matrix that maps points1 onto points2. Parameters ---------- points1 : array-like, shape (4, 3) Four starting 3D coordinates. points2 : array-like, shape (4, 3) Four ending 3D coordin...
python
def set_mapping(self, points1, points2): """ Set to a 3D transformation matrix that maps points1 onto points2. Parameters ---------- points1 : array-like, shape (4, 3) Four starting 3D coordinates. points2 : array-like, shape (4, 3) Four ending 3D coordin...
[ "def", "set_mapping", "(", "self", ",", "points1", ",", "points2", ")", ":", "# note: need to transpose because util.functions uses opposite", "# of standard linear algebra order.", "self", ".", "matrix", "=", "transforms", ".", "affine_map", "(", "points1", ",", "points2...
Set to a 3D transformation matrix that maps points1 onto points2. Parameters ---------- points1 : array-like, shape (4, 3) Four starting 3D coordinates. points2 : array-like, shape (4, 3) Four ending 3D coordinates.
[ "Set", "to", "a", "3D", "transformation", "matrix", "that", "maps", "points1", "onto", "points2", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L462-L474
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.set_ortho
def set_ortho(self, l, r, b, t, n, f): """Set ortho transform Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float ...
python
def set_ortho(self, l, r, b, t, n, f): """Set ortho transform Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float ...
[ "def", "set_ortho", "(", "self", ",", "l", ",", "r", ",", "b", ",", "t", ",", "n", ",", "f", ")", ":", "self", ".", "matrix", "=", "transforms", ".", "ortho", "(", "l", ",", "r", ",", "b", ",", "t", ",", "n", ",", "f", ")" ]
Set ortho transform Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float Far.
[ "Set", "ortho", "transform" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L476-L494
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.set_perspective
def set_perspective(self, fov, aspect, near, far): """Set the perspective Parameters ---------- fov : float Field of view. aspect : float Aspect ratio. near : float Near location. far : float Far location. "...
python
def set_perspective(self, fov, aspect, near, far): """Set the perspective Parameters ---------- fov : float Field of view. aspect : float Aspect ratio. near : float Near location. far : float Far location. "...
[ "def", "set_perspective", "(", "self", ",", "fov", ",", "aspect", ",", "near", ",", "far", ")", ":", "self", ".", "matrix", "=", "transforms", ".", "perspective", "(", "fov", ",", "aspect", ",", "near", ",", "far", ")" ]
Set the perspective Parameters ---------- fov : float Field of view. aspect : float Aspect ratio. near : float Near location. far : float Far location.
[ "Set", "the", "perspective" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L516-L530
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py
MatrixTransform.set_frustum
def set_frustum(self, l, r, b, t, n, f): """Set the frustum Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float F...
python
def set_frustum(self, l, r, b, t, n, f): """Set the frustum Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float F...
[ "def", "set_frustum", "(", "self", ",", "l", ",", "r", ",", "b", ",", "t", ",", "n", ",", "f", ")", ":", "self", ".", "matrix", "=", "transforms", ".", "frustum", "(", "l", ",", "r", ",", "b", ",", "t", ",", "n", ",", "f", ")" ]
Set the frustum Parameters ---------- l : float Left. r : float Right. b : float Bottom. t : float Top. n : float Near. f : float Far.
[ "Set", "the", "frustum" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/linear.py#L532-L550
cds-astro/mocpy
mocpy/utils.py
log2_lut
def log2_lut(v): """ See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for computing the log2 of a 32 bit integer using a look up table Parameters ---------- v : int 32 bit integer Returns ------- """ res = np.zeros(v.shape, dtyp...
python
def log2_lut(v): """ See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for computing the log2 of a 32 bit integer using a look up table Parameters ---------- v : int 32 bit integer Returns ------- """ res = np.zeros(v.shape, dtyp...
[ "def", "log2_lut", "(", "v", ")", ":", "res", "=", "np", ".", "zeros", "(", "v", ".", "shape", ",", "dtype", "=", "np", ".", "int32", ")", "tt", "=", "v", ">>", "16", "tt_zero", "=", "(", "tt", "==", "0", ")", "tt_not_zero", "=", "~", "tt_zer...
See `this algo <https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogLookup>`__ for computing the log2 of a 32 bit integer using a look up table Parameters ---------- v : int 32 bit integer Returns -------
[ "See", "this", "algo", "<https", ":", "//", "graphics", ".", "stanford", ".", "edu", "/", "~seander", "/", "bithacks", ".", "html#IntegerLogLookup", ">", "__", "for", "computing", "the", "log2", "of", "a", "32", "bit", "integer", "using", "a", "look", "u...
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L27-L61
cds-astro/mocpy
mocpy/utils.py
uniq2orderipix_lut
def uniq2orderipix_lut(uniq): """ ~30% faster than the method below Parameters ---------- uniq Returns ------- """ order = log2_lut(uniq >> 2) >> 1 ipix = uniq - (1 << (2 * (order + 1))) return order, ipix
python
def uniq2orderipix_lut(uniq): """ ~30% faster than the method below Parameters ---------- uniq Returns ------- """ order = log2_lut(uniq >> 2) >> 1 ipix = uniq - (1 << (2 * (order + 1))) return order, ipix
[ "def", "uniq2orderipix_lut", "(", "uniq", ")", ":", "order", "=", "log2_lut", "(", "uniq", ">>", "2", ")", ">>", "1", "ipix", "=", "uniq", "-", "(", "1", "<<", "(", "2", "*", "(", "order", "+", "1", ")", ")", ")", "return", "order", ",", "ipix"...
~30% faster than the method below Parameters ---------- uniq Returns -------
[ "~30%", "faster", "than", "the", "method", "below", "Parameters", "----------", "uniq" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L64-L77
cds-astro/mocpy
mocpy/utils.py
uniq2orderipix
def uniq2orderipix(uniq): """ convert a HEALPix pixel coded as a NUNIQ number to a (norder, ipix) tuple """ order = ((np.log2(uniq//4)) // 2) order = order.astype(int) ipix = uniq - 4 * (4**order) return order, ipix
python
def uniq2orderipix(uniq): """ convert a HEALPix pixel coded as a NUNIQ number to a (norder, ipix) tuple """ order = ((np.log2(uniq//4)) // 2) order = order.astype(int) ipix = uniq - 4 * (4**order) return order, ipix
[ "def", "uniq2orderipix", "(", "uniq", ")", ":", "order", "=", "(", "(", "np", ".", "log2", "(", "uniq", "//", "4", ")", ")", "//", "2", ")", "order", "=", "order", ".", "astype", "(", "int", ")", "ipix", "=", "uniq", "-", "4", "*", "(", "4", ...
convert a HEALPix pixel coded as a NUNIQ number to a (norder, ipix) tuple
[ "convert", "a", "HEALPix", "pixel", "coded", "as", "a", "NUNIQ", "number", "to", "a", "(", "norder", "ipix", ")", "tuple" ]
train
https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/utils.py#L80-L89
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/_pyopengl2.py
glBufferData
def glBufferData(target, data, usage): """ Data can be numpy array or the size of data to allocate. """ if isinstance(data, int): size = data data = None else: size = data.nbytes GL.glBufferData(target, size, data, usage)
python
def glBufferData(target, data, usage): """ Data can be numpy array or the size of data to allocate. """ if isinstance(data, int): size = data data = None else: size = data.nbytes GL.glBufferData(target, size, data, usage)
[ "def", "glBufferData", "(", "target", ",", "data", ",", "usage", ")", ":", "if", "isinstance", "(", "data", ",", "int", ")", ":", "size", "=", "data", "data", "=", "None", "else", ":", "size", "=", "data", ".", "nbytes", "GL", ".", "glBufferData", ...
Data can be numpy array or the size of data to allocate.
[ "Data", "can", "be", "numpy", "array", "or", "the", "size", "of", "data", "to", "allocate", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/_pyopengl2.py#L22-L30
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/line_plot.py
LinePlotVisual.set_data
def set_data(self, data=None, **kwargs): """Set the line data Parameters ---------- data : array-like The data. **kwargs : dict Keywoard arguments to pass to MarkerVisual and LineVisal. """ if data is None: pos = None e...
python
def set_data(self, data=None, **kwargs): """Set the line data Parameters ---------- data : array-like The data. **kwargs : dict Keywoard arguments to pass to MarkerVisual and LineVisal. """ if data is None: pos = None e...
[ "def", "set_data", "(", "self", ",", "data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "data", "is", "None", ":", "pos", "=", "None", "else", ":", "if", "isinstance", "(", "data", ",", "tuple", ")", ":", "pos", "=", "np", ".", "arra...
Set the line data Parameters ---------- data : array-like The data. **kwargs : dict Keywoard arguments to pass to MarkerVisual and LineVisal.
[ "Set", "the", "line", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/line_plot.py#L72-L128
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/infinite_line.py
InfiniteLineVisual.set_data
def set_data(self, pos=None, color=None): """Set the data Parameters ---------- pos : float Position of the line along the axis. color : list, tuple, or array The color to use when drawing the line. If an array is given, it must be of shape (1...
python
def set_data(self, pos=None, color=None): """Set the data Parameters ---------- pos : float Position of the line along the axis. color : list, tuple, or array The color to use when drawing the line. If an array is given, it must be of shape (1...
[ "def", "set_data", "(", "self", ",", "pos", "=", "None", ",", "color", "=", "None", ")", ":", "if", "pos", "is", "not", "None", ":", "pos", "=", "float", "(", "pos", ")", "xy", "=", "self", ".", "_pos", "if", "self", ".", "_is_vertical", ":", "...
Set the data Parameters ---------- pos : float Position of the line along the axis. color : list, tuple, or array The color to use when drawing the line. If an array is given, it must be of shape (1, 4) and provide one rgba color per vertex.
[ "Set", "the", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/infinite_line.py#L85-L117
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/infinite_line.py
InfiniteLineVisual._compute_bounds
def _compute_bounds(self, axis, view): """Return the (min, max) bounding values of this visual along *axis* in the local coordinate system. """ is_vertical = self._is_vertical pos = self._pos if axis == 0 and is_vertical: return (pos[0, 0], pos[0, 0]) ...
python
def _compute_bounds(self, axis, view): """Return the (min, max) bounding values of this visual along *axis* in the local coordinate system. """ is_vertical = self._is_vertical pos = self._pos if axis == 0 and is_vertical: return (pos[0, 0], pos[0, 0]) ...
[ "def", "_compute_bounds", "(", "self", ",", "axis", ",", "view", ")", ":", "is_vertical", "=", "self", ".", "_is_vertical", "pos", "=", "self", ".", "_pos", "if", "axis", "==", "0", "and", "is_vertical", ":", "return", "(", "pos", "[", "0", ",", "0",...
Return the (min, max) bounding values of this visual along *axis* in the local coordinate system.
[ "Return", "the", "(", "min", "max", ")", "bounding", "values", "of", "this", "visual", "along", "*", "axis", "*", "in", "the", "local", "coordinate", "system", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/infinite_line.py#L130-L141
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/curves.py
curve3_bezier
def curve3_bezier(p1, p2, p3): """ Generate the vertices for a quadratic Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates of th...
python
def curve3_bezier(p1, p2, p3): """ Generate the vertices for a quadratic Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates of th...
[ "def", "curve3_bezier", "(", "p1", ",", "p2", ",", "p3", ")", ":", "x1", ",", "y1", "=", "p1", "x2", ",", "y2", "=", "p2", "x3", ",", "y3", "=", "p3", "points", "=", "[", "]", "_curve3_recursive_bezier", "(", "points", ",", "x1", ",", "y1", ","...
Generate the vertices for a quadratic Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates of the first curve point p3 : array ...
[ "Generate", "the", "vertices", "for", "a", "quadratic", "Bezier", "curve", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/curves.py#L302-L348
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/curves.py
curve4_bezier
def curve4_bezier(p1, p2, p3, p4): """ Generate the vertices for a third order Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates...
python
def curve4_bezier(p1, p2, p3, p4): """ Generate the vertices for a third order Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates...
[ "def", "curve4_bezier", "(", "p1", ",", "p2", ",", "p3", ",", "p4", ")", ":", "x1", ",", "y1", "=", "p1", "x2", ",", "y2", "=", "p2", "x3", ",", "y3", "=", "p3", "x4", ",", "y4", "=", "p4", "points", "=", "[", "]", "_curve4_recursive_bezier", ...
Generate the vertices for a third order Bezier curve. The vertices returned by this function can be passed to a LineVisual or ArrowVisual. Parameters ---------- p1 : array 2D coordinates of the start point p2 : array 2D coordinates of the first curve point p3 : array ...
[ "Generate", "the", "vertices", "for", "a", "third", "order", "Bezier", "curve", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/curves.py#L351-L399
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py
SDFRenderer.render_to_texture
def render_to_texture(self, data, texture, offset, size): """Render a SDF to a texture at a given offset and size Parameters ---------- data : array Must be 2D with type np.ubyte. texture : instance of Texture2D The texture to render to. offset : ...
python
def render_to_texture(self, data, texture, offset, size): """Render a SDF to a texture at a given offset and size Parameters ---------- data : array Must be 2D with type np.ubyte. texture : instance of Texture2D The texture to render to. offset : ...
[ "def", "render_to_texture", "(", "self", ",", "data", ",", "texture", ",", "offset", ",", "size", ")", ":", "assert", "isinstance", "(", "texture", ",", "Texture2D", ")", "set_state", "(", "blend", "=", "False", ",", "depth_test", "=", "False", ")", "# c...
Render a SDF to a texture at a given offset and size Parameters ---------- data : array Must be 2D with type np.ubyte. texture : instance of Texture2D The texture to render to. offset : tuple of int Offset (x, y) to render to inside the textur...
[ "Render", "a", "SDF", "to", "a", "texture", "at", "a", "given", "offset", "and", "size" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py#L252-L286
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py
SDFRenderer._render_edf
def _render_edf(self, orig_tex): """Render an EDF to a texture""" # Set up the necessary textures sdf_size = orig_tex.shape[:2] comp_texs = [] for _ in range(2): tex = Texture2D(sdf_size + (4,), format='rgba', interpolation='nearest', wrap...
python
def _render_edf(self, orig_tex): """Render an EDF to a texture""" # Set up the necessary textures sdf_size = orig_tex.shape[:2] comp_texs = [] for _ in range(2): tex = Texture2D(sdf_size + (4,), format='rgba', interpolation='nearest', wrap...
[ "def", "_render_edf", "(", "self", ",", "orig_tex", ")", ":", "# Set up the necessary textures", "sdf_size", "=", "orig_tex", ".", "shape", "[", ":", "2", "]", "comp_texs", "=", "[", "]", "for", "_", "in", "range", "(", "2", ")", ":", "tex", "=", "Text...
Render an EDF to a texture
[ "Render", "an", "EDF", "to", "a", "texture" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py#L288-L318
anjishnu/ask-alexa-pykit
ask/intent_schema.py
IntentSchema._add_intent_interactive
def _add_intent_interactive(self, intent_num=0): ''' Interactively add a new intent to the intent schema object ''' print ("Name of intent number : ", intent_num) slot_type_mappings = load_builtin_slots() intent_name = read_from_user(str) print ("How many...
python
def _add_intent_interactive(self, intent_num=0): ''' Interactively add a new intent to the intent schema object ''' print ("Name of intent number : ", intent_num) slot_type_mappings = load_builtin_slots() intent_name = read_from_user(str) print ("How many...
[ "def", "_add_intent_interactive", "(", "self", ",", "intent_num", "=", "0", ")", ":", "print", "(", "\"Name of intent number : \"", ",", "intent_num", ")", "slot_type_mappings", "=", "load_builtin_slots", "(", ")", "intent_name", "=", "read_from_user", "(", "str", ...
Interactively add a new intent to the intent schema object
[ "Interactively", "add", "a", "new", "intent", "to", "the", "intent", "schema", "object" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/intent_schema.py#L65-L85
anjishnu/ask-alexa-pykit
ask/intent_schema.py
IntentSchema.from_filename
def from_filename(self, filename): ''' Build an IntentSchema from a file path creates a new intent schema if the file does not exist, throws an error if the file exists but cannot be loaded as a JSON ''' if os.path.exists(filename): with open(filename) as fp:...
python
def from_filename(self, filename): ''' Build an IntentSchema from a file path creates a new intent schema if the file does not exist, throws an error if the file exists but cannot be loaded as a JSON ''' if os.path.exists(filename): with open(filename) as fp:...
[ "def", "from_filename", "(", "self", ",", "filename", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "fp", ":", "return", "IntentSchema", "(", "json", ".", "load", "(", "fp", ...
Build an IntentSchema from a file path creates a new intent schema if the file does not exist, throws an error if the file exists but cannot be loaded as a JSON
[ "Build", "an", "IntentSchema", "from", "a", "file", "path", "creates", "a", "new", "intent", "schema", "if", "the", "file", "does", "not", "exist", "throws", "an", "error", "if", "the", "file", "exists", "but", "cannot", "be", "loaded", "as", "a", "JSON"...
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/intent_schema.py#L89-L100
anjishnu/ask-alexa-pykit
examples/twitter/lambda_function.py
launch_request_handler
def launch_request_handler(request): """ Annotate functions with @VoiceHandler so that they can be automatically mapped to request types. Use the 'request_type' field to map them to non-intent requests """ user_id = request.access_token() if user_id in twitter_cache.users(): user_cache = twit...
python
def launch_request_handler(request): """ Annotate functions with @VoiceHandler so that they can be automatically mapped to request types. Use the 'request_type' field to map them to non-intent requests """ user_id = request.access_token() if user_id in twitter_cache.users(): user_cache = twit...
[ "def", "launch_request_handler", "(", "request", ")", ":", "user_id", "=", "request", ".", "access_token", "(", ")", "if", "user_id", "in", "twitter_cache", ".", "users", "(", ")", ":", "user_cache", "=", "twitter_cache", ".", "get_user_state", "(", "user_id",...
Annotate functions with @VoiceHandler so that they can be automatically mapped to request types. Use the 'request_type' field to map them to non-intent requests
[ "Annotate", "functions", "with" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L23-L45
anjishnu/ask-alexa-pykit
examples/twitter/lambda_function.py
post_tweet_intent_handler
def post_tweet_intent_handler(request): """ Use the 'intent' field in the VoiceHandler to map to the respective intent. """ tweet = request.get_slot_value("Tweet") tweet = tweet if tweet else "" if tweet: user_state = twitter_cache.get_user_state(request.access_token()) def a...
python
def post_tweet_intent_handler(request): """ Use the 'intent' field in the VoiceHandler to map to the respective intent. """ tweet = request.get_slot_value("Tweet") tweet = tweet if tweet else "" if tweet: user_state = twitter_cache.get_user_state(request.access_token()) def a...
[ "def", "post_tweet_intent_handler", "(", "request", ")", ":", "tweet", "=", "request", ".", "get_slot_value", "(", "\"Tweet\"", ")", "tweet", "=", "tweet", "if", "tweet", "else", "\"\"", "if", "tweet", ":", "user_state", "=", "twitter_cache", ".", "get_user_st...
Use the 'intent' field in the VoiceHandler to map to the respective intent.
[ "Use", "the", "intent", "field", "in", "the", "VoiceHandler", "to", "map", "to", "the", "respective", "intent", "." ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L54-L77
anjishnu/ask-alexa-pykit
examples/twitter/lambda_function.py
tweet_list_handler
def tweet_list_handler(request, tweet_list_builder, msg_prefix=""): """ This is a generic function to handle any intent that reads out a list of tweets""" # tweet_list_builder is a function that takes a unique identifier and returns a list of things to say tweets = tweet_list_builder(request.access_token()...
python
def tweet_list_handler(request, tweet_list_builder, msg_prefix=""): """ This is a generic function to handle any intent that reads out a list of tweets""" # tweet_list_builder is a function that takes a unique identifier and returns a list of things to say tweets = tweet_list_builder(request.access_token()...
[ "def", "tweet_list_handler", "(", "request", ",", "tweet_list_builder", ",", "msg_prefix", "=", "\"\"", ")", ":", "# tweet_list_builder is a function that takes a unique identifier and returns a list of things to say", "tweets", "=", "tweet_list_builder", "(", "request", ".", "...
This is a generic function to handle any intent that reads out a list of tweets
[ "This", "is", "a", "generic", "function", "to", "handle", "any", "intent", "that", "reads", "out", "a", "list", "of", "tweets" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L137-L152
anjishnu/ask-alexa-pykit
examples/twitter/lambda_function.py
focused_on_tweet
def focused_on_tweet(request): """ Return index if focused on tweet False if couldn't """ slots = request.get_slot_map() if "Index" in slots and slots["Index"]: index = int(slots['Index']) elif "Ordinal" in slots and slots["Index"]: parse_ordinal = lambda inp : int("".join([l fo...
python
def focused_on_tweet(request): """ Return index if focused on tweet False if couldn't """ slots = request.get_slot_map() if "Index" in slots and slots["Index"]: index = int(slots['Index']) elif "Ordinal" in slots and slots["Index"]: parse_ordinal = lambda inp : int("".join([l fo...
[ "def", "focused_on_tweet", "(", "request", ")", ":", "slots", "=", "request", ".", "get_slot_map", "(", ")", "if", "\"Index\"", "in", "slots", "and", "slots", "[", "\"Index\"", "]", ":", "index", "=", "int", "(", "slots", "[", "'Index'", "]", ")", "eli...
Return index if focused on tweet False if couldn't
[ "Return", "index", "if", "focused", "on", "tweet", "False", "if", "couldn", "t" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L198-L221
anjishnu/ask-alexa-pykit
examples/twitter/lambda_function.py
next_intent_handler
def next_intent_handler(request): """ Takes care of things whenver the user says 'next' """ message = "Sorry, couldn't find anything in your next queue" end_session = True if True: user_queue = twitter_cache.user_queue(request.access_token()) if not user_queue.is_finished(): ...
python
def next_intent_handler(request): """ Takes care of things whenver the user says 'next' """ message = "Sorry, couldn't find anything in your next queue" end_session = True if True: user_queue = twitter_cache.user_queue(request.access_token()) if not user_queue.is_finished(): ...
[ "def", "next_intent_handler", "(", "request", ")", ":", "message", "=", "\"Sorry, couldn't find anything in your next queue\"", "end_session", "=", "True", "if", "True", ":", "user_queue", "=", "twitter_cache", ".", "user_queue", "(", "request", ".", "access_token", "...
Takes care of things whenver the user says 'next'
[ "Takes", "care", "of", "things", "whenver", "the", "user", "says", "next" ]
train
https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L322-L337
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/app/_default_app.py
use_app
def use_app(backend_name=None, call_reuse=True): """ Get/create the default Application object It is safe to call this function multiple times, as long as backend_name is None or matches the already selected backend. Parameters ---------- backend_name : str | None The name of the backe...
python
def use_app(backend_name=None, call_reuse=True): """ Get/create the default Application object It is safe to call this function multiple times, as long as backend_name is None or matches the already selected backend. Parameters ---------- backend_name : str | None The name of the backe...
[ "def", "use_app", "(", "backend_name", "=", "None", ",", "call_reuse", "=", "True", ")", ":", "global", "default_app", "# If we already have a default_app, raise error or return", "if", "default_app", "is", "not", "None", ":", "names", "=", "default_app", ".", "back...
Get/create the default Application object It is safe to call this function multiple times, as long as backend_name is None or matches the already selected backend. Parameters ---------- backend_name : str | None The name of the backend application to use. If not specified, Vispy tr...
[ "Get", "/", "create", "the", "default", "Application", "object" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/_default_app.py#L13-L48
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/gloo/gl/_es2.py
glBufferData
def glBufferData(target, data, usage): """ Data can be numpy array or the size of data to allocate. """ if isinstance(data, int): size = data data = ctypes.c_voidp(0) else: if not data.flags['C_CONTIGUOUS'] or not data.flags['ALIGNED']: data = data.copy('C') d...
python
def glBufferData(target, data, usage): """ Data can be numpy array or the size of data to allocate. """ if isinstance(data, int): size = data data = ctypes.c_voidp(0) else: if not data.flags['C_CONTIGUOUS'] or not data.flags['ALIGNED']: data = data.copy('C') d...
[ "def", "glBufferData", "(", "target", ",", "data", ",", "usage", ")", ":", "if", "isinstance", "(", "data", ",", "int", ")", ":", "size", "=", "data", "data", "=", "ctypes", ".", "c_voidp", "(", "0", ")", "else", ":", "if", "not", "data", ".", "f...
Data can be numpy array or the size of data to allocate.
[ "Data", "can", "be", "numpy", "array", "or", "the", "size", "of", "data", "to", "allocate", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/_es2.py#L88-L100
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/mesh.py
MeshVisual.set_data
def set_data(self, vertices=None, faces=None, vertex_colors=None, face_colors=None, color=None, meshdata=None): """Set the mesh data Parameters ---------- vertices : array-like | None The vertices. faces : array-like | None The faces. ...
python
def set_data(self, vertices=None, faces=None, vertex_colors=None, face_colors=None, color=None, meshdata=None): """Set the mesh data Parameters ---------- vertices : array-like | None The vertices. faces : array-like | None The faces. ...
[ "def", "set_data", "(", "self", ",", "vertices", "=", "None", ",", "faces", "=", "None", ",", "vertex_colors", "=", "None", ",", "face_colors", "=", "None", ",", "color", "=", "None", ",", "meshdata", "=", "None", ")", ":", "if", "meshdata", "is", "n...
Set the mesh data Parameters ---------- vertices : array-like | None The vertices. faces : array-like | None The faces. vertex_colors : array-like | None Colors to use for each vertex. face_colors : array-like | None Colors...
[ "Set", "the", "mesh", "data" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/mesh.py#L212-L240
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
BaseVisual.bounds
def bounds(self, axis, view=None): """Get the bounds of the Visual Parameters ---------- axis : int The axis. view : instance of VisualView The view to use. """ if view is None: view = self if axis not in self._vshare.b...
python
def bounds(self, axis, view=None): """Get the bounds of the Visual Parameters ---------- axis : int The axis. view : instance of VisualView The view to use. """ if view is None: view = self if axis not in self._vshare.b...
[ "def", "bounds", "(", "self", ",", "axis", ",", "view", "=", "None", ")", ":", "if", "view", "is", "None", ":", "view", "=", "self", "if", "axis", "not", "in", "self", ".", "_vshare", ".", "bounds", ":", "self", ".", "_vshare", ".", "bounds", "["...
Get the bounds of the Visual Parameters ---------- axis : int The axis. view : instance of VisualView The view to use.
[ "Get", "the", "bounds", "of", "the", "Visual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L238-L252
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
Visual.set_gl_state
def set_gl_state(self, preset=None, **kwargs): """Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`. """ self._vshare.gl_state ...
python
def set_gl_state(self, preset=None, **kwargs): """Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`. """ self._vshare.gl_state ...
[ "def", "set_gl_state", "(", "self", ",", "preset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_vshare", ".", "gl_state", "=", "kwargs", "self", ".", "_vshare", ".", "gl_state", "[", "'preset'", "]", "=", "preset" ]
Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`.
[ "Define", "the", "set", "of", "GL", "state", "parameters", "to", "use", "when", "drawing" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L338-L349
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
Visual.update_gl_state
def update_gl_state(self, *args, **kwargs): """Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments. """ if len(args) == 1: self._vshare.gl_st...
python
def update_gl_state(self, *args, **kwargs): """Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments. """ if len(args) == 1: self._vshare.gl_st...
[ "def", "update_gl_state", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "1", ":", "self", ".", "_vshare", ".", "gl_state", "[", "'preset'", "]", "=", "args", "[", "0", "]", "elif", "len", ...
Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments.
[ "Modify", "the", "set", "of", "GL", "state", "parameters", "to", "use", "when", "drawing" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L351-L365
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
Visual._get_hook
def _get_hook(self, shader, name): """Return a FunctionChain that Filters may use to modify the program. *shader* should be "frag" or "vert" *name* should be "pre" or "post" """ assert name in ('pre', 'post') key = (shader, name) if key in self._hooks: ...
python
def _get_hook(self, shader, name): """Return a FunctionChain that Filters may use to modify the program. *shader* should be "frag" or "vert" *name* should be "pre" or "post" """ assert name in ('pre', 'post') key = (shader, name) if key in self._hooks: ...
[ "def", "_get_hook", "(", "self", ",", "shader", ",", "name", ")", ":", "assert", "name", "in", "(", "'pre'", ",", "'post'", ")", "key", "=", "(", "shader", ",", "name", ")", "if", "key", "in", "self", ".", "_hooks", ":", "return", "self", ".", "_...
Return a FunctionChain that Filters may use to modify the program. *shader* should be "frag" or "vert" *name* should be "pre" or "post"
[ "Return", "a", "FunctionChain", "that", "Filters", "may", "use", "to", "modify", "the", "program", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L448-L464
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
Visual.attach
def attach(self, filt, view=None): """Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use. ...
python
def attach(self, filt, view=None): """Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use. ...
[ "def", "attach", "(", "self", ",", "filt", ",", "view", "=", "None", ")", ":", "if", "view", "is", "None", ":", "self", ".", "_vshare", ".", "filters", ".", "append", "(", "filt", ")", "for", "view", "in", "self", ".", "_vshare", ".", "views", "....
Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use.
[ "Attach", "a", "Filter", "to", "this", "visual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L466-L484
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
Visual.detach
def detach(self, filt, view=None): """Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use. """ if view is None: self._vshare.filters.remove(filt) ...
python
def detach(self, filt, view=None): """Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use. """ if view is None: self._vshare.filters.remove(filt) ...
[ "def", "detach", "(", "self", ",", "filt", ",", "view", "=", "None", ")", ":", "if", "view", "is", "None", ":", "self", ".", "_vshare", ".", "filters", ".", "remove", "(", "filt", ")", "for", "view", "in", "self", ".", "_vshare", ".", "views", "....
Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use.
[ "Detach", "a", "filter", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L486-L502
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.add_subvisual
def add_subvisual(self, visual): """Add a subvisual Parameters ---------- visual : instance of Visual The visual to add. """ visual.transforms = self.transforms visual._prepare_transforms(visual) self._subvisuals.append(visual) visual....
python
def add_subvisual(self, visual): """Add a subvisual Parameters ---------- visual : instance of Visual The visual to add. """ visual.transforms = self.transforms visual._prepare_transforms(visual) self._subvisuals.append(visual) visual....
[ "def", "add_subvisual", "(", "self", ",", "visual", ")", ":", "visual", ".", "transforms", "=", "self", ".", "transforms", "visual", ".", "_prepare_transforms", "(", "visual", ")", "self", ".", "_subvisuals", ".", "append", "(", "visual", ")", "visual", "....
Add a subvisual Parameters ---------- visual : instance of Visual The visual to add.
[ "Add", "a", "subvisual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L544-L556
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.remove_subvisual
def remove_subvisual(self, visual): """Remove a subvisual Parameters ---------- visual : instance of Visual The visual to remove. """ visual.events.update.disconnect(self._subv_update) self._subvisuals.remove(visual) self.update()
python
def remove_subvisual(self, visual): """Remove a subvisual Parameters ---------- visual : instance of Visual The visual to remove. """ visual.events.update.disconnect(self._subv_update) self._subvisuals.remove(visual) self.update()
[ "def", "remove_subvisual", "(", "self", ",", "visual", ")", ":", "visual", ".", "events", ".", "update", ".", "disconnect", "(", "self", ".", "_subv_update", ")", "self", ".", "_subvisuals", ".", "remove", "(", "visual", ")", "self", ".", "update", "(", ...
Remove a subvisual Parameters ---------- visual : instance of Visual The visual to remove.
[ "Remove", "a", "subvisual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L558-L568
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.draw
def draw(self): """Draw the visual """ if not self.visible: return if self._prepare_draw(view=self) is False: return for v in self._subvisuals: if v.visible: v.draw()
python
def draw(self): """Draw the visual """ if not self.visible: return if self._prepare_draw(view=self) is False: return for v in self._subvisuals: if v.visible: v.draw()
[ "def", "draw", "(", "self", ")", ":", "if", "not", "self", ".", "visible", ":", "return", "if", "self", ".", "_prepare_draw", "(", "view", "=", "self", ")", "is", "False", ":", "return", "for", "v", "in", "self", ".", "_subvisuals", ":", "if", "v",...
Draw the visual
[ "Draw", "the", "visual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L578-L588
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.set_gl_state
def set_gl_state(self, preset=None, **kwargs): """Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`. """ for v in self._subvisu...
python
def set_gl_state(self, preset=None, **kwargs): """Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`. """ for v in self._subvisu...
[ "def", "set_gl_state", "(", "self", ",", "preset", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "v", "in", "self", ".", "_subvisuals", ":", "v", ".", "set_gl_state", "(", "preset", "=", "preset", ",", "*", "*", "kwargs", ")" ]
Define the set of GL state parameters to use when drawing Parameters ---------- preset : str Preset to use. **kwargs : dict Keyword arguments to `gloo.set_state`.
[ "Define", "the", "set", "of", "GL", "state", "parameters", "to", "use", "when", "drawing" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L597-L608
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.update_gl_state
def update_gl_state(self, *args, **kwargs): """Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments. """ for v in self._subvisuals: v.update_g...
python
def update_gl_state(self, *args, **kwargs): """Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments. """ for v in self._subvisuals: v.update_g...
[ "def", "update_gl_state", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "v", "in", "self", ".", "_subvisuals", ":", "v", ".", "update_gl_state", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
Modify the set of GL state parameters to use when drawing Parameters ---------- *args : tuple Arguments. **kwargs : dict Keyword argments.
[ "Modify", "the", "set", "of", "GL", "state", "parameters", "to", "use", "when", "drawing" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L610-L621
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.attach
def attach(self, filt, view=None): """Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use. ...
python
def attach(self, filt, view=None): """Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use. ...
[ "def", "attach", "(", "self", ",", "filt", ",", "view", "=", "None", ")", ":", "for", "v", "in", "self", ".", "_subvisuals", ":", "v", ".", "attach", "(", "filt", ",", "v", ")" ]
Attach a Filter to this visual Each filter modifies the appearance or behavior of the visual. Parameters ---------- filt : object The filter to attach. view : instance of VisualView | None The view to use.
[ "Attach", "a", "Filter", "to", "this", "visual" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L623-L636
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/visual.py
CompoundVisual.detach
def detach(self, filt, view=None): """Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use. """ for v in self._subvisuals: v.detach(filt, v)
python
def detach(self, filt, view=None): """Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use. """ for v in self._subvisuals: v.detach(filt, v)
[ "def", "detach", "(", "self", ",", "filt", ",", "view", "=", "None", ")", ":", "for", "v", "in", "self", ".", "_subvisuals", ":", "v", ".", "detach", "(", "filt", ",", "v", ")" ]
Detach a filter. Parameters ---------- filt : object The filter to detach. view : instance of VisualView | None The view to use.
[ "Detach", "a", "filter", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L638-L649
federico123579/Trading212-API
tradingAPI/api.py
API.addMov
def addMov(self, product, quantity=None, mode="buy", stop_limit=None, auto_margin=None, name_counter=None): """main function for placing movements stop_limit = {'gain': [mode, value], 'loss': [mode, value]}""" # ~ ARGS ~ if (not isinstance(product, type('')) or ...
python
def addMov(self, product, quantity=None, mode="buy", stop_limit=None, auto_margin=None, name_counter=None): """main function for placing movements stop_limit = {'gain': [mode, value], 'loss': [mode, value]}""" # ~ ARGS ~ if (not isinstance(product, type('')) or ...
[ "def", "addMov", "(", "self", ",", "product", ",", "quantity", "=", "None", ",", "mode", "=", "\"buy\"", ",", "stop_limit", "=", "None", ",", "auto_margin", "=", "None", ",", "name_counter", "=", "None", ")", ":", "# ~ ARGS ~", "if", "(", "not", "isins...
main function for placing movements stop_limit = {'gain': [mode, value], 'loss': [mode, value]}
[ "main", "function", "for", "placing", "movements", "stop_limit", "=", "{", "gain", ":", "[", "mode", "value", "]", "loss", ":", "[", "mode", "value", "]", "}" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L20-L72
federico123579/Trading212-API
tradingAPI/api.py
API.checkPos
def checkPos(self): """check all positions""" soup = BeautifulSoup(self.css1(path['movs-table']).html, 'html.parser') poss = [] for label in soup.find_all("tr"): pos_id = label['id'] # init an empty list # check if it already exist pos_list...
python
def checkPos(self): """check all positions""" soup = BeautifulSoup(self.css1(path['movs-table']).html, 'html.parser') poss = [] for label in soup.find_all("tr"): pos_id = label['id'] # init an empty list # check if it already exist pos_list...
[ "def", "checkPos", "(", "self", ")", ":", "soup", "=", "BeautifulSoup", "(", "self", ".", "css1", "(", "path", "[", "'movs-table'", "]", ")", ".", "html", ",", "'html.parser'", ")", "poss", "=", "[", "]", "for", "label", "in", "soup", ".", "find_all"...
check all positions
[ "check", "all", "positions" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L76-L97
federico123579/Trading212-API
tradingAPI/api.py
API.checkStock
def checkStock(self): """check stocks in preference""" if not self.preferences: logger.debug("no preferences") return None soup = BeautifulSoup( self.xpath(path['stock-table'])[0].html, "html.parser") count = 0 # iterate through product in left...
python
def checkStock(self): """check stocks in preference""" if not self.preferences: logger.debug("no preferences") return None soup = BeautifulSoup( self.xpath(path['stock-table'])[0].html, "html.parser") count = 0 # iterate through product in left...
[ "def", "checkStock", "(", "self", ")", ":", "if", "not", "self", ".", "preferences", ":", "logger", ".", "debug", "(", "\"no preferences\"", ")", "return", "None", "soup", "=", "BeautifulSoup", "(", "self", ".", "xpath", "(", "path", "[", "'stock-table'", ...
check stocks in preference
[ "check", "stocks", "in", "preference" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L99-L129
federico123579/Trading212-API
tradingAPI/api.py
API.clearPrefs
def clearPrefs(self): """clear the left panel and preferences""" self.preferences.clear() tradebox_num = len(self.css('div.tradebox')) for i in range(tradebox_num): self.xpath(path['trade-box'])[0].right_click() self.css1('div.item-trade-contextmenu-list-remove')....
python
def clearPrefs(self): """clear the left panel and preferences""" self.preferences.clear() tradebox_num = len(self.css('div.tradebox')) for i in range(tradebox_num): self.xpath(path['trade-box'])[0].right_click() self.css1('div.item-trade-contextmenu-list-remove')....
[ "def", "clearPrefs", "(", "self", ")", ":", "self", ".", "preferences", ".", "clear", "(", ")", "tradebox_num", "=", "len", "(", "self", ".", "css", "(", "'div.tradebox'", ")", ")", "for", "i", "in", "range", "(", "tradebox_num", ")", ":", "self", "....
clear the left panel and preferences
[ "clear", "the", "left", "panel", "and", "preferences" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L134-L141
federico123579/Trading212-API
tradingAPI/api.py
API.addPrefs
def addPrefs(self, prefs=[]): """add preference in self.preferences""" if len(prefs) == len(self.preferences) == 0: logger.debug("no preferences") return None self.preferences.extend(prefs) self.css1(path['search-btn']).click() count = 0 for pref i...
python
def addPrefs(self, prefs=[]): """add preference in self.preferences""" if len(prefs) == len(self.preferences) == 0: logger.debug("no preferences") return None self.preferences.extend(prefs) self.css1(path['search-btn']).click() count = 0 for pref i...
[ "def", "addPrefs", "(", "self", ",", "prefs", "=", "[", "]", ")", ":", "if", "len", "(", "prefs", ")", "==", "len", "(", "self", ".", "preferences", ")", "==", "0", ":", "logger", ".", "debug", "(", "\"no preferences\"", ")", "return", "None", "sel...
add preference in self.preferences
[ "add", "preference", "in", "self", ".", "preferences" ]
train
https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L143-L164
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/util/fonts/_freetype.py
_load_glyph
def _load_glyph(f, char, glyphs_dict): """Load glyph from font into dict""" from ...ext.freetype import (FT_LOAD_RENDER, FT_LOAD_NO_HINTING, FT_LOAD_NO_AUTOHINT) flags = FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT face = _load_font(f['face'], f['bold'], f['...
python
def _load_glyph(f, char, glyphs_dict): """Load glyph from font into dict""" from ...ext.freetype import (FT_LOAD_RENDER, FT_LOAD_NO_HINTING, FT_LOAD_NO_AUTOHINT) flags = FT_LOAD_RENDER | FT_LOAD_NO_HINTING | FT_LOAD_NO_AUTOHINT face = _load_font(f['face'], f['bold'], f['...
[ "def", "_load_glyph", "(", "f", ",", "char", ",", "glyphs_dict", ")", ":", "from", ".", ".", ".", "ext", ".", "freetype", "import", "(", "FT_LOAD_RENDER", ",", "FT_LOAD_NO_HINTING", ",", "FT_LOAD_NO_AUTOHINT", ")", "flags", "=", "FT_LOAD_RENDER", "|", "FT_LO...
Load glyph from font into dict
[ "Load", "glyph", "from", "font", "into", "dict" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_freetype.py#L45-L73
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/visuals.py
VisualNode._set_clipper
def _set_clipper(self, node, clipper): """Assign a clipper that is inherited from a parent node. If *clipper* is None, then remove any clippers for *node*. """ if node in self._clippers: self.detach(self._clippers.pop(node)) if clipper is not None: self.a...
python
def _set_clipper(self, node, clipper): """Assign a clipper that is inherited from a parent node. If *clipper* is None, then remove any clippers for *node*. """ if node in self._clippers: self.detach(self._clippers.pop(node)) if clipper is not None: self.a...
[ "def", "_set_clipper", "(", "self", ",", "node", ",", "clipper", ")", ":", "if", "node", "in", "self", ".", "_clippers", ":", "self", ".", "detach", "(", "self", ".", "_clippers", ".", "pop", "(", "node", ")", ")", "if", "clipper", "is", "not", "No...
Assign a clipper that is inherited from a parent node. If *clipper* is None, then remove any clippers for *node*.
[ "Assign", "a", "clipper", "that", "is", "inherited", "from", "a", "parent", "node", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/visuals.py#L43-L52
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/scene/visuals.py
VisualNode._update_trsys
def _update_trsys(self, event): """Transform object(s) have changed for this Node; assign these to the visual's TransformSystem. """ doc = self.document_node scene = self.scene_node root = self.root_node self.transforms.visual_transform = self.node_transform(scene...
python
def _update_trsys(self, event): """Transform object(s) have changed for this Node; assign these to the visual's TransformSystem. """ doc = self.document_node scene = self.scene_node root = self.root_node self.transforms.visual_transform = self.node_transform(scene...
[ "def", "_update_trsys", "(", "self", ",", "event", ")", ":", "doc", "=", "self", ".", "document_node", "scene", "=", "self", ".", "scene_node", "root", "=", "self", ".", "root_node", "self", ".", "transforms", ".", "visual_transform", "=", "self", ".", "...
Transform object(s) have changed for this Node; assign these to the visual's TransformSystem.
[ "Transform", "object", "(", "s", ")", "have", "changed", "for", "this", "Node", ";", "assign", "these", "to", "the", "visual", "s", "TransformSystem", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/visuals.py#L71-L82
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
cfnumber_to_number
def cfnumber_to_number(cfnumber): """Convert CFNumber to python int or float.""" numeric_type = cf.CFNumberGetType(cfnumber) cfnum_to_ctype = {kCFNumberSInt8Type: c_int8, kCFNumberSInt16Type: c_int16, kCFNumberSInt32Type: c_int32, kCFNumberSInt64Type: c_int64, ...
python
def cfnumber_to_number(cfnumber): """Convert CFNumber to python int or float.""" numeric_type = cf.CFNumberGetType(cfnumber) cfnum_to_ctype = {kCFNumberSInt8Type: c_int8, kCFNumberSInt16Type: c_int16, kCFNumberSInt32Type: c_int32, kCFNumberSInt64Type: c_int64, ...
[ "def", "cfnumber_to_number", "(", "cfnumber", ")", ":", "numeric_type", "=", "cf", ".", "CFNumberGetType", "(", "cfnumber", ")", "cfnum_to_ctype", "=", "{", "kCFNumberSInt8Type", ":", "c_int8", ",", "kCFNumberSInt16Type", ":", "c_int16", ",", "kCFNumberSInt32Type", ...
Convert CFNumber to python int or float.
[ "Convert", "CFNumber", "to", "python", "int", "or", "float", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1032-L1055
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
cftype_to_value
def cftype_to_value(cftype): """Convert a CFType into an equivalent python type. The convertible CFTypes are taken from the known_cftypes dictionary, which may be added to if another library implements its own conversion methods.""" if not cftype: return None typeID = cf.CFGetTypeID(cfty...
python
def cftype_to_value(cftype): """Convert a CFType into an equivalent python type. The convertible CFTypes are taken from the known_cftypes dictionary, which may be added to if another library implements its own conversion methods.""" if not cftype: return None typeID = cf.CFGetTypeID(cfty...
[ "def", "cftype_to_value", "(", "cftype", ")", ":", "if", "not", "cftype", ":", "return", "None", "typeID", "=", "cf", ".", "CFGetTypeID", "(", "cftype", ")", "if", "typeID", "in", "known_cftypes", ":", "convert_function", "=", "known_cftypes", "[", "typeID",...
Convert a CFType into an equivalent python type. The convertible CFTypes are taken from the known_cftypes dictionary, which may be added to if another library implements its own conversion methods.
[ "Convert", "a", "CFType", "into", "an", "equivalent", "python", "type", ".", "The", "convertible", "CFTypes", "are", "taken", "from", "the", "known_cftypes", "dictionary", "which", "may", "be", "added", "to", "if", "another", "library", "implements", "its", "o...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1062-L1074
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
cfset_to_set
def cfset_to_set(cfset): """Convert CFSet to python set.""" count = cf.CFSetGetCount(cfset) buffer = (c_void_p * count)() cf.CFSetGetValues(cfset, byref(buffer)) return set([cftype_to_value(c_void_p(buffer[i])) for i in range(count)])
python
def cfset_to_set(cfset): """Convert CFSet to python set.""" count = cf.CFSetGetCount(cfset) buffer = (c_void_p * count)() cf.CFSetGetValues(cfset, byref(buffer)) return set([cftype_to_value(c_void_p(buffer[i])) for i in range(count)])
[ "def", "cfset_to_set", "(", "cfset", ")", ":", "count", "=", "cf", ".", "CFSetGetCount", "(", "cfset", ")", "buffer", "=", "(", "c_void_p", "*", "count", ")", "(", ")", "cf", ".", "CFSetGetValues", "(", "cfset", ",", "byref", "(", "buffer", ")", ")",...
Convert CFSet to python set.
[ "Convert", "CFSet", "to", "python", "set", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1085-L1090
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
cfarray_to_list
def cfarray_to_list(cfarray): """Convert CFArray to python list.""" count = cf.CFArrayGetCount(cfarray) return [cftype_to_value(c_void_p(cf.CFArrayGetValueAtIndex(cfarray, i))) for i in range(count)]
python
def cfarray_to_list(cfarray): """Convert CFArray to python list.""" count = cf.CFArrayGetCount(cfarray) return [cftype_to_value(c_void_p(cf.CFArrayGetValueAtIndex(cfarray, i))) for i in range(count)]
[ "def", "cfarray_to_list", "(", "cfarray", ")", ":", "count", "=", "cf", ".", "CFArrayGetCount", "(", "cfarray", ")", "return", "[", "cftype_to_value", "(", "c_void_p", "(", "cf", ".", "CFArrayGetValueAtIndex", "(", "cfarray", ",", "i", ")", ")", ")", "for"...
Convert CFArray to python list.
[ "Convert", "CFArray", "to", "python", "list", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1099-L1103
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
ObjCMethod.ctype_for_encoding
def ctype_for_encoding(self, encoding): """Return ctypes type for an encoded Objective-C type.""" if encoding in self.typecodes: return self.typecodes[encoding] elif encoding[0:1] == b'^' and encoding[1:] in self.typecodes: return POINTER(self.typecodes[encoding[1:]]) ...
python
def ctype_for_encoding(self, encoding): """Return ctypes type for an encoded Objective-C type.""" if encoding in self.typecodes: return self.typecodes[encoding] elif encoding[0:1] == b'^' and encoding[1:] in self.typecodes: return POINTER(self.typecodes[encoding[1:]]) ...
[ "def", "ctype_for_encoding", "(", "self", ",", "encoding", ")", ":", "if", "encoding", "in", "self", ".", "typecodes", ":", "return", "self", ".", "typecodes", "[", "encoding", "]", "elif", "encoding", "[", "0", ":", "1", "]", "==", "b'^'", "and", "enc...
Return ctypes type for an encoded Objective-C type.
[ "Return", "ctypes", "type", "for", "an", "encoded", "Objective", "-", "C", "type", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L595-L610
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/cocoapy.py
ObjCSubclass.classmethod
def classmethod(self, encoding): """Function decorator for class methods.""" # Add encodings for hidden self and cmd arguments. encoding = ensure_bytes(encoding) typecodes = parse_type_encoding(encoding) typecodes.insert(1, b'@:') encoding = b''.join(typecodes) d...
python
def classmethod(self, encoding): """Function decorator for class methods.""" # Add encodings for hidden self and cmd arguments. encoding = ensure_bytes(encoding) typecodes = parse_type_encoding(encoding) typecodes.insert(1, b'@:') encoding = b''.join(typecodes) d...
[ "def", "classmethod", "(", "self", ",", "encoding", ")", ":", "# Add encodings for hidden self and cmd arguments.", "encoding", "=", "ensure_bytes", "(", "encoding", ")", "typecodes", "=", "parse_type_encoding", "(", "encoding", ")", "typecodes", ".", "insert", "(", ...
Function decorator for class methods.
[ "Function", "decorator", "for", "class", "methods", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L864-L886
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/visuals/collections/agg_segment_collection.py
AggSegmentCollection.append
def append(self, P0, P1, itemsize=None, **kwargs): """ Append a new set of segments to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices positions of t...
python
def append(self, P0, P1, itemsize=None, **kwargs): """ Append a new set of segments to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices positions of t...
[ "def", "append", "(", "self", ",", "P0", ",", "P1", ",", "itemsize", "=", "None", ",", "*", "*", "kwargs", ")", ":", "itemsize", "=", "itemsize", "or", "1", "itemcount", "=", "len", "(", "P0", ")", "//", "itemsize", "V", "=", "np", ".", "empty", ...
Append a new set of segments to the collection. For kwargs argument, n is the number of vertices (local) or the number of item (shared) Parameters ---------- P : np.array Vertices positions of the path(s) to be added itemsize: int or None Size ...
[ "Append", "a", "new", "set", "of", "segments", "to", "the", "collection", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_segment_collection.py#L88-L147
glue-viz/glue-vispy-viewers
glue_vispy_viewers/volume/shaders.py
get_frag_shader
def get_frag_shader(volumes, clipped=False, n_volume_max=5): """ Get the fragment shader code - we use the shader_program object to determine which layers are enabled and therefore what to include in the shader code. """ declarations = "" before_loop = "" in_loop = "" after_loop = "" ...
python
def get_frag_shader(volumes, clipped=False, n_volume_max=5): """ Get the fragment shader code - we use the shader_program object to determine which layers are enabled and therefore what to include in the shader code. """ declarations = "" before_loop = "" in_loop = "" after_loop = "" ...
[ "def", "get_frag_shader", "(", "volumes", ",", "clipped", "=", "False", ",", "n_volume_max", "=", "5", ")", ":", "declarations", "=", "\"\"", "before_loop", "=", "\"\"", "in_loop", "=", "\"\"", "after_loop", "=", "\"\"", "for", "index", "in", "range", "(",...
Get the fragment shader code - we use the shader_program object to determine which layers are enabled and therefore what to include in the shader code.
[ "Get", "the", "fragment", "shader", "code", "-", "we", "use", "the", "shader_program", "object", "to", "determine", "which", "layers", "are", "enabled", "and", "therefore", "what", "to", "include", "in", "the", "shader", "code", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/volume/shaders.py#L207-L280
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/egl.py
eglGetDisplay
def eglGetDisplay(display=EGL_DEFAULT_DISPLAY): """ Connect to the EGL display server. """ res = _lib.eglGetDisplay(display) if not res or res == EGL_NO_DISPLAY: raise RuntimeError('Could not create display') return res
python
def eglGetDisplay(display=EGL_DEFAULT_DISPLAY): """ Connect to the EGL display server. """ res = _lib.eglGetDisplay(display) if not res or res == EGL_NO_DISPLAY: raise RuntimeError('Could not create display') return res
[ "def", "eglGetDisplay", "(", "display", "=", "EGL_DEFAULT_DISPLAY", ")", ":", "res", "=", "_lib", ".", "eglGetDisplay", "(", "display", ")", "if", "not", "res", "or", "res", "==", "EGL_NO_DISPLAY", ":", "raise", "RuntimeError", "(", "'Could not create display'",...
Connect to the EGL display server.
[ "Connect", "to", "the", "EGL", "display", "server", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L233-L239
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/egl.py
eglInitialize
def eglInitialize(display): """ Initialize EGL and return EGL version tuple. """ majorVersion = (_c_int*1)() minorVersion = (_c_int*1)() res = _lib.eglInitialize(display, majorVersion, minorVersion) if res == EGL_FALSE: raise RuntimeError('Could not initialize') return majorVersion[0...
python
def eglInitialize(display): """ Initialize EGL and return EGL version tuple. """ majorVersion = (_c_int*1)() minorVersion = (_c_int*1)() res = _lib.eglInitialize(display, majorVersion, minorVersion) if res == EGL_FALSE: raise RuntimeError('Could not initialize') return majorVersion[0...
[ "def", "eglInitialize", "(", "display", ")", ":", "majorVersion", "=", "(", "_c_int", "*", "1", ")", "(", ")", "minorVersion", "=", "(", "_c_int", "*", "1", ")", "(", ")", "res", "=", "_lib", ".", "eglInitialize", "(", "display", ",", "majorVersion", ...
Initialize EGL and return EGL version tuple.
[ "Initialize", "EGL", "and", "return", "EGL", "version", "tuple", "." ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L242-L250
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/ext/egl.py
eglQueryString
def eglQueryString(display, name): """ Query string from display """ out = _lib.eglQueryString(display, name) if not out: raise RuntimeError('Could not query %s' % name) return out
python
def eglQueryString(display, name): """ Query string from display """ out = _lib.eglQueryString(display, name) if not out: raise RuntimeError('Could not query %s' % name) return out
[ "def", "eglQueryString", "(", "display", ",", "name", ")", ":", "out", "=", "_lib", ".", "eglQueryString", "(", "display", ",", "name", ")", "if", "not", "out", ":", "raise", "RuntimeError", "(", "'Could not query %s'", "%", "name", ")", "return", "out" ]
Query string from display
[ "Query", "string", "from", "display" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L259-L265
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.get_edges
def get_edges(self, indexed=None): """Edges of the mesh Parameters ---------- indexed : str | None If indexed is None, return (Nf, 3) array of vertex indices, two per edge in the mesh. If indexed is 'faces', then return (Nf, 3, 2) array of vertex...
python
def get_edges(self, indexed=None): """Edges of the mesh Parameters ---------- indexed : str | None If indexed is None, return (Nf, 3) array of vertex indices, two per edge in the mesh. If indexed is 'faces', then return (Nf, 3, 2) array of vertex...
[ "def", "get_edges", "(", "self", ",", "indexed", "=", "None", ")", ":", "if", "indexed", "is", "None", ":", "if", "self", ".", "_edges", "is", "None", ":", "self", ".", "_compute_edges", "(", "indexed", "=", "None", ")", "return", "self", ".", "_edge...
Edges of the mesh Parameters ---------- indexed : str | None If indexed is None, return (Nf, 3) array of vertex indices, two per edge in the mesh. If indexed is 'faces', then return (Nf, 3, 2) array of vertex indices with 3 edges per face, and...
[ "Edges", "of", "the", "mesh", "Parameters", "----------", "indexed", ":", "str", "|", "None", "If", "indexed", "is", "None", "return", "(", "Nf", "3", ")", "array", "of", "vertex", "indices", "two", "per", "edge", "in", "the", "mesh", ".", "If", "index...
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L122-L148
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.set_faces
def set_faces(self, faces): """Set the faces Parameters ---------- faces : ndarray (Nf, 3) array of faces. Each row in the array contains three indices into the vertex array, specifying the three corners of a triangular face. """ self....
python
def set_faces(self, faces): """Set the faces Parameters ---------- faces : ndarray (Nf, 3) array of faces. Each row in the array contains three indices into the vertex array, specifying the three corners of a triangular face. """ self....
[ "def", "set_faces", "(", "self", ",", "faces", ")", ":", "self", ".", "_faces", "=", "faces", "self", ".", "_edges", "=", "None", "self", ".", "_edges_indexed_by_faces", "=", "None", "self", ".", "_vertex_faces", "=", "None", "self", ".", "_vertices_indexe...
Set the faces Parameters ---------- faces : ndarray (Nf, 3) array of faces. Each row in the array contains three indices into the vertex array, specifying the three corners of a triangular face.
[ "Set", "the", "faces" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L150-L167
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.get_vertices
def get_vertices(self, indexed=None): """Get the vertices Parameters ---------- indexed : str | None If Note, return an array (N,3) of the positions of vertices in the mesh. By default, each unique vertex appears only once. If indexed is 'faces', then...
python
def get_vertices(self, indexed=None): """Get the vertices Parameters ---------- indexed : str | None If Note, return an array (N,3) of the positions of vertices in the mesh. By default, each unique vertex appears only once. If indexed is 'faces', then...
[ "def", "get_vertices", "(", "self", ",", "indexed", "=", "None", ")", ":", "if", "indexed", "is", "None", ":", "if", "(", "self", ".", "_vertices", "is", "None", "and", "self", ".", "_vertices_indexed_by_faces", "is", "not", "None", ")", ":", "self", "...
Get the vertices Parameters ---------- indexed : str | None If Note, return an array (N,3) of the positions of vertices in the mesh. By default, each unique vertex appears only once. If indexed is 'faces', then the array will instead contain three ...
[ "Get", "the", "vertices" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L169-L198
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.get_bounds
def get_bounds(self): """Get the mesh bounds Returns ------- bounds : list A list of tuples of mesh bounds. """ if self._vertices_indexed_by_faces is not None: v = self._vertices_indexed_by_faces elif self._vertices is not None: ...
python
def get_bounds(self): """Get the mesh bounds Returns ------- bounds : list A list of tuples of mesh bounds. """ if self._vertices_indexed_by_faces is not None: v = self._vertices_indexed_by_faces elif self._vertices is not None: ...
[ "def", "get_bounds", "(", "self", ")", ":", "if", "self", ".", "_vertices_indexed_by_faces", "is", "not", "None", ":", "v", "=", "self", ".", "_vertices_indexed_by_faces", "elif", "self", ".", "_vertices", "is", "not", "None", ":", "v", "=", "self", ".", ...
Get the mesh bounds Returns ------- bounds : list A list of tuples of mesh bounds.
[ "Get", "the", "mesh", "bounds" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L200-L215
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.set_vertices
def set_vertices(self, verts=None, indexed=None, reset_normals=True): """Set the mesh vertices Parameters ---------- verts : ndarray | None The array (Nv, 3) of vertex coordinates. indexed : str | None If indexed=='faces', then the data must have shape (N...
python
def set_vertices(self, verts=None, indexed=None, reset_normals=True): """Set the mesh vertices Parameters ---------- verts : ndarray | None The array (Nv, 3) of vertex coordinates. indexed : str | None If indexed=='faces', then the data must have shape (N...
[ "def", "set_vertices", "(", "self", ",", "verts", "=", "None", ",", "indexed", "=", "None", ",", "reset_normals", "=", "True", ")", ":", "if", "indexed", "is", "None", ":", "if", "verts", "is", "not", "None", ":", "self", ".", "_vertices", "=", "vert...
Set the mesh vertices Parameters ---------- verts : ndarray | None The array (Nv, 3) of vertex coordinates. indexed : str | None If indexed=='faces', then the data must have shape (Nf, 3, 3) and is assumed to be already indexed as a list of faces. Thi...
[ "Set", "the", "mesh", "vertices" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L217-L244
glue-viz/glue-vispy-viewers
glue_vispy_viewers/extern/vispy/geometry/meshdata.py
MeshData.has_vertex_color
def has_vertex_color(self): """Return True if this data set has vertex color information""" for v in (self._vertex_colors, self._vertex_colors_indexed_by_faces, self._vertex_colors_indexed_by_edges): if v is not None: return True return False
python
def has_vertex_color(self): """Return True if this data set has vertex color information""" for v in (self._vertex_colors, self._vertex_colors_indexed_by_faces, self._vertex_colors_indexed_by_edges): if v is not None: return True return False
[ "def", "has_vertex_color", "(", "self", ")", ":", "for", "v", "in", "(", "self", ".", "_vertex_colors", ",", "self", ".", "_vertex_colors_indexed_by_faces", ",", "self", ".", "_vertex_colors_indexed_by_edges", ")", ":", "if", "v", "is", "not", "None", ":", "...
Return True if this data set has vertex color information
[ "Return", "True", "if", "this", "data", "set", "has", "vertex", "color", "information" ]
train
https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L260-L266