partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | InfiniteLineVisual.set_data | 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. | glue_vispy_viewers/extern/vispy/visuals/infinite_line.py | 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):
"""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... | [
"Set",
"the",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/infinite_line.py#L85-L117 | [
"def",
"set_data",
"(",
"self",
",",
"pos",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"if",
"pos",
"is",
"not",
"None",
":",
"pos",
"=",
"float",
"(",
"pos",
")",
"xy",
"=",
"self",
".",
"_pos",
"if",
"self",
".",
"_is_vertical",
":",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | InfiniteLineVisual._compute_bounds | Return the (min, max) bounding values of this visual along *axis*
in the local coordinate system. | glue_vispy_viewers/extern/vispy/visuals/infinite_line.py | 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):
"""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])
... | [
"Return",
"the",
"(",
"min",
"max",
")",
"bounding",
"values",
"of",
"this",
"visual",
"along",
"*",
"axis",
"*",
"in",
"the",
"local",
"coordinate",
"system",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/infinite_line.py#L130-L141 | [
"def",
"_compute_bounds",
"(",
"self",
",",
"axis",
",",
"view",
")",
":",
"is_vertical",
"=",
"self",
".",
"_is_vertical",
"pos",
"=",
"self",
".",
"_pos",
"if",
"axis",
"==",
"0",
"and",
"is_vertical",
":",
"return",
"(",
"pos",
"[",
"0",
",",
"0",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | curve3_bezier | 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
... | glue_vispy_viewers/extern/vispy/geometry/curves.py | 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):
"""
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... | [
"Generate",
"the",
"vertices",
"for",
"a",
"quadratic",
"Bezier",
"curve",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/curves.py#L302-L348 | [
"def",
"curve3_bezier",
"(",
"p1",
",",
"p2",
",",
"p3",
")",
":",
"x1",
",",
"y1",
"=",
"p1",
"x2",
",",
"y2",
"=",
"p2",
"x3",
",",
"y3",
"=",
"p3",
"points",
"=",
"[",
"]",
"_curve3_recursive_bezier",
"(",
"points",
",",
"x1",
",",
"y1",
","... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | curve4_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
... | glue_vispy_viewers/extern/vispy/geometry/curves.py | 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):
"""
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... | [
"Generate",
"the",
"vertices",
"for",
"a",
"third",
"order",
"Bezier",
"curve",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/curves.py#L351-L399 | [
"def",
"curve4_bezier",
"(",
"p1",
",",
"p2",
",",
"p3",
",",
"p4",
")",
":",
"x1",
",",
"y1",
"=",
"p1",
"x2",
",",
"y2",
"=",
"p2",
"x3",
",",
"y3",
"=",
"p3",
"x4",
",",
"y4",
"=",
"p4",
"points",
"=",
"[",
"]",
"_curve4_recursive_bezier",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SDFRenderer.render_to_texture | 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... | glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py | 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):
"""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 : ... | [
"Render",
"a",
"SDF",
"to",
"a",
"texture",
"at",
"a",
"given",
"offset",
"and",
"size"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py#L252-L286 | [
"def",
"render_to_texture",
"(",
"self",
",",
"data",
",",
"texture",
",",
"offset",
",",
"size",
")",
":",
"assert",
"isinstance",
"(",
"texture",
",",
"Texture2D",
")",
"set_state",
"(",
"blend",
"=",
"False",
",",
"depth_test",
"=",
"False",
")",
"# c... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SDFRenderer._render_edf | Render an EDF to a texture | glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py | 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):
"""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... | [
"Render",
"an",
"EDF",
"to",
"a",
"texture"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/text/_sdf.py#L288-L318 | [
"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... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | IntentSchema._add_intent_interactive | Interactively add a new intent to the intent schema object | ask/intent_schema.py | 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):
'''
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... | [
"Interactively",
"add",
"a",
"new",
"intent",
"to",
"the",
"intent",
"schema",
"object"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/intent_schema.py#L65-L85 | [
"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",
... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | IntentSchema.from_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 | ask/intent_schema.py | 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):
'''
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:... | [
"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"... | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/ask/intent_schema.py#L89-L100 | [
"def",
"from_filename",
"(",
"self",
",",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
")",
"as",
"fp",
":",
"return",
"IntentSchema",
"(",
"json",
".",
"load",
"(",
"fp",
... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | launch_request_handler | 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 | examples/twitter/lambda_function.py | 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):
""" 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... | [
"Annotate",
"functions",
"with"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L23-L45 | [
"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",... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | post_tweet_intent_handler | Use the 'intent' field in the VoiceHandler to map to the respective intent. | examples/twitter/lambda_function.py | 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):
"""
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... | [
"Use",
"the",
"intent",
"field",
"in",
"the",
"VoiceHandler",
"to",
"map",
"to",
"the",
"respective",
"intent",
"."
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L54-L77 | [
"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... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | tweet_list_handler | This is a generic function to handle any intent that reads out a list of tweets | examples/twitter/lambda_function.py | 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=""):
""" 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()... | [
"This",
"is",
"a",
"generic",
"function",
"to",
"handle",
"any",
"intent",
"that",
"reads",
"out",
"a",
"list",
"of",
"tweets"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L137-L152 | [
"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",
".",
"... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | focused_on_tweet | Return index if focused on tweet False if couldn't | examples/twitter/lambda_function.py | 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):
"""
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... | [
"Return",
"index",
"if",
"focused",
"on",
"tweet",
"False",
"if",
"couldn",
"t"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L198-L221 | [
"def",
"focused_on_tweet",
"(",
"request",
")",
":",
"slots",
"=",
"request",
".",
"get_slot_map",
"(",
")",
"if",
"\"Index\"",
"in",
"slots",
"and",
"slots",
"[",
"\"Index\"",
"]",
":",
"index",
"=",
"int",
"(",
"slots",
"[",
"'Index'",
"]",
")",
"eli... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | next_intent_handler | Takes care of things whenver the user says 'next' | examples/twitter/lambda_function.py | 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):
"""
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():
... | [
"Takes",
"care",
"of",
"things",
"whenver",
"the",
"user",
"says",
"next"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/twitter/lambda_function.py#L322-L337 | [
"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",
"... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | use_app | 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... | glue_vispy_viewers/extern/vispy/app/_default_app.py | 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):
""" 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... | [
"Get",
"/",
"create",
"the",
"default",
"Application",
"object"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/_default_app.py#L13-L48 | [
"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... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | glBufferData | Data can be numpy array or the size of data to allocate. | glue_vispy_viewers/extern/vispy/gloo/gl/_es2.py | 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):
""" 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... | [
"Data",
"can",
"be",
"numpy",
"array",
"or",
"the",
"size",
"of",
"data",
"to",
"allocate",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/gl/_es2.py#L88-L100 | [
"def",
"glBufferData",
"(",
"target",
",",
"data",
",",
"usage",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"int",
")",
":",
"size",
"=",
"data",
"data",
"=",
"ctypes",
".",
"c_voidp",
"(",
"0",
")",
"else",
":",
"if",
"not",
"data",
".",
"f... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshVisual.set_data | 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... | glue_vispy_viewers/extern/vispy/visuals/mesh.py | 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):
"""Set the mesh data
Parameters
----------
vertices : array-like | None
The vertices.
faces : array-like | None
The faces.
... | [
"Set",
"the",
"mesh",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/mesh.py#L212-L240 | [
"def",
"set_data",
"(",
"self",
",",
"vertices",
"=",
"None",
",",
"faces",
"=",
"None",
",",
"vertex_colors",
"=",
"None",
",",
"face_colors",
"=",
"None",
",",
"color",
"=",
"None",
",",
"meshdata",
"=",
"None",
")",
":",
"if",
"meshdata",
"is",
"n... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseVisual.bounds | Get the bounds of the Visual
Parameters
----------
axis : int
The axis.
view : instance of VisualView
The view to use. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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... | [
"Get",
"the",
"bounds",
"of",
"the",
"Visual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L238-L252 | [
"def",
"bounds",
"(",
"self",
",",
"axis",
",",
"view",
"=",
"None",
")",
":",
"if",
"view",
"is",
"None",
":",
"view",
"=",
"self",
"if",
"axis",
"not",
"in",
"self",
".",
"_vshare",
".",
"bounds",
":",
"self",
".",
"_vshare",
".",
"bounds",
"["... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Visual.set_gl_state | 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`. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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 ... | [
"Define",
"the",
"set",
"of",
"GL",
"state",
"parameters",
"to",
"use",
"when",
"drawing"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L338-L349 | [
"def",
"set_gl_state",
"(",
"self",
",",
"preset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_vshare",
".",
"gl_state",
"=",
"kwargs",
"self",
".",
"_vshare",
".",
"gl_state",
"[",
"'preset'",
"]",
"=",
"preset"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Visual.update_gl_state | Modify the set of GL state parameters to use when drawing
Parameters
----------
*args : tuple
Arguments.
**kwargs : dict
Keyword argments. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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... | [
"Modify",
"the",
"set",
"of",
"GL",
"state",
"parameters",
"to",
"use",
"when",
"drawing"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L351-L365 | [
"def",
"update_gl_state",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"self",
".",
"_vshare",
".",
"gl_state",
"[",
"'preset'",
"]",
"=",
"args",
"[",
"0",
"]",
"elif",
"len",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Visual._get_hook | Return a FunctionChain that Filters may use to modify the program.
*shader* should be "frag" or "vert"
*name* should be "pre" or "post" | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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:
... | [
"Return",
"a",
"FunctionChain",
"that",
"Filters",
"may",
"use",
"to",
"modify",
"the",
"program",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L448-L464 | [
"def",
"_get_hook",
"(",
"self",
",",
"shader",
",",
"name",
")",
":",
"assert",
"name",
"in",
"(",
"'pre'",
",",
"'post'",
")",
"key",
"=",
"(",
"shader",
",",
"name",
")",
"if",
"key",
"in",
"self",
".",
"_hooks",
":",
"return",
"self",
".",
"_... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Visual.attach | 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. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L466-L484 | [
"def",
"attach",
"(",
"self",
",",
"filt",
",",
"view",
"=",
"None",
")",
":",
"if",
"view",
"is",
"None",
":",
"self",
".",
"_vshare",
".",
"filters",
".",
"append",
"(",
"filt",
")",
"for",
"view",
"in",
"self",
".",
"_vshare",
".",
"views",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Visual.detach | Detach a filter.
Parameters
----------
filt : object
The filter to detach.
view : instance of VisualView | None
The view to use. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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)
... | [
"Detach",
"a",
"filter",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L486-L502 | [
"def",
"detach",
"(",
"self",
",",
"filt",
",",
"view",
"=",
"None",
")",
":",
"if",
"view",
"is",
"None",
":",
"self",
".",
"_vshare",
".",
"filters",
".",
"remove",
"(",
"filt",
")",
"for",
"view",
"in",
"self",
".",
"_vshare",
".",
"views",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.add_subvisual | Add a subvisual
Parameters
----------
visual : instance of Visual
The visual to add. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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.... | [
"Add",
"a",
"subvisual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L544-L556 | [
"def",
"add_subvisual",
"(",
"self",
",",
"visual",
")",
":",
"visual",
".",
"transforms",
"=",
"self",
".",
"transforms",
"visual",
".",
"_prepare_transforms",
"(",
"visual",
")",
"self",
".",
"_subvisuals",
".",
"append",
"(",
"visual",
")",
"visual",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.remove_subvisual | Remove a subvisual
Parameters
----------
visual : instance of Visual
The visual to remove. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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() | [
"Remove",
"a",
"subvisual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L558-L568 | [
"def",
"remove_subvisual",
"(",
"self",
",",
"visual",
")",
":",
"visual",
".",
"events",
".",
"update",
".",
"disconnect",
"(",
"self",
".",
"_subv_update",
")",
"self",
".",
"_subvisuals",
".",
"remove",
"(",
"visual",
")",
"self",
".",
"update",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.draw | Draw the visual | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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() | [
"Draw",
"the",
"visual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L578-L588 | [
"def",
"draw",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"visible",
":",
"return",
"if",
"self",
".",
"_prepare_draw",
"(",
"view",
"=",
"self",
")",
"is",
"False",
":",
"return",
"for",
"v",
"in",
"self",
".",
"_subvisuals",
":",
"if",
"v",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.set_gl_state | 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`. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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... | [
"Define",
"the",
"set",
"of",
"GL",
"state",
"parameters",
"to",
"use",
"when",
"drawing"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L597-L608 | [
"def",
"set_gl_state",
"(",
"self",
",",
"preset",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"v",
"in",
"self",
".",
"_subvisuals",
":",
"v",
".",
"set_gl_state",
"(",
"preset",
"=",
"preset",
",",
"*",
"*",
"kwargs",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.update_gl_state | Modify the set of GL state parameters to use when drawing
Parameters
----------
*args : tuple
Arguments.
**kwargs : dict
Keyword argments. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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... | [
"Modify",
"the",
"set",
"of",
"GL",
"state",
"parameters",
"to",
"use",
"when",
"drawing"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L610-L621 | [
"def",
"update_gl_state",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"v",
"in",
"self",
".",
"_subvisuals",
":",
"v",
".",
"update_gl_state",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.attach | 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. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L623-L636 | [
"def",
"attach",
"(",
"self",
",",
"filt",
",",
"view",
"=",
"None",
")",
":",
"for",
"v",
"in",
"self",
".",
"_subvisuals",
":",
"v",
".",
"attach",
"(",
"filt",
",",
"v",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | CompoundVisual.detach | Detach a filter.
Parameters
----------
filt : object
The filter to detach.
view : instance of VisualView | None
The view to use. | glue_vispy_viewers/extern/vispy/visuals/visual.py | 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):
"""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) | [
"Detach",
"a",
"filter",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/visual.py#L638-L649 | [
"def",
"detach",
"(",
"self",
",",
"filt",
",",
"view",
"=",
"None",
")",
":",
"for",
"v",
"in",
"self",
".",
"_subvisuals",
":",
"v",
".",
"detach",
"(",
"filt",
",",
"v",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | API.addMov | main function for placing movements
stop_limit = {'gain': [mode, value], 'loss': [mode, value]} | tradingAPI/api.py | 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):
"""main function for placing movements
stop_limit = {'gain': [mode, value], 'loss': [mode, value]}"""
# ~ ARGS ~
if (not isinstance(product, type('')) or
... | [
"main",
"function",
"for",
"placing",
"movements",
"stop_limit",
"=",
"{",
"gain",
":",
"[",
"mode",
"value",
"]",
"loss",
":",
"[",
"mode",
"value",
"]",
"}"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L20-L72 | [
"def",
"addMov",
"(",
"self",
",",
"product",
",",
"quantity",
"=",
"None",
",",
"mode",
"=",
"\"buy\"",
",",
"stop_limit",
"=",
"None",
",",
"auto_margin",
"=",
"None",
",",
"name_counter",
"=",
"None",
")",
":",
"# ~ ARGS ~",
"if",
"(",
"not",
"isins... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | API.checkPos | check all positions | tradingAPI/api.py | 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):
"""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... | [
"check",
"all",
"positions"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L76-L97 | [
"def",
"checkPos",
"(",
"self",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"self",
".",
"css1",
"(",
"path",
"[",
"'movs-table'",
"]",
")",
".",
"html",
",",
"'html.parser'",
")",
"poss",
"=",
"[",
"]",
"for",
"label",
"in",
"soup",
".",
"find_all"... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | API.checkStock | check stocks in preference | tradingAPI/api.py | 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):
"""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... | [
"check",
"stocks",
"in",
"preference"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L99-L129 | [
"def",
"checkStock",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"preferences",
":",
"logger",
".",
"debug",
"(",
"\"no preferences\"",
")",
"return",
"None",
"soup",
"=",
"BeautifulSoup",
"(",
"self",
".",
"xpath",
"(",
"path",
"[",
"'stock-table'",
... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | API.clearPrefs | clear the left panel and preferences | tradingAPI/api.py | 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):
"""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').... | [
"clear",
"the",
"left",
"panel",
"and",
"preferences"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L134-L141 | [
"def",
"clearPrefs",
"(",
"self",
")",
":",
"self",
".",
"preferences",
".",
"clear",
"(",
")",
"tradebox_num",
"=",
"len",
"(",
"self",
".",
"css",
"(",
"'div.tradebox'",
")",
")",
"for",
"i",
"in",
"range",
"(",
"tradebox_num",
")",
":",
"self",
".... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | API.addPrefs | add preference in self.preferences | tradingAPI/api.py | 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=[]):
"""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... | [
"add",
"preference",
"in",
"self",
".",
"preferences"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/api.py#L143-L164 | [
"def",
"addPrefs",
"(",
"self",
",",
"prefs",
"=",
"[",
"]",
")",
":",
"if",
"len",
"(",
"prefs",
")",
"==",
"len",
"(",
"self",
".",
"preferences",
")",
"==",
"0",
":",
"logger",
".",
"debug",
"(",
"\"no preferences\"",
")",
"return",
"None",
"sel... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | _load_glyph | Load glyph from font into dict | glue_vispy_viewers/extern/vispy/util/fonts/_freetype.py | 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):
"""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['... | [
"Load",
"glyph",
"from",
"font",
"into",
"dict"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fonts/_freetype.py#L45-L73 | [
"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... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | VisualNode._set_clipper | Assign a clipper that is inherited from a parent node.
If *clipper* is None, then remove any clippers for *node*. | glue_vispy_viewers/extern/vispy/scene/visuals.py | 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):
"""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... | [
"Assign",
"a",
"clipper",
"that",
"is",
"inherited",
"from",
"a",
"parent",
"node",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/visuals.py#L43-L52 | [
"def",
"_set_clipper",
"(",
"self",
",",
"node",
",",
"clipper",
")",
":",
"if",
"node",
"in",
"self",
".",
"_clippers",
":",
"self",
".",
"detach",
"(",
"self",
".",
"_clippers",
".",
"pop",
"(",
"node",
")",
")",
"if",
"clipper",
"is",
"not",
"No... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | VisualNode._update_trsys | Transform object(s) have changed for this Node; assign these to the
visual's TransformSystem. | glue_vispy_viewers/extern/vispy/scene/visuals.py | 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):
"""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... | [
"Transform",
"object",
"(",
"s",
")",
"have",
"changed",
"for",
"this",
"Node",
";",
"assign",
"these",
"to",
"the",
"visual",
"s",
"TransformSystem",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/visuals.py#L71-L82 | [
"def",
"_update_trsys",
"(",
"self",
",",
"event",
")",
":",
"doc",
"=",
"self",
".",
"document_node",
"scene",
"=",
"self",
".",
"scene_node",
"root",
"=",
"self",
".",
"root_node",
"self",
".",
"transforms",
".",
"visual_transform",
"=",
"self",
".",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | cfnumber_to_number | Convert CFNumber to python int or float. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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,
... | [
"Convert",
"CFNumber",
"to",
"python",
"int",
"or",
"float",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1032-L1055 | [
"def",
"cfnumber_to_number",
"(",
"cfnumber",
")",
":",
"numeric_type",
"=",
"cf",
".",
"CFNumberGetType",
"(",
"cfnumber",
")",
"cfnum_to_ctype",
"=",
"{",
"kCFNumberSInt8Type",
":",
"c_int8",
",",
"kCFNumberSInt16Type",
":",
"c_int16",
",",
"kCFNumberSInt32Type",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | cftype_to_value | 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. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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... | [
"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... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1062-L1074 | [
"def",
"cftype_to_value",
"(",
"cftype",
")",
":",
"if",
"not",
"cftype",
":",
"return",
"None",
"typeID",
"=",
"cf",
".",
"CFGetTypeID",
"(",
"cftype",
")",
"if",
"typeID",
"in",
"known_cftypes",
":",
"convert_function",
"=",
"known_cftypes",
"[",
"typeID",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | cfset_to_set | Convert CFSet to python set. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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)]) | [
"Convert",
"CFSet",
"to",
"python",
"set",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1085-L1090 | [
"def",
"cfset_to_set",
"(",
"cfset",
")",
":",
"count",
"=",
"cf",
".",
"CFSetGetCount",
"(",
"cfset",
")",
"buffer",
"=",
"(",
"c_void_p",
"*",
"count",
")",
"(",
")",
"cf",
".",
"CFSetGetValues",
"(",
"cfset",
",",
"byref",
"(",
"buffer",
")",
")",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | cfarray_to_list | Convert CFArray to python list. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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)] | [
"Convert",
"CFArray",
"to",
"python",
"list",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L1099-L1103 | [
"def",
"cfarray_to_list",
"(",
"cfarray",
")",
":",
"count",
"=",
"cf",
".",
"CFArrayGetCount",
"(",
"cfarray",
")",
"return",
"[",
"cftype_to_value",
"(",
"c_void_p",
"(",
"cf",
".",
"CFArrayGetValueAtIndex",
"(",
"cfarray",
",",
"i",
")",
")",
")",
"for"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ObjCMethod.ctype_for_encoding | Return ctypes type for an encoded Objective-C type. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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:]])
... | [
"Return",
"ctypes",
"type",
"for",
"an",
"encoded",
"Objective",
"-",
"C",
"type",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L595-L610 | [
"def",
"ctype_for_encoding",
"(",
"self",
",",
"encoding",
")",
":",
"if",
"encoding",
"in",
"self",
".",
"typecodes",
":",
"return",
"self",
".",
"typecodes",
"[",
"encoding",
"]",
"elif",
"encoding",
"[",
"0",
":",
"1",
"]",
"==",
"b'^'",
"and",
"enc... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ObjCSubclass.classmethod | Function decorator for class methods. | glue_vispy_viewers/extern/vispy/ext/cocoapy.py | 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):
"""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... | [
"Function",
"decorator",
"for",
"class",
"methods",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cocoapy.py#L864-L886 | [
"def",
"classmethod",
"(",
"self",
",",
"encoding",
")",
":",
"# Add encodings for hidden self and cmd arguments.",
"encoding",
"=",
"ensure_bytes",
"(",
"encoding",
")",
"typecodes",
"=",
"parse_type_encoding",
"(",
"encoding",
")",
"typecodes",
".",
"insert",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AggSegmentCollection.append | 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 ... | glue_vispy_viewers/extern/vispy/visuals/collections/agg_segment_collection.py | 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):
"""
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... | [
"Append",
"a",
"new",
"set",
"of",
"segments",
"to",
"the",
"collection",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_segment_collection.py#L88-L147 | [
"def",
"append",
"(",
"self",
",",
"P0",
",",
"P1",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"1",
"itemcount",
"=",
"len",
"(",
"P0",
")",
"//",
"itemsize",
"V",
"=",
"np",
".",
"empty",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_frag_shader | 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. | glue_vispy_viewers/volume/shaders.py | 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):
"""
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 = ""
... | [
"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",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/volume/shaders.py#L207-L280 | [
"def",
"get_frag_shader",
"(",
"volumes",
",",
"clipped",
"=",
"False",
",",
"n_volume_max",
"=",
"5",
")",
":",
"declarations",
"=",
"\"\"",
"before_loop",
"=",
"\"\"",
"in_loop",
"=",
"\"\"",
"after_loop",
"=",
"\"\"",
"for",
"index",
"in",
"range",
"(",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | eglGetDisplay | Connect to the EGL display server. | glue_vispy_viewers/extern/vispy/ext/egl.py | 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):
""" 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 | [
"Connect",
"to",
"the",
"EGL",
"display",
"server",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L233-L239 | [
"def",
"eglGetDisplay",
"(",
"display",
"=",
"EGL_DEFAULT_DISPLAY",
")",
":",
"res",
"=",
"_lib",
".",
"eglGetDisplay",
"(",
"display",
")",
"if",
"not",
"res",
"or",
"res",
"==",
"EGL_NO_DISPLAY",
":",
"raise",
"RuntimeError",
"(",
"'Could not create display'",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | eglInitialize | Initialize EGL and return EGL version tuple. | glue_vispy_viewers/extern/vispy/ext/egl.py | 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):
""" 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... | [
"Initialize",
"EGL",
"and",
"return",
"EGL",
"version",
"tuple",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L242-L250 | [
"def",
"eglInitialize",
"(",
"display",
")",
":",
"majorVersion",
"=",
"(",
"_c_int",
"*",
"1",
")",
"(",
")",
"minorVersion",
"=",
"(",
"_c_int",
"*",
"1",
")",
"(",
")",
"res",
"=",
"_lib",
".",
"eglInitialize",
"(",
"display",
",",
"majorVersion",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | eglQueryString | Query string from display | glue_vispy_viewers/extern/vispy/ext/egl.py | 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):
""" Query string from display
"""
out = _lib.eglQueryString(display, name)
if not out:
raise RuntimeError('Could not query %s' % name)
return out | [
"Query",
"string",
"from",
"display"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/egl.py#L259-L265 | [
"def",
"eglQueryString",
"(",
"display",
",",
"name",
")",
":",
"out",
"=",
"_lib",
".",
"eglQueryString",
"(",
"display",
",",
"name",
")",
"if",
"not",
"out",
":",
"raise",
"RuntimeError",
"(",
"'Could not query %s'",
"%",
"name",
")",
"return",
"out"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_edges | 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... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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... | [
"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... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L122-L148 | [
"def",
"get_edges",
"(",
"self",
",",
"indexed",
"=",
"None",
")",
":",
"if",
"indexed",
"is",
"None",
":",
"if",
"self",
".",
"_edges",
"is",
"None",
":",
"self",
".",
"_compute_edges",
"(",
"indexed",
"=",
"None",
")",
"return",
"self",
".",
"_edge... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.set_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. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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.... | [
"Set",
"the",
"faces"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L150-L167 | [
"def",
"set_faces",
"(",
"self",
",",
"faces",
")",
":",
"self",
".",
"_faces",
"=",
"faces",
"self",
".",
"_edges",
"=",
"None",
"self",
".",
"_edges_indexed_by_faces",
"=",
"None",
"self",
".",
"_vertex_faces",
"=",
"None",
"self",
".",
"_vertices_indexe... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_vertices | 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
... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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... | [
"Get",
"the",
"vertices"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L169-L198 | [
"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",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_bounds | Get the mesh bounds
Returns
-------
bounds : list
A list of tuples of mesh bounds. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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:
... | [
"Get",
"the",
"mesh",
"bounds"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L200-L215 | [
"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",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.set_vertices | 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... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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... | [
"Set",
"the",
"mesh",
"vertices"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L217-L244 | [
"def",
"set_vertices",
"(",
"self",
",",
"verts",
"=",
"None",
",",
"indexed",
"=",
"None",
",",
"reset_normals",
"=",
"True",
")",
":",
"if",
"indexed",
"is",
"None",
":",
"if",
"verts",
"is",
"not",
"None",
":",
"self",
".",
"_vertices",
"=",
"vert... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.has_vertex_color | Return True if this data set has vertex color information | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | 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):
"""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 | [
"Return",
"True",
"if",
"this",
"data",
"set",
"has",
"vertex",
"color",
"information"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L260-L266 | [
"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",
":",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.has_face_color | Return True if this data set has face color information | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def has_face_color(self):
"""Return True if this data set has face color information"""
for v in (self._face_colors, self._face_colors_indexed_by_faces,
self._face_colors_indexed_by_edges):
if v is not None:
return True
return False | def has_face_color(self):
"""Return True if this data set has face color information"""
for v in (self._face_colors, self._face_colors_indexed_by_faces,
self._face_colors_indexed_by_edges):
if v is not None:
return True
return False | [
"Return",
"True",
"if",
"this",
"data",
"set",
"has",
"face",
"color",
"information"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L268-L274 | [
"def",
"has_face_color",
"(",
"self",
")",
":",
"for",
"v",
"in",
"(",
"self",
".",
"_face_colors",
",",
"self",
".",
"_face_colors_indexed_by_faces",
",",
"self",
".",
"_face_colors_indexed_by_edges",
")",
":",
"if",
"v",
"is",
"not",
"None",
":",
"return",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_face_normals | Get face normals
Parameters
----------
indexed : str | None
If None, return an array (Nf, 3) of normal vectors for each face.
If 'faces', then instead return an indexed array (Nf, 3, 3)
(this is just the same array with each vector copied three times).
... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def get_face_normals(self, indexed=None):
"""Get face normals
Parameters
----------
indexed : str | None
If None, return an array (Nf, 3) of normal vectors for each face.
If 'faces', then instead return an indexed array (Nf, 3, 3)
(this is just the sa... | def get_face_normals(self, indexed=None):
"""Get face normals
Parameters
----------
indexed : str | None
If None, return an array (Nf, 3) of normal vectors for each face.
If 'faces', then instead return an indexed array (Nf, 3, 3)
(this is just the sa... | [
"Get",
"face",
"normals"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L276-L306 | [
"def",
"get_face_normals",
"(",
"self",
",",
"indexed",
"=",
"None",
")",
":",
"if",
"self",
".",
"_face_normals",
"is",
"None",
":",
"v",
"=",
"self",
".",
"get_vertices",
"(",
"indexed",
"=",
"'faces'",
")",
"self",
".",
"_face_normals",
"=",
"np",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_vertex_normals | Get vertex normals
Parameters
----------
indexed : str | None
If None, return an (N, 3) array of normal vectors with one entry
per unique vertex in the mesh. If indexed is 'faces', then the
array will contain three normal vectors per face (and some
... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def get_vertex_normals(self, indexed=None):
"""Get vertex normals
Parameters
----------
indexed : str | None
If None, return an (N, 3) array of normal vectors with one entry
per unique vertex in the mesh. If indexed is 'faces', then the
array will con... | def get_vertex_normals(self, indexed=None):
"""Get vertex normals
Parameters
----------
indexed : str | None
If None, return an (N, 3) array of normal vectors with one entry
per unique vertex in the mesh. If indexed is 'faces', then the
array will con... | [
"Get",
"vertex",
"normals"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L308-L346 | [
"def",
"get_vertex_normals",
"(",
"self",
",",
"indexed",
"=",
"None",
")",
":",
"if",
"self",
".",
"_vertex_normals",
"is",
"None",
":",
"faceNorms",
"=",
"self",
".",
"get_face_normals",
"(",
")",
"vertFaces",
"=",
"self",
".",
"get_vertex_faces",
"(",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_vertex_colors | Get vertex colors
Parameters
----------
indexed : str | None
If None, return an array (Nv, 4) of vertex colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4).
Returns
-------
colors : ndarray
The ver... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def get_vertex_colors(self, indexed=None):
"""Get vertex colors
Parameters
----------
indexed : str | None
If None, return an array (Nv, 4) of vertex colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4).
Returns
... | def get_vertex_colors(self, indexed=None):
"""Get vertex colors
Parameters
----------
indexed : str | None
If None, return an array (Nv, 4) of vertex colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4).
Returns
... | [
"Get",
"vertex",
"colors"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L348-L371 | [
"def",
"get_vertex_colors",
"(",
"self",
",",
"indexed",
"=",
"None",
")",
":",
"if",
"indexed",
"is",
"None",
":",
"return",
"self",
".",
"_vertex_colors",
"elif",
"indexed",
"==",
"'faces'",
":",
"if",
"self",
".",
"_vertex_colors_indexed_by_faces",
"is",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.set_vertex_colors | Set the vertex color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nv, 4) (indexing by vertex)
or shape (Nf, 3, 4) (vertices indexed by face).
indexed : str | None
Should be 'faces' if colors are indexed by faces. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def set_vertex_colors(self, colors, indexed=None):
"""Set the vertex color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nv, 4) (indexing by vertex)
or shape (Nf, 3, 4) (vertices indexed by face).
indexed : str | None
... | def set_vertex_colors(self, colors, indexed=None):
"""Set the vertex color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nv, 4) (indexing by vertex)
or shape (Nf, 3, 4) (vertices indexed by face).
indexed : str | None
... | [
"Set",
"the",
"vertex",
"color",
"array"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L373-L401 | [
"def",
"set_vertex_colors",
"(",
"self",
",",
"colors",
",",
"indexed",
"=",
"None",
")",
":",
"colors",
"=",
"_fix_colors",
"(",
"np",
".",
"asarray",
"(",
"colors",
")",
")",
"if",
"indexed",
"is",
"None",
":",
"if",
"colors",
".",
"ndim",
"!=",
"2... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_face_colors | Get the face colors
Parameters
----------
indexed : str | None
If indexed is None, return (Nf, 4) array of face colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4) (note this is just the same array with each color
repeate... | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def get_face_colors(self, indexed=None):
"""Get the face colors
Parameters
----------
indexed : str | None
If indexed is None, return (Nf, 4) array of face colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4) (note this is jus... | def get_face_colors(self, indexed=None):
"""Get the face colors
Parameters
----------
indexed : str | None
If indexed is None, return (Nf, 4) array of face colors.
If indexed=='faces', then instead return an indexed array
(Nf, 3, 4) (note this is jus... | [
"Get",
"the",
"face",
"colors"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L403-L431 | [
"def",
"get_face_colors",
"(",
"self",
",",
"indexed",
"=",
"None",
")",
":",
"if",
"indexed",
"is",
"None",
":",
"return",
"self",
".",
"_face_colors",
"elif",
"indexed",
"==",
"'faces'",
":",
"if",
"(",
"self",
".",
"_face_colors_indexed_by_faces",
"is",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.set_face_colors | Set the face color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nf, 4) (indexed by face),
or shape (Nf, 3, 4) (face colors indexed by faces).
indexed : str | None
Should be 'faces' if colors are indexed by faces. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def set_face_colors(self, colors, indexed=None):
"""Set the face color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nf, 4) (indexed by face),
or shape (Nf, 3, 4) (face colors indexed by faces).
indexed : str | None
... | def set_face_colors(self, colors, indexed=None):
"""Set the face color array
Parameters
----------
colors : array
Array of colors. Must have shape (Nf, 4) (indexed by face),
or shape (Nf, 3, 4) (face colors indexed by faces).
indexed : str | None
... | [
"Set",
"the",
"face",
"color",
"array"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L433-L459 | [
"def",
"set_face_colors",
"(",
"self",
",",
"colors",
",",
"indexed",
"=",
"None",
")",
":",
"colors",
"=",
"_fix_colors",
"(",
"colors",
")",
"if",
"colors",
".",
"shape",
"[",
"0",
"]",
"!=",
"self",
".",
"n_faces",
":",
"raise",
"ValueError",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.n_faces | The number of faces in the mesh | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def n_faces(self):
"""The number of faces in the mesh"""
if self._faces is not None:
return self._faces.shape[0]
elif self._vertices_indexed_by_faces is not None:
return self._vertices_indexed_by_faces.shape[0] | def n_faces(self):
"""The number of faces in the mesh"""
if self._faces is not None:
return self._faces.shape[0]
elif self._vertices_indexed_by_faces is not None:
return self._vertices_indexed_by_faces.shape[0] | [
"The",
"number",
"of",
"faces",
"in",
"the",
"mesh"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L462-L467 | [
"def",
"n_faces",
"(",
"self",
")",
":",
"if",
"self",
".",
"_faces",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_faces",
".",
"shape",
"[",
"0",
"]",
"elif",
"self",
".",
"_vertices_indexed_by_faces",
"is",
"not",
"None",
":",
"return",
"self",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.get_vertex_faces | List mapping each vertex index to a list of face indices that use it. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def get_vertex_faces(self):
"""
List mapping each vertex index to a list of face indices that use it.
"""
if self._vertex_faces is None:
self._vertex_faces = [[] for i in xrange(len(self.get_vertices()))]
for i in xrange(self._faces.shape[0]):
face... | def get_vertex_faces(self):
"""
List mapping each vertex index to a list of face indices that use it.
"""
if self._vertex_faces is None:
self._vertex_faces = [[] for i in xrange(len(self.get_vertices()))]
for i in xrange(self._faces.shape[0]):
face... | [
"List",
"mapping",
"each",
"vertex",
"index",
"to",
"a",
"list",
"of",
"face",
"indices",
"that",
"use",
"it",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L510-L520 | [
"def",
"get_vertex_faces",
"(",
"self",
")",
":",
"if",
"self",
".",
"_vertex_faces",
"is",
"None",
":",
"self",
".",
"_vertex_faces",
"=",
"[",
"[",
"]",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"get_vertices",
"(",
")",
")",
")",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.save | Serialize this mesh to a string appropriate for disk storage
Returns
-------
state : dict
The state. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def save(self):
"""Serialize this mesh to a string appropriate for disk storage
Returns
-------
state : dict
The state.
"""
import pickle
if self._faces is not None:
names = ['_vertices', '_faces']
else:
names = ['_vert... | def save(self):
"""Serialize this mesh to a string appropriate for disk storage
Returns
-------
state : dict
The state.
"""
import pickle
if self._faces is not None:
names = ['_vertices', '_faces']
else:
names = ['_vert... | [
"Serialize",
"this",
"mesh",
"to",
"a",
"string",
"appropriate",
"for",
"disk",
"storage"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L558-L583 | [
"def",
"save",
"(",
"self",
")",
":",
"import",
"pickle",
"if",
"self",
".",
"_faces",
"is",
"not",
"None",
":",
"names",
"=",
"[",
"'_vertices'",
",",
"'_faces'",
"]",
"else",
":",
"names",
"=",
"[",
"'_vertices_indexed_by_faces'",
"]",
"if",
"self",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MeshData.restore | Restore the state of a mesh previously saved using save()
Parameters
----------
state : dict
The previous state. | glue_vispy_viewers/extern/vispy/geometry/meshdata.py | def restore(self, state):
"""Restore the state of a mesh previously saved using save()
Parameters
----------
state : dict
The previous state.
"""
import pickle
state = pickle.loads(state)
for k in state:
if isinstance(state[k], lis... | def restore(self, state):
"""Restore the state of a mesh previously saved using save()
Parameters
----------
state : dict
The previous state.
"""
import pickle
state = pickle.loads(state)
for k in state:
if isinstance(state[k], lis... | [
"Restore",
"the",
"state",
"of",
"a",
"mesh",
"previously",
"saved",
"using",
"save",
"()"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/meshdata.py#L585-L598 | [
"def",
"restore",
"(",
"self",
",",
"state",
")",
":",
"import",
"pickle",
"state",
"=",
"pickle",
".",
"loads",
"(",
"state",
")",
"for",
"k",
"in",
"state",
":",
"if",
"isinstance",
"(",
"state",
"[",
"k",
"]",
",",
"list",
")",
":",
"state",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | cubehelix | A full implementation of Dave Green's "cubehelix" for Matplotlib.
Based on the FORTRAN 77 code provided in
D.A. Green, 2011, BASI, 39, 289.
http://adsabs.harvard.edu/abs/2011arXiv1108.5083G
User can adjust all parameters of the cubehelix algorithm.
This enables much greater flexibility in choosing... | glue_vispy_viewers/extern/vispy/ext/cubehelix.py | def cubehelix(start=0.5, rot=1, gamma=1.0, reverse=True, nlev=256.,
minSat=1.2, maxSat=1.2, minLight=0., maxLight=1.,
**kwargs):
"""
A full implementation of Dave Green's "cubehelix" for Matplotlib.
Based on the FORTRAN 77 code provided in
D.A. Green, 2011, BASI, 39, 289.
http://a... | def cubehelix(start=0.5, rot=1, gamma=1.0, reverse=True, nlev=256.,
minSat=1.2, maxSat=1.2, minLight=0., maxLight=1.,
**kwargs):
"""
A full implementation of Dave Green's "cubehelix" for Matplotlib.
Based on the FORTRAN 77 code provided in
D.A. Green, 2011, BASI, 39, 289.
http://a... | [
"A",
"full",
"implementation",
"of",
"Dave",
"Green",
"s",
"cubehelix",
"for",
"Matplotlib",
".",
"Based",
"on",
"the",
"FORTRAN",
"77",
"code",
"provided",
"in",
"D",
".",
"A",
".",
"Green",
"2011",
"BASI",
"39",
"289",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/cubehelix.py#L35-L138 | [
"def",
"cubehelix",
"(",
"start",
"=",
"0.5",
",",
"rot",
"=",
"1",
",",
"gamma",
"=",
"1.0",
",",
"reverse",
"=",
"True",
",",
"nlev",
"=",
"256.",
",",
"minSat",
"=",
"1.2",
",",
"maxSat",
"=",
"1.2",
",",
"minLight",
"=",
"0.",
",",
"maxLight"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | color_to_hex | Convert matplotlib color code to hex color code | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def color_to_hex(color):
"""Convert matplotlib color code to hex color code"""
if color is None or colorConverter.to_rgba(color)[3] == 0:
return 'none'
else:
rgb = colorConverter.to_rgb(color)
return '#{0:02X}{1:02X}{2:02X}'.format(*(int(255 * c) for c in rgb)) | def color_to_hex(color):
"""Convert matplotlib color code to hex color code"""
if color is None or colorConverter.to_rgba(color)[3] == 0:
return 'none'
else:
rgb = colorConverter.to_rgb(color)
return '#{0:02X}{1:02X}{2:02X}'.format(*(int(255 * c) for c in rgb)) | [
"Convert",
"matplotlib",
"color",
"code",
"to",
"hex",
"color",
"code"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L21-L27 | [
"def",
"color_to_hex",
"(",
"color",
")",
":",
"if",
"color",
"is",
"None",
"or",
"colorConverter",
".",
"to_rgba",
"(",
"color",
")",
"[",
"3",
"]",
"==",
"0",
":",
"return",
"'none'",
"else",
":",
"rgb",
"=",
"colorConverter",
".",
"to_rgb",
"(",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _many_to_one | Convert a many-to-one mapping to a one-to-one mapping | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def _many_to_one(input_dict):
"""Convert a many-to-one mapping to a one-to-one mapping"""
return dict((key, val)
for keys, val in input_dict.items()
for key in keys) | def _many_to_one(input_dict):
"""Convert a many-to-one mapping to a one-to-one mapping"""
return dict((key, val)
for keys, val in input_dict.items()
for key in keys) | [
"Convert",
"a",
"many",
"-",
"to",
"-",
"one",
"mapping",
"to",
"a",
"one",
"-",
"to",
"-",
"one",
"mapping"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L30-L34 | [
"def",
"_many_to_one",
"(",
"input_dict",
")",
":",
"return",
"dict",
"(",
"(",
"key",
",",
"val",
")",
"for",
"keys",
",",
"val",
"in",
"input_dict",
".",
"items",
"(",
")",
"for",
"key",
"in",
"keys",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_dasharray | Get an SVG dash array for the given matplotlib linestyle
Parameters
----------
obj : matplotlib object
The matplotlib line or path object, which must have a get_linestyle()
method which returns a valid matplotlib line code
Returns
-------
dasharray : string
The HTML/SVG... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_dasharray(obj):
"""Get an SVG dash array for the given matplotlib linestyle
Parameters
----------
obj : matplotlib object
The matplotlib line or path object, which must have a get_linestyle()
method which returns a valid matplotlib line code
Returns
-------
dasharra... | def get_dasharray(obj):
"""Get an SVG dash array for the given matplotlib linestyle
Parameters
----------
obj : matplotlib object
The matplotlib line or path object, which must have a get_linestyle()
method which returns a valid matplotlib line code
Returns
-------
dasharra... | [
"Get",
"an",
"SVG",
"dash",
"array",
"for",
"the",
"given",
"matplotlib",
"linestyle"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L43-L66 | [
"def",
"get_dasharray",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"__dict__",
".",
"get",
"(",
"'_dashSeq'",
",",
"None",
")",
"is",
"not",
"None",
":",
"return",
"','",
".",
"join",
"(",
"map",
"(",
"str",
",",
"obj",
".",
"_dashSeq",
")",
")",
"e... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SVG_path | Construct the vertices and SVG codes for the path
Parameters
----------
path : matplotlib.Path object
transform : matplotlib transform (optional)
if specified, the path will be transformed before computing the output.
Returns
-------
vertices : array
The shape (M, 2) array... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def SVG_path(path, transform=None, simplify=False):
"""Construct the vertices and SVG codes for the path
Parameters
----------
path : matplotlib.Path object
transform : matplotlib transform (optional)
if specified, the path will be transformed before computing the output.
Returns
... | def SVG_path(path, transform=None, simplify=False):
"""Construct the vertices and SVG codes for the path
Parameters
----------
path : matplotlib.Path object
transform : matplotlib transform (optional)
if specified, the path will be transformed before computing the output.
Returns
... | [
"Construct",
"the",
"vertices",
"and",
"SVG",
"codes",
"for",
"the",
"path"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L76-L111 | [
"def",
"SVG_path",
"(",
"path",
",",
"transform",
"=",
"None",
",",
"simplify",
"=",
"False",
")",
":",
"if",
"transform",
"is",
"not",
"None",
":",
"path",
"=",
"path",
".",
"transformed",
"(",
"transform",
")",
"vc_tuples",
"=",
"[",
"(",
"vertices",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_path_style | Get the style dictionary for matplotlib path objects | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_path_style(path, fill=True):
"""Get the style dictionary for matplotlib path objects"""
style = {}
style['alpha'] = path.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['edgecolor'] = color_to_hex(path.get_edgecolor())
if fill:
style['facecolor'] = color_t... | def get_path_style(path, fill=True):
"""Get the style dictionary for matplotlib path objects"""
style = {}
style['alpha'] = path.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['edgecolor'] = color_to_hex(path.get_edgecolor())
if fill:
style['facecolor'] = color_t... | [
"Get",
"the",
"style",
"dictionary",
"for",
"matplotlib",
"path",
"objects"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L114-L128 | [
"def",
"get_path_style",
"(",
"path",
",",
"fill",
"=",
"True",
")",
":",
"style",
"=",
"{",
"}",
"style",
"[",
"'alpha'",
"]",
"=",
"path",
".",
"get_alpha",
"(",
")",
"if",
"style",
"[",
"'alpha'",
"]",
"is",
"None",
":",
"style",
"[",
"'alpha'",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_line_style | Get the style dictionary for matplotlib line objects | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_line_style(line):
"""Get the style dictionary for matplotlib line objects"""
style = {}
style['alpha'] = line.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['color'] = color_to_hex(line.get_color())
style['linewidth'] = line.get_linewidth()
style['dasharray']... | def get_line_style(line):
"""Get the style dictionary for matplotlib line objects"""
style = {}
style['alpha'] = line.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['color'] = color_to_hex(line.get_color())
style['linewidth'] = line.get_linewidth()
style['dasharray']... | [
"Get",
"the",
"style",
"dictionary",
"for",
"matplotlib",
"line",
"objects"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L131-L141 | [
"def",
"get_line_style",
"(",
"line",
")",
":",
"style",
"=",
"{",
"}",
"style",
"[",
"'alpha'",
"]",
"=",
"line",
".",
"get_alpha",
"(",
")",
"if",
"style",
"[",
"'alpha'",
"]",
"is",
"None",
":",
"style",
"[",
"'alpha'",
"]",
"=",
"1",
"style",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_marker_style | Get the style dictionary for matplotlib marker objects | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_marker_style(line):
"""Get the style dictionary for matplotlib marker objects"""
style = {}
style['alpha'] = line.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['facecolor'] = color_to_hex(line.get_markerfacecolor())
style['edgecolor'] = color_to_hex(line.get_ma... | def get_marker_style(line):
"""Get the style dictionary for matplotlib marker objects"""
style = {}
style['alpha'] = line.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['facecolor'] = color_to_hex(line.get_markerfacecolor())
style['edgecolor'] = color_to_hex(line.get_ma... | [
"Get",
"the",
"style",
"dictionary",
"for",
"matplotlib",
"marker",
"objects"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L144-L164 | [
"def",
"get_marker_style",
"(",
"line",
")",
":",
"style",
"=",
"{",
"}",
"style",
"[",
"'alpha'",
"]",
"=",
"line",
".",
"get_alpha",
"(",
")",
"if",
"style",
"[",
"'alpha'",
"]",
"is",
"None",
":",
"style",
"[",
"'alpha'",
"]",
"=",
"1",
"style",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_text_style | Return the text style dict for a text instance | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_text_style(text):
"""Return the text style dict for a text instance"""
style = {}
style['alpha'] = text.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['fontsize'] = text.get_size()
style['color'] = color_to_hex(text.get_color())
style['halign'] = text.get_hor... | def get_text_style(text):
"""Return the text style dict for a text instance"""
style = {}
style['alpha'] = text.get_alpha()
if style['alpha'] is None:
style['alpha'] = 1
style['fontsize'] = text.get_size()
style['color'] = color_to_hex(text.get_color())
style['halign'] = text.get_hor... | [
"Return",
"the",
"text",
"style",
"dict",
"for",
"a",
"text",
"instance"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L167-L180 | [
"def",
"get_text_style",
"(",
"text",
")",
":",
"style",
"=",
"{",
"}",
"style",
"[",
"'alpha'",
"]",
"=",
"text",
".",
"get_alpha",
"(",
")",
"if",
"style",
"[",
"'alpha'",
"]",
"is",
"None",
":",
"style",
"[",
"'alpha'",
"]",
"=",
"1",
"style",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_axis_properties | Return the property dictionary for a matplotlib.Axis instance | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def get_axis_properties(axis):
"""Return the property dictionary for a matplotlib.Axis instance"""
props = {}
label1On = axis._major_tick_kw.get('label1On', True)
if isinstance(axis, matplotlib.axis.XAxis):
if label1On:
props['position'] = "bottom"
else:
props['p... | def get_axis_properties(axis):
"""Return the property dictionary for a matplotlib.Axis instance"""
props = {}
label1On = axis._major_tick_kw.get('label1On', True)
if isinstance(axis, matplotlib.axis.XAxis):
if label1On:
props['position'] = "bottom"
else:
props['p... | [
"Return",
"the",
"property",
"dictionary",
"for",
"a",
"matplotlib",
".",
"Axis",
"instance"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L183-L233 | [
"def",
"get_axis_properties",
"(",
"axis",
")",
":",
"props",
"=",
"{",
"}",
"label1On",
"=",
"axis",
".",
"_major_tick_kw",
".",
"get",
"(",
"'label1On'",
",",
"True",
")",
"if",
"isinstance",
"(",
"axis",
",",
"matplotlib",
".",
"axis",
".",
"XAxis",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | iter_all_children | Returns an iterator over all childen and nested children using
obj's get_children() method
if skipContainers is true, only childless objects are returned. | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def iter_all_children(obj, skipContainers=False):
"""
Returns an iterator over all childen and nested children using
obj's get_children() method
if skipContainers is true, only childless objects are returned.
"""
if hasattr(obj, 'get_children') and len(obj.get_children()) > 0:
for child... | def iter_all_children(obj, skipContainers=False):
"""
Returns an iterator over all childen and nested children using
obj's get_children() method
if skipContainers is true, only childless objects are returned.
"""
if hasattr(obj, 'get_children') and len(obj.get_children()) > 0:
for child... | [
"Returns",
"an",
"iterator",
"over",
"all",
"childen",
"and",
"nested",
"children",
"using",
"obj",
"s",
"get_children",
"()",
"method"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L304-L319 | [
"def",
"iter_all_children",
"(",
"obj",
",",
"skipContainers",
"=",
"False",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'get_children'",
")",
"and",
"len",
"(",
"obj",
".",
"get_children",
"(",
")",
")",
">",
"0",
":",
"for",
"child",
"in",
"obj",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | image_to_base64 | Convert a matplotlib image to a base64 png representation
Parameters
----------
image : matplotlib image object
The image to be converted.
Returns
-------
image_base64 : string
The UTF8-encoded base64 string representation of the png image. | glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py | def image_to_base64(image):
"""
Convert a matplotlib image to a base64 png representation
Parameters
----------
image : matplotlib image object
The image to be converted.
Returns
-------
image_base64 : string
The UTF8-encoded base64 string representation of the png imag... | def image_to_base64(image):
"""
Convert a matplotlib image to a base64 png representation
Parameters
----------
image : matplotlib image object
The image to be converted.
Returns
-------
image_base64 : string
The UTF8-encoded base64 string representation of the png imag... | [
"Convert",
"a",
"matplotlib",
"image",
"to",
"a",
"base64",
"png",
"representation"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplutils.py#L328-L353 | [
"def",
"image_to_base64",
"(",
"image",
")",
":",
"ax",
"=",
"image",
".",
"axes",
"binary_buffer",
"=",
"io",
".",
"BytesIO",
"(",
")",
"# image is saved in axes coordinates: we need to temporarily",
"# set the correct limits to get the correct image",
"lim",
"=",
"ax",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | set_interactive | Activate the IPython hook for VisPy. If the app is not specified, the
default is used. | glue_vispy_viewers/extern/vispy/app/inputhook.py | def set_interactive(enabled=True, app=None):
"""Activate the IPython hook for VisPy. If the app is not specified, the
default is used.
"""
if enabled:
inputhook_manager.enable_gui('vispy', app)
else:
inputhook_manager.disable_gui() | def set_interactive(enabled=True, app=None):
"""Activate the IPython hook for VisPy. If the app is not specified, the
default is used.
"""
if enabled:
inputhook_manager.enable_gui('vispy', app)
else:
inputhook_manager.disable_gui() | [
"Activate",
"the",
"IPython",
"hook",
"for",
"VisPy",
".",
"If",
"the",
"app",
"is",
"not",
"specified",
"the",
"default",
"is",
"used",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/inputhook.py#L17-L24 | [
"def",
"set_interactive",
"(",
"enabled",
"=",
"True",
",",
"app",
"=",
"None",
")",
":",
"if",
"enabled",
":",
"inputhook_manager",
".",
"enable_gui",
"(",
"'vispy'",
",",
"app",
")",
"else",
":",
"inputhook_manager",
".",
"disable_gui",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ConsoleVisual._resize_buffers | Resize buffers only if necessary | glue_vispy_viewers/extern/vispy/scene/widgets/console.py | def _resize_buffers(self, font_scale):
"""Resize buffers only if necessary"""
new_sizes = (font_scale,) + self.size
if new_sizes == self._current_sizes: # don't need resize
return
self._n_rows = int(max(self.size[1] /
(self._char_height * font_... | def _resize_buffers(self, font_scale):
"""Resize buffers only if necessary"""
new_sizes = (font_scale,) + self.size
if new_sizes == self._current_sizes: # don't need resize
return
self._n_rows = int(max(self.size[1] /
(self._char_height * font_... | [
"Resize",
"buffers",
"only",
"if",
"necessary"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/console.py#L245-L268 | [
"def",
"_resize_buffers",
"(",
"self",
",",
"font_scale",
")",
":",
"new_sizes",
"=",
"(",
"font_scale",
",",
")",
"+",
"self",
".",
"size",
"if",
"new_sizes",
"==",
"self",
".",
"_current_sizes",
":",
"# don't need resize",
"return",
"self",
".",
"_n_rows",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ConsoleVisual.clear | Clear the console | glue_vispy_viewers/extern/vispy/scene/widgets/console.py | def clear(self):
"""Clear the console"""
if hasattr(self, '_bytes_012'):
self._bytes_012.fill(0)
self._bytes_345.fill(0)
self._text_lines = [] * self._n_rows
self._pending_writes = [] | def clear(self):
"""Clear the console"""
if hasattr(self, '_bytes_012'):
self._bytes_012.fill(0)
self._bytes_345.fill(0)
self._text_lines = [] * self._n_rows
self._pending_writes = [] | [
"Clear",
"the",
"console"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/console.py#L292-L298 | [
"def",
"clear",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_bytes_012'",
")",
":",
"self",
".",
"_bytes_012",
".",
"fill",
"(",
"0",
")",
"self",
".",
"_bytes_345",
".",
"fill",
"(",
"0",
")",
"self",
".",
"_text_lines",
"=",
"[",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ConsoleVisual.write | Write text and scroll
Parameters
----------
text : str
Text to write. ``''`` can be used for a blank line, as a newline
is automatically added to the end of each line.
wrap : str
If True, long messages will be wrapped to span multiple lines. | glue_vispy_viewers/extern/vispy/scene/widgets/console.py | def write(self, text='', wrap=True):
"""Write text and scroll
Parameters
----------
text : str
Text to write. ``''`` can be used for a blank line, as a newline
is automatically added to the end of each line.
wrap : str
If True, long messages w... | def write(self, text='', wrap=True):
"""Write text and scroll
Parameters
----------
text : str
Text to write. ``''`` can be used for a blank line, as a newline
is automatically added to the end of each line.
wrap : str
If True, long messages w... | [
"Write",
"text",
"and",
"scroll"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/console.py#L300-L317 | [
"def",
"write",
"(",
"self",
",",
"text",
"=",
"''",
",",
"wrap",
"=",
"True",
")",
":",
"# Clear line",
"if",
"not",
"isinstance",
"(",
"text",
",",
"string_types",
")",
":",
"raise",
"TypeError",
"(",
"'text must be a string'",
")",
"# ensure we only have ... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ConsoleVisual._do_pending_writes | Do any pending text writes | glue_vispy_viewers/extern/vispy/scene/widgets/console.py | def _do_pending_writes(self):
"""Do any pending text writes"""
for text, wrap in self._pending_writes:
# truncate in case of *really* long messages
text = text[-self._n_cols*self._n_rows:]
text = text.split('\n')
text = [t if len(t) > 0 else '' for t in te... | def _do_pending_writes(self):
"""Do any pending text writes"""
for text, wrap in self._pending_writes:
# truncate in case of *really* long messages
text = text[-self._n_cols*self._n_rows:]
text = text.split('\n')
text = [t if len(t) > 0 else '' for t in te... | [
"Do",
"any",
"pending",
"text",
"writes"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/console.py#L319-L338 | [
"def",
"_do_pending_writes",
"(",
"self",
")",
":",
"for",
"text",
",",
"wrap",
"in",
"self",
".",
"_pending_writes",
":",
"# truncate in case of *really* long messages",
"text",
"=",
"text",
"[",
"-",
"self",
".",
"_n_cols",
"*",
"self",
".",
"_n_rows",
":",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ConsoleVisual._insert_text_buf | Insert text into bytes buffers | glue_vispy_viewers/extern/vispy/scene/widgets/console.py | def _insert_text_buf(self, line, idx):
"""Insert text into bytes buffers"""
self._bytes_012[idx] = 0
self._bytes_345[idx] = 0
# Crop text if necessary
I = np.array([ord(c) - 32 for c in line[:self._n_cols]])
I = np.clip(I, 0, len(__font_6x8__)-1)
if len(I) > 0:
... | def _insert_text_buf(self, line, idx):
"""Insert text into bytes buffers"""
self._bytes_012[idx] = 0
self._bytes_345[idx] = 0
# Crop text if necessary
I = np.array([ord(c) - 32 for c in line[:self._n_cols]])
I = np.clip(I, 0, len(__font_6x8__)-1)
if len(I) > 0:
... | [
"Insert",
"text",
"into",
"bytes",
"buffers"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/console.py#L340-L350 | [
"def",
"_insert_text_buf",
"(",
"self",
",",
"line",
",",
"idx",
")",
":",
"self",
".",
"_bytes_012",
"[",
"idx",
"]",
"=",
"0",
"self",
".",
"_bytes_345",
"[",
"idx",
"]",
"=",
"0",
"# Crop text if necessary",
"I",
"=",
"np",
".",
"array",
"(",
"[",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Function.replace | Set verbatim code replacement
It is strongly recommended to use function['$foo'] = 'bar' where
possible because template variables are less likely to changed
than the code itself in future versions of vispy.
Parameters
----------
str1 : str
S... | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def replace(self, str1, str2):
""" Set verbatim code replacement
It is strongly recommended to use function['$foo'] = 'bar' where
possible because template variables are less likely to changed
than the code itself in future versions of vispy.
Parameters
... | def replace(self, str1, str2):
""" Set verbatim code replacement
It is strongly recommended to use function['$foo'] = 'bar' where
possible because template variables are less likely to changed
than the code itself in future versions of vispy.
Parameters
... | [
"Set",
"verbatim",
"code",
"replacement",
"It",
"is",
"strongly",
"recommended",
"to",
"use",
"function",
"[",
"$foo",
"]",
"=",
"bar",
"where",
"possible",
"because",
"template",
"variables",
"are",
"less",
"likely",
"to",
"changed",
"than",
"the",
"code",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L378-L394 | [
"def",
"replace",
"(",
"self",
",",
"str1",
",",
"str2",
")",
":",
"if",
"str2",
"!=",
"self",
".",
"_replacements",
".",
"get",
"(",
"str1",
",",
"None",
")",
":",
"self",
".",
"_replacements",
"[",
"str1",
"]",
"=",
"str2",
"self",
".",
"changed"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Function._parse_template_vars | find all template variables in self._code, excluding the
function name. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def _parse_template_vars(self):
""" find all template variables in self._code, excluding the
function name.
"""
template_vars = set()
for var in parsing.find_template_variables(self._code):
var = var.lstrip('$')
if var == self.name:
contin... | def _parse_template_vars(self):
""" find all template variables in self._code, excluding the
function name.
"""
template_vars = set()
for var in parsing.find_template_variables(self._code):
var = var.lstrip('$')
if var == self.name:
contin... | [
"find",
"all",
"template",
"variables",
"in",
"self",
".",
"_code",
"excluding",
"the",
"function",
"name",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L399-L412 | [
"def",
"_parse_template_vars",
"(",
"self",
")",
":",
"template_vars",
"=",
"set",
"(",
")",
"for",
"var",
"in",
"parsing",
".",
"find_template_variables",
"(",
"self",
".",
"_code",
")",
":",
"var",
"=",
"var",
".",
"lstrip",
"(",
"'$'",
")",
"if",
"v... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Function._get_replaced_code | Return code, with new name, expressions, and replacements applied. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def _get_replaced_code(self, names):
""" Return code, with new name, expressions, and replacements applied.
"""
code = self._code
# Modify name
fname = names[self]
code = code.replace(" " + self.name + "(", " " + fname + "(")
# Apply string replacements ... | def _get_replaced_code(self, names):
""" Return code, with new name, expressions, and replacements applied.
"""
code = self._code
# Modify name
fname = names[self]
code = code.replace(" " + self.name + "(", " " + fname + "(")
# Apply string replacements ... | [
"Return",
"code",
"with",
"new",
"name",
"expressions",
"and",
"replacements",
"applied",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L414-L472 | [
"def",
"_get_replaced_code",
"(",
"self",
",",
"names",
")",
":",
"code",
"=",
"self",
".",
"_code",
"# Modify name",
"fname",
"=",
"names",
"[",
"self",
"]",
"code",
"=",
"code",
".",
"replace",
"(",
"\" \"",
"+",
"self",
".",
"name",
"+",
"\"(\"",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Function._clean_code | Return *code* with indentation and leading/trailing blank lines
removed. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def _clean_code(self, code):
""" Return *code* with indentation and leading/trailing blank lines
removed.
"""
lines = code.split("\n")
min_indent = 100
for line in lines:
if line.strip() != "":
indent = len(line) - len(line.lstrip())
... | def _clean_code(self, code):
""" Return *code* with indentation and leading/trailing blank lines
removed.
"""
lines = code.split("\n")
min_indent = 100
for line in lines:
if line.strip() != "":
indent = len(line) - len(line.lstrip())
... | [
"Return",
"*",
"code",
"*",
"with",
"indentation",
"and",
"leading",
"/",
"trailing",
"blank",
"lines",
"removed",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L480-L493 | [
"def",
"_clean_code",
"(",
"self",
",",
"code",
")",
":",
"lines",
"=",
"code",
".",
"split",
"(",
"\"\\n\"",
")",
"min_indent",
"=",
"100",
"for",
"line",
"in",
"lines",
":",
"if",
"line",
".",
"strip",
"(",
")",
"!=",
"\"\"",
":",
"indent",
"=",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MainFunction.add_chain | Create a new ChainFunction and attach to $var. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def add_chain(self, var):
"""
Create a new ChainFunction and attach to $var.
"""
chain = FunctionChain(var, [])
self._chains[var] = chain
self[var] = chain | def add_chain(self, var):
"""
Create a new ChainFunction and attach to $var.
"""
chain = FunctionChain(var, [])
self._chains[var] = chain
self[var] = chain | [
"Create",
"a",
"new",
"ChainFunction",
"and",
"attach",
"to",
"$var",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L540-L546 | [
"def",
"add_chain",
"(",
"self",
",",
"var",
")",
":",
"chain",
"=",
"FunctionChain",
"(",
"var",
",",
"[",
"]",
")",
"self",
".",
"_chains",
"[",
"var",
"]",
"=",
"chain",
"self",
"[",
"var",
"]",
"=",
"chain"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | FunctionChain.append | Append a new function to the end of this chain. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def append(self, function, update=True):
""" Append a new function to the end of this chain.
"""
self._funcs.append(function)
self._add_dep(function)
if update:
self._update() | def append(self, function, update=True):
""" Append a new function to the end of this chain.
"""
self._funcs.append(function)
self._add_dep(function)
if update:
self._update() | [
"Append",
"a",
"new",
"function",
"to",
"the",
"end",
"of",
"this",
"chain",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L655-L661 | [
"def",
"append",
"(",
"self",
",",
"function",
",",
"update",
"=",
"True",
")",
":",
"self",
".",
"_funcs",
".",
"append",
"(",
"function",
")",
"self",
".",
"_add_dep",
"(",
"function",
")",
"if",
"update",
":",
"self",
".",
"_update",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | FunctionChain.insert | Insert a new function into the chain at *index*. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def insert(self, index, function, update=True):
""" Insert a new function into the chain at *index*.
"""
self._funcs.insert(index, function)
self._add_dep(function)
if update:
self._update() | def insert(self, index, function, update=True):
""" Insert a new function into the chain at *index*.
"""
self._funcs.insert(index, function)
self._add_dep(function)
if update:
self._update() | [
"Insert",
"a",
"new",
"function",
"into",
"the",
"chain",
"at",
"*",
"index",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L673-L679 | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"function",
",",
"update",
"=",
"True",
")",
":",
"self",
".",
"_funcs",
".",
"insert",
"(",
"index",
",",
"function",
")",
"self",
".",
"_add_dep",
"(",
"function",
")",
"if",
"update",
":",
"self",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | FunctionChain.remove | Remove a function from the chain. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def remove(self, function, update=True):
""" Remove a function from the chain.
"""
self._funcs.remove(function)
self._remove_dep(function)
if update:
self._update() | def remove(self, function, update=True):
""" Remove a function from the chain.
"""
self._funcs.remove(function)
self._remove_dep(function)
if update:
self._update() | [
"Remove",
"a",
"function",
"from",
"the",
"chain",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L681-L687 | [
"def",
"remove",
"(",
"self",
",",
"function",
",",
"update",
"=",
"True",
")",
":",
"self",
".",
"_funcs",
".",
"remove",
"(",
"function",
")",
"self",
".",
"_remove_dep",
"(",
"function",
")",
"if",
"update",
":",
"self",
".",
"_update",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | StatementList.add | Add an item to the list unless it is already present.
If the item is an expression, then a semicolon will be appended to it
in the final compiled code. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def add(self, item, position=5):
"""Add an item to the list unless it is already present.
If the item is an expression, then a semicolon will be appended to it
in the final compiled code.
"""
if item in self.items:
return
self.items[item] = position
... | def add(self, item, position=5):
"""Add an item to the list unless it is already present.
If the item is an expression, then a semicolon will be appended to it
in the final compiled code.
"""
if item in self.items:
return
self.items[item] = position
... | [
"Add",
"an",
"item",
"to",
"the",
"list",
"unless",
"it",
"is",
"already",
"present",
".",
"If",
"the",
"item",
"is",
"an",
"expression",
"then",
"a",
"semicolon",
"will",
"be",
"appended",
"to",
"it",
"in",
"the",
"final",
"compiled",
"code",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L748-L759 | [
"def",
"add",
"(",
"self",
",",
"item",
",",
"position",
"=",
"5",
")",
":",
"if",
"item",
"in",
"self",
".",
"items",
":",
"return",
"self",
".",
"items",
"[",
"item",
"]",
"=",
"position",
"self",
".",
"_add_dep",
"(",
"item",
")",
"self",
".",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | StatementList.remove | Remove an item from the list. | glue_vispy_viewers/extern/vispy/visuals/shaders/function.py | def remove(self, item):
"""Remove an item from the list.
"""
self.items.pop(item)
self._remove_dep(item)
self.order = None
self.changed(code_changed=True) | def remove(self, item):
"""Remove an item from the list.
"""
self.items.pop(item)
self._remove_dep(item)
self.order = None
self.changed(code_changed=True) | [
"Remove",
"an",
"item",
"from",
"the",
"list",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/function.py#L761-L767 | [
"def",
"remove",
"(",
"self",
",",
"item",
")",
":",
"self",
".",
"items",
".",
"pop",
"(",
"item",
")",
"self",
".",
"_remove_dep",
"(",
"item",
")",
"self",
".",
"order",
"=",
"None",
"self",
".",
"changed",
"(",
"code_changed",
"=",
"True",
")"
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PolygonData.faces | Return an array (Nf, 3) of vertex indexes, three per triangular
face in the mesh.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None. | glue_vispy_viewers/extern/vispy/geometry/polygon.py | def faces(self):
"""Return an array (Nf, 3) of vertex indexes, three per triangular
face in the mesh.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces ... | def faces(self):
"""Return an array (Nf, 3) of vertex indexes, three per triangular
face in the mesh.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces ... | [
"Return",
"an",
"array",
"(",
"Nf",
"3",
")",
"of",
"vertex",
"indexes",
"three",
"per",
"triangular",
"face",
"in",
"the",
"mesh",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/polygon.py#L36-L49 | [
"def",
"faces",
"(",
"self",
")",
":",
"if",
"self",
".",
"_faces",
"is",
"None",
":",
"if",
"self",
".",
"_vertices",
"is",
"None",
":",
"return",
"None",
"self",
".",
"triangulate",
"(",
")",
"return",
"self",
".",
"_faces"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PolygonData.vertices | Return an array (Nf, 3) of vertices.
If only faces exist, the function computes the vertices and
returns them.
If no vertices or faces are specified, the function returns None. | glue_vispy_viewers/extern/vispy/geometry/polygon.py | def vertices(self):
"""Return an array (Nf, 3) of vertices.
If only faces exist, the function computes the vertices and
returns them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces is None:
if self._vertices is None:
... | def vertices(self):
"""Return an array (Nf, 3) of vertices.
If only faces exist, the function computes the vertices and
returns them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces is None:
if self._vertices is None:
... | [
"Return",
"an",
"array",
"(",
"Nf",
"3",
")",
"of",
"vertices",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/polygon.py#L60-L72 | [
"def",
"vertices",
"(",
"self",
")",
":",
"if",
"self",
".",
"_faces",
"is",
"None",
":",
"if",
"self",
".",
"_vertices",
"is",
"None",
":",
"return",
"None",
"self",
".",
"triangulate",
"(",
")",
"return",
"self",
".",
"_vertices"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PolygonData.convex_hull | Return an array of vertex indexes representing the convex hull.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None. | glue_vispy_viewers/extern/vispy/geometry/polygon.py | def convex_hull(self):
"""Return an array of vertex indexes representing the convex hull.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces is None:
... | def convex_hull(self):
"""Return an array of vertex indexes representing the convex hull.
If faces have not been computed for this mesh, the function
computes them.
If no vertices or faces are specified, the function returns None.
"""
if self._faces is None:
... | [
"Return",
"an",
"array",
"of",
"vertex",
"indexes",
"representing",
"the",
"convex",
"hull",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/polygon.py#L98-L109 | [
"def",
"convex_hull",
"(",
"self",
")",
":",
"if",
"self",
".",
"_faces",
"is",
"None",
":",
"if",
"self",
".",
"_vertices",
"is",
"None",
":",
"return",
"None",
"self",
".",
"triangulate",
"(",
")",
"return",
"self",
".",
"_convex_hull"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PolygonData.triangulate | Triangulates the set of vertices and stores the triangles in faces and
the convex hull in convex_hull. | glue_vispy_viewers/extern/vispy/geometry/polygon.py | def triangulate(self):
"""
Triangulates the set of vertices and stores the triangles in faces and
the convex hull in convex_hull.
"""
npts = self._vertices.shape[0]
if np.any(self._vertices[0] != self._vertices[1]):
# start != end, so edges must wrap around to... | def triangulate(self):
"""
Triangulates the set of vertices and stores the triangles in faces and
the convex hull in convex_hull.
"""
npts = self._vertices.shape[0]
if np.any(self._vertices[0] != self._vertices[1]):
# start != end, so edges must wrap around to... | [
"Triangulates",
"the",
"set",
"of",
"vertices",
"and",
"stores",
"the",
"triangles",
"in",
"faces",
"and",
"the",
"convex",
"hull",
"in",
"convex_hull",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/polygon.py#L111-L131 | [
"def",
"triangulate",
"(",
"self",
")",
":",
"npts",
"=",
"self",
".",
"_vertices",
".",
"shape",
"[",
"0",
"]",
"if",
"np",
".",
"any",
"(",
"self",
".",
"_vertices",
"[",
"0",
"]",
"!=",
"self",
".",
"_vertices",
"[",
"1",
"]",
")",
":",
"# s... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | find | Locate a filename into the shader library. | glue_vispy_viewers/extern/vispy/glsl/__init__.py | def find(name):
"""Locate a filename into the shader library."""
if op.exists(name):
return name
path = op.dirname(__file__) or '.'
paths = [path] + config['include_path']
for path in paths:
filename = op.abspath(op.join(path, name))
if op.exists(filename):
re... | def find(name):
"""Locate a filename into the shader library."""
if op.exists(name):
return name
path = op.dirname(__file__) or '.'
paths = [path] + config['include_path']
for path in paths:
filename = op.abspath(op.join(path, name))
if op.exists(filename):
re... | [
"Locate",
"a",
"filename",
"into",
"the",
"shader",
"library",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/glsl/__init__.py#L12-L34 | [
"def",
"find",
"(",
"name",
")",
":",
"if",
"op",
".",
"exists",
"(",
"name",
")",
":",
"return",
"name",
"path",
"=",
"op",
".",
"dirname",
"(",
"__file__",
")",
"or",
"'.'",
"paths",
"=",
"[",
"path",
"]",
"+",
"config",
"[",
"'include_path'",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get | Retrieve code from the given filename. | glue_vispy_viewers/extern/vispy/glsl/__init__.py | def get(name):
"""Retrieve code from the given filename."""
filename = find(name)
if filename is None:
raise RuntimeError('Could not find %s' % name)
with open(filename) as fid:
return fid.read() | def get(name):
"""Retrieve code from the given filename."""
filename = find(name)
if filename is None:
raise RuntimeError('Could not find %s' % name)
with open(filename) as fid:
return fid.read() | [
"Retrieve",
"code",
"from",
"the",
"given",
"filename",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/glsl/__init__.py#L37-L44 | [
"def",
"get",
"(",
"name",
")",
":",
"filename",
"=",
"find",
"(",
"name",
")",
"if",
"filename",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Could not find %s'",
"%",
"name",
")",
"with",
"open",
"(",
"filename",
")",
"as",
"fid",
":",
"return"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | expect | try many times as in times with sleep time | tradingAPI/utils.py | def expect(func, args, times=7, sleep_t=0.5):
"""try many times as in times with sleep time"""
while times > 0:
try:
return func(*args)
except Exception as e:
times -= 1
logger.debug("expect failed - attempts left: %d" % times)
time.sleep(sleep_t)
... | def expect(func, args, times=7, sleep_t=0.5):
"""try many times as in times with sleep time"""
while times > 0:
try:
return func(*args)
except Exception as e:
times -= 1
logger.debug("expect failed - attempts left: %d" % times)
time.sleep(sleep_t)
... | [
"try",
"many",
"times",
"as",
"in",
"times",
"with",
"sleep",
"time"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/utils.py#L20-L30 | [
"def",
"expect",
"(",
"func",
",",
"args",
",",
"times",
"=",
"7",
",",
"sleep_t",
"=",
"0.5",
")",
":",
"while",
"times",
">",
"0",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
")",
"except",
"Exception",
"as",
"e",
":",
"times",
"-=",
... | 0fab20b71a2348e72bbe76071b81f3692128851f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.