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 | num | convert a string to float | tradingAPI/utils.py | def num(string):
"""convert a string to float"""
if not isinstance(string, type('')):
raise ValueError(type(''))
try:
string = re.sub('[^a-zA-Z0-9\.\-]', '', string)
number = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", string)
return float(number[0])
except Exception as e:
... | def num(string):
"""convert a string to float"""
if not isinstance(string, type('')):
raise ValueError(type(''))
try:
string = re.sub('[^a-zA-Z0-9\.\-]', '', string)
number = re.findall(r"[-+]?\d*\.\d+|[-+]?\d+", string)
return float(number[0])
except Exception as e:
... | [
"convert",
"a",
"string",
"to",
"float"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/utils.py#L33-L45 | [
"def",
"num",
"(",
"string",
")",
":",
"if",
"not",
"isinstance",
"(",
"string",
",",
"type",
"(",
"''",
")",
")",
":",
"raise",
"ValueError",
"(",
"type",
"(",
"''",
")",
")",
"try",
":",
"string",
"=",
"re",
".",
"sub",
"(",
"'[^a-zA-Z0-9\\.\\-]'... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | get_number_unit | get the unit of number | tradingAPI/utils.py | def get_number_unit(number):
"""get the unit of number"""
n = str(float(number))
mult, submult = n.split('.')
if float(submult) != 0:
unit = '0.' + (len(submult)-1)*'0' + '1'
return float(unit)
else:
return float(1) | def get_number_unit(number):
"""get the unit of number"""
n = str(float(number))
mult, submult = n.split('.')
if float(submult) != 0:
unit = '0.' + (len(submult)-1)*'0' + '1'
return float(unit)
else:
return float(1) | [
"get",
"the",
"unit",
"of",
"number"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/utils.py#L48-L56 | [
"def",
"get_number_unit",
"(",
"number",
")",
":",
"n",
"=",
"str",
"(",
"float",
"(",
"number",
")",
")",
"mult",
",",
"submult",
"=",
"n",
".",
"split",
"(",
"'.'",
")",
"if",
"float",
"(",
"submult",
")",
"!=",
"0",
":",
"unit",
"=",
"'0.'",
... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | get_pip | get value of pip | tradingAPI/utils.py | def get_pip(mov=None, api=None, name=None):
"""get value of pip"""
# ~ check args
if mov is None and api is None:
logger.error("need at least one of those")
raise ValueError()
elif mov is not None and api is not None:
logger.error("mov and api are exclusive")
raise ValueE... | def get_pip(mov=None, api=None, name=None):
"""get value of pip"""
# ~ check args
if mov is None and api is None:
logger.error("need at least one of those")
raise ValueError()
elif mov is not None and api is not None:
logger.error("mov and api are exclusive")
raise ValueE... | [
"get",
"value",
"of",
"pip"
] | federico123579/Trading212-API | python | https://github.com/federico123579/Trading212-API/blob/0fab20b71a2348e72bbe76071b81f3692128851f/tradingAPI/utils.py#L59-L117 | [
"def",
"get_pip",
"(",
"mov",
"=",
"None",
",",
"api",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"# ~ check args",
"if",
"mov",
"is",
"None",
"and",
"api",
"is",
"None",
":",
"logger",
".",
"error",
"(",
"\"need at least one of those\"",
")",
"r... | 0fab20b71a2348e72bbe76071b81f3692128851f |
train | ArrayList.itemsize | Individual item sizes | glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py | def itemsize(self):
""" Individual item sizes """
return self._items[:self._count, 1] - self._items[:self._count, 0] | def itemsize(self):
""" Individual item sizes """
return self._items[:self._count, 1] - self._items[:self._count, 0] | [
"Individual",
"item",
"sizes"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py#L126-L128 | [
"def",
"itemsize",
"(",
"self",
")",
":",
"return",
"self",
".",
"_items",
"[",
":",
"self",
".",
"_count",
",",
"1",
"]",
"-",
"self",
".",
"_items",
"[",
":",
"self",
".",
"_count",
",",
"0",
"]"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArrayList.reserve | Set current capacity of the underlying array | glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py | def reserve(self, capacity):
""" Set current capacity of the underlying array"""
if capacity >= self._data.size:
capacity = int(2 ** np.ceil(np.log2(capacity)))
self._data = np.resize(self._data, capacity) | def reserve(self, capacity):
""" Set current capacity of the underlying array"""
if capacity >= self._data.size:
capacity = int(2 ** np.ceil(np.log2(capacity)))
self._data = np.resize(self._data, capacity) | [
"Set",
"current",
"capacity",
"of",
"the",
"underlying",
"array"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py#L135-L140 | [
"def",
"reserve",
"(",
"self",
",",
"capacity",
")",
":",
"if",
"capacity",
">=",
"self",
".",
"_data",
".",
"size",
":",
"capacity",
"=",
"int",
"(",
"2",
"**",
"np",
".",
"ceil",
"(",
"np",
".",
"log2",
"(",
"capacity",
")",
")",
")",
"self",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArrayList.insert | Insert data before index
Parameters
----------
index : int
Index before which data will be inserted.
data : array_like
An array, any object exposing the array interface, an object
whose __array__ method returns an array, or any (nested) sequence.
... | glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py | def insert(self, index, data, itemsize=None):
""" Insert data before index
Parameters
----------
index : int
Index before which data will be inserted.
data : array_like
An array, any object exposing the array interface, an object
whose __arr... | def insert(self, index, data, itemsize=None):
""" Insert data before index
Parameters
----------
index : int
Index before which data will be inserted.
data : array_like
An array, any object exposing the array interface, an object
whose __arr... | [
"Insert",
"data",
"before",
"index"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py#L285-L391 | [
"def",
"insert",
"(",
"self",
",",
"index",
",",
"data",
",",
"itemsize",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_sizeable",
":",
"raise",
"AttributeError",
"(",
"\"List is not sizeable\"",
")",
"if",
"isinstance",
"(",
"data",
",",
"(",
"list... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ArrayList.append | Append data to the end.
Parameters
----------
data : array_like
An array, any object exposing the array interface, an object
whose __array__ method returns an array, or any (nested) sequence.
itemsize: int or 1-D array
If `itemsize is an integer, N... | glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py | def append(self, data, itemsize=None):
"""
Append data to the end.
Parameters
----------
data : array_like
An array, any object exposing the array interface, an object
whose __array__ method returns an array, or any (nested) sequence.
itemsize: ... | def append(self, data, itemsize=None):
"""
Append data to the end.
Parameters
----------
data : array_like
An array, any object exposing the array interface, an object
whose __array__ method returns an array, or any (nested) sequence.
itemsize: ... | [
"Append",
"data",
"to",
"the",
"end",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/array_list.py#L393-L415 | [
"def",
"append",
"(",
"self",
",",
"data",
",",
"itemsize",
"=",
"None",
")",
":",
"self",
".",
"insert",
"(",
"len",
"(",
"self",
")",
",",
"data",
",",
"itemsize",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | minimize | Solve an optimization problem using the DIRECT (Dividing Rectangles) algorithm.
It can be used to solve general nonlinear programming problems of the form:
.. math::
\min_ {x \in R^n} f(x)
subject to
.. math::
x_L \leq x \leq x_U
Where :math:`x` are the... | scipydirect/__init__.py | def minimize(func, bounds=None, nvar=None, args=(), disp=False,
eps=1e-4,
maxf=20000,
maxT=6000,
algmethod=0,
fglobal=-1e100,
fglper=0.01,
volper=-1.0,
sigmaper=-1.0,
**kwargs
):
... | def minimize(func, bounds=None, nvar=None, args=(), disp=False,
eps=1e-4,
maxf=20000,
maxT=6000,
algmethod=0,
fglobal=-1e100,
fglper=0.01,
volper=-1.0,
sigmaper=-1.0,
**kwargs
):
... | [
"Solve",
"an",
"optimization",
"problem",
"using",
"the",
"DIRECT",
"(",
"Dividing",
"Rectangles",
")",
"algorithm",
".",
"It",
"can",
"be",
"used",
"to",
"solve",
"general",
"nonlinear",
"programming",
"problems",
"of",
"the",
"form",
":",
"..",
"math",
"::... | andim/scipydirect | python | https://github.com/andim/scipydirect/blob/ad36ab19e6ad64054a1d2abd22f1c993fc4b87be/scipydirect/__init__.py#L111-L258 | [
"def",
"minimize",
"(",
"func",
",",
"bounds",
"=",
"None",
",",
"nvar",
"=",
"None",
",",
"args",
"=",
"(",
")",
",",
"disp",
"=",
"False",
",",
"eps",
"=",
"1e-4",
",",
"maxf",
"=",
"20000",
",",
"maxT",
"=",
"6000",
",",
"algmethod",
"=",
"0... | ad36ab19e6ad64054a1d2abd22f1c993fc4b87be |
train | get_dpi | Get screen DPI from the OS
Parameters
----------
raise_error : bool
If True, raise an error if DPI could not be determined.
Returns
-------
dpi : float
Dots per inch of the primary screen. | glue_vispy_viewers/extern/vispy/util/dpi/_win32.py | def get_dpi(raise_error=True):
"""Get screen DPI from the OS
Parameters
----------
raise_error : bool
If True, raise an error if DPI could not be determined.
Returns
-------
dpi : float
Dots per inch of the primary screen.
"""
try:
user32.SetProcessDPIAware(... | def get_dpi(raise_error=True):
"""Get screen DPI from the OS
Parameters
----------
raise_error : bool
If True, raise an error if DPI could not be determined.
Returns
-------
dpi : float
Dots per inch of the primary screen.
"""
try:
user32.SetProcessDPIAware(... | [
"Get",
"screen",
"DPI",
"from",
"the",
"OS"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/dpi/_win32.py#L11-L34 | [
"def",
"get_dpi",
"(",
"raise_error",
"=",
"True",
")",
":",
"try",
":",
"user32",
".",
"SetProcessDPIAware",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"# not present on XP",
"dc",
"=",
"user32",
".",
"GetDC",
"(",
"0",
")",
"h_size",
"=",
"gdi32"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ModularProgram.build_if_needed | Reset shader source if necesssary. | glue_vispy_viewers/extern/vispy/visuals/shaders/program.py | def build_if_needed(self):
""" Reset shader source if necesssary.
"""
if self._need_build:
self._build()
self._need_build = False
self.update_variables() | def build_if_needed(self):
""" Reset shader source if necesssary.
"""
if self._need_build:
self._build()
self._need_build = False
self.update_variables() | [
"Reset",
"shader",
"source",
"if",
"necesssary",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/program.py#L79-L85 | [
"def",
"build_if_needed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_need_build",
":",
"self",
".",
"_build",
"(",
")",
"self",
".",
"_need_build",
"=",
"False",
"self",
".",
"update_variables",
"(",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | nmap | Returns a function that maps a number n from range (a, b) onto a range
(c, d). If no curvefn is given, linear mapping will be used. Optionally a
normalisation function normfn can be provided to transform output. | nmap/nmap.py | def nmap(a, b, c, d, curvefn=None, normfn=None):
"""
Returns a function that maps a number n from range (a, b) onto a range
(c, d). If no curvefn is given, linear mapping will be used. Optionally a
normalisation function normfn can be provided to transform output.
"""
if not curvefn:
cur... | def nmap(a, b, c, d, curvefn=None, normfn=None):
"""
Returns a function that maps a number n from range (a, b) onto a range
(c, d). If no curvefn is given, linear mapping will be used. Optionally a
normalisation function normfn can be provided to transform output.
"""
if not curvefn:
cur... | [
"Returns",
"a",
"function",
"that",
"maps",
"a",
"number",
"n",
"from",
"range",
"(",
"a",
"b",
")",
"onto",
"a",
"range",
"(",
"c",
"d",
")",
".",
"If",
"no",
"curvefn",
"is",
"given",
"linear",
"mapping",
"will",
"be",
"used",
".",
"Optionally",
... | antonagestam/nmap | python | https://github.com/antonagestam/nmap/blob/dd6d90d6a04b4cfc39687af1c081c5d6c4602dea/nmap/nmap.py#L1-L16 | [
"def",
"nmap",
"(",
"a",
",",
"b",
",",
"c",
",",
"d",
",",
"curvefn",
"=",
"None",
",",
"normfn",
"=",
"None",
")",
":",
"if",
"not",
"curvefn",
":",
"curvefn",
"=",
"lambda",
"x",
":",
"x",
"def",
"map",
"(",
"n",
")",
":",
"r",
"=",
"1.0... | dd6d90d6a04b4cfc39687af1c081c5d6c4602dea |
train | AxisWidget.link_view | Link this axis to a ViewBox
This makes it so that the axis's domain always matches the
visible range in the ViewBox.
Parameters
----------
view : instance of ViewBox
The ViewBox to link. | glue_vispy_viewers/extern/vispy/scene/widgets/axis.py | def link_view(self, view):
"""Link this axis to a ViewBox
This makes it so that the axis's domain always matches the
visible range in the ViewBox.
Parameters
----------
view : instance of ViewBox
The ViewBox to link.
"""
if view is self._link... | def link_view(self, view):
"""Link this axis to a ViewBox
This makes it so that the axis's domain always matches the
visible range in the ViewBox.
Parameters
----------
view : instance of ViewBox
The ViewBox to link.
"""
if view is self._link... | [
"Link",
"this",
"axis",
"to",
"a",
"ViewBox"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/axis.py#L61-L79 | [
"def",
"link_view",
"(",
"self",
",",
"view",
")",
":",
"if",
"view",
"is",
"self",
".",
"_linked_view",
":",
"return",
"if",
"self",
".",
"_linked_view",
"is",
"not",
"None",
":",
"self",
".",
"_linked_view",
".",
"scene",
".",
"transform",
".",
"chan... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AxisWidget._view_changed | Linked view transform has changed; update ticks. | glue_vispy_viewers/extern/vispy/scene/widgets/axis.py | def _view_changed(self, event=None):
"""Linked view transform has changed; update ticks.
"""
tr = self.node_transform(self._linked_view.scene)
p1, p2 = tr.map(self._axis_ends())
if self.orientation in ('left', 'right'):
self.axis.domain = (p1[1], p2[1])
else:
... | def _view_changed(self, event=None):
"""Linked view transform has changed; update ticks.
"""
tr = self.node_transform(self._linked_view.scene)
p1, p2 = tr.map(self._axis_ends())
if self.orientation in ('left', 'right'):
self.axis.domain = (p1[1], p2[1])
else:
... | [
"Linked",
"view",
"transform",
"has",
"changed",
";",
"update",
"ticks",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/axis.py#L81-L89 | [
"def",
"_view_changed",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"tr",
"=",
"self",
".",
"node_transform",
"(",
"self",
".",
"_linked_view",
".",
"scene",
")",
"p1",
",",
"p2",
"=",
"tr",
".",
"map",
"(",
"self",
".",
"_axis_ends",
"(",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MagnifyCamera.viewbox_mouse_event | ViewBox mouse event handler
Parameters
----------
event : instance of Event
The mouse event. | glue_vispy_viewers/extern/vispy/scene/cameras/magnify.py | def viewbox_mouse_event(self, event):
"""ViewBox mouse event handler
Parameters
----------
event : instance of Event
The mouse event.
"""
# When the attached ViewBox reseives a mouse event, it is sent to the
# camera here.
self.mouse_... | def viewbox_mouse_event(self, event):
"""ViewBox mouse event handler
Parameters
----------
event : instance of Event
The mouse event.
"""
# When the attached ViewBox reseives a mouse event, it is sent to the
# camera here.
self.mouse_... | [
"ViewBox",
"mouse",
"event",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/magnify.py#L83-L110 | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"# When the attached ViewBox reseives a mouse event, it is sent to the",
"# camera here.",
"self",
".",
"mouse_pos",
"=",
"event",
".",
"pos",
"[",
":",
"2",
"]",
"if",
"event",
".",
"type",
"==",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MagnifyCamera.on_timer | Timer event handler
Parameters
----------
event : instance of Event
The timer event. | glue_vispy_viewers/extern/vispy/scene/cameras/magnify.py | def on_timer(self, event=None):
"""Timer event handler
Parameters
----------
event : instance of Event
The timer event.
"""
# Smoothly update center and magnification properties of the transform
k = np.clip(100. / self.mag.mag, 10, 100)
s = 10... | def on_timer(self, event=None):
"""Timer event handler
Parameters
----------
event : instance of Event
The timer event.
"""
# Smoothly update center and magnification properties of the transform
k = np.clip(100. / self.mag.mag, 10, 100)
s = 10... | [
"Timer",
"event",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/magnify.py#L112-L137 | [
"def",
"on_timer",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"# Smoothly update center and magnification properties of the transform",
"k",
"=",
"np",
".",
"clip",
"(",
"100.",
"/",
"self",
".",
"mag",
".",
"mag",
",",
"10",
",",
"100",
")",
"s",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | glBufferData | Data can be numpy array or the size of data to allocate. | glue_vispy_viewers/extern/vispy/gloo/gl/_gl2.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/_gl2.py#L123-L139 | [
"def",
"glBufferData",
"(",
"target",
",",
"data",
",",
"usage",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"int",
")",
":",
"size",
"=",
"data",
"data",
"=",
"ctypes",
".",
"c_voidp",
"(",
"0",
")",
"else",
":",
"if",
"not",
"data",
".",
"f... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | next_power_of_2 | Return next power of 2 greater than or equal to n | glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py | def next_power_of_2(n):
""" Return next power of 2 greater than or equal to n """
n -= 1 # greater than OR EQUAL TO n
shift = 1
while (n + 1) & n: # n+1 is not a power of 2 yet
n |= n >> shift
shift *= 2
return max(4, n + 1) | def next_power_of_2(n):
""" Return next power of 2 greater than or equal to n """
n -= 1 # greater than OR EQUAL TO n
shift = 1
while (n + 1) & n: # n+1 is not a power of 2 yet
n |= n >> shift
shift *= 2
return max(4, n + 1) | [
"Return",
"next",
"power",
"of",
"2",
"greater",
"than",
"or",
"equal",
"to",
"n"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py#L22-L29 | [
"def",
"next_power_of_2",
"(",
"n",
")",
":",
"n",
"-=",
"1",
"# greater than OR EQUAL TO n",
"shift",
"=",
"1",
"while",
"(",
"n",
"+",
"1",
")",
"&",
"n",
":",
"# n+1 is not a power of 2 yet",
"n",
"|=",
"n",
">>",
"shift",
"shift",
"*=",
"2",
"return"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCollection.append | Parameters
----------
vertices : numpy array
An array whose dtype is compatible with self.vdtype
uniforms: numpy array
An array whose dtype is compatible with self.utype
indices : numpy array
An array whose dtype is compatible with self.idtype
... | glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py | def append(self, vertices, uniforms=None, indices=None, itemsize=None):
"""
Parameters
----------
vertices : numpy array
An array whose dtype is compatible with self.vdtype
uniforms: numpy array
An array whose dtype is compatible with self.utype
... | def append(self, vertices, uniforms=None, indices=None, itemsize=None):
"""
Parameters
----------
vertices : numpy array
An array whose dtype is compatible with self.vdtype
uniforms: numpy array
An array whose dtype is compatible with self.utype
... | [
"Parameters",
"----------"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py#L229-L313 | [
"def",
"append",
"(",
"self",
",",
"vertices",
",",
"uniforms",
"=",
"None",
",",
"indices",
"=",
"None",
",",
"itemsize",
"=",
"None",
")",
":",
"# Vertices",
"# -----------------------------",
"vertices",
"=",
"np",
".",
"array",
"(",
"vertices",
")",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCollection._compute_texture_shape | Compute uniform texture shape | glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py | def _compute_texture_shape(self, size=1):
""" Compute uniform texture shape """
# We should use this line but we may not have a GL context yet
# linesize = gl.glGetInteger(gl.GL_MAX_TEXTURE_SIZE)
linesize = 1024
count = self._uniforms_float_count
cols = 4 * linesize // i... | def _compute_texture_shape(self, size=1):
""" Compute uniform texture shape """
# We should use this line but we may not have a GL context yet
# linesize = gl.glGetInteger(gl.GL_MAX_TEXTURE_SIZE)
linesize = 1024
count = self._uniforms_float_count
cols = 4 * linesize // i... | [
"Compute",
"uniform",
"texture",
"shape"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py#L453-L464 | [
"def",
"_compute_texture_shape",
"(",
"self",
",",
"size",
"=",
"1",
")",
":",
"# We should use this line but we may not have a GL context yet",
"# linesize = gl.glGetInteger(gl.GL_MAX_TEXTURE_SIZE)",
"linesize",
"=",
"1024",
"count",
"=",
"self",
".",
"_uniforms_float_count",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseCollection._update | Update vertex buffers & texture | glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py | def _update(self):
""" Update vertex buffers & texture """
if self._vertices_buffer is not None:
self._vertices_buffer.delete()
self._vertices_buffer = VertexBuffer(self._vertices_list.data)
if self.itype is not None:
if self._indices_buffer is not None:
... | def _update(self):
""" Update vertex buffers & texture """
if self._vertices_buffer is not None:
self._vertices_buffer.delete()
self._vertices_buffer = VertexBuffer(self._vertices_list.data)
if self.itype is not None:
if self._indices_buffer is not None:
... | [
"Update",
"vertex",
"buffers",
"&",
"texture"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/base_collection.py#L466-L498 | [
"def",
"_update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_vertices_buffer",
"is",
"not",
"None",
":",
"self",
".",
"_vertices_buffer",
".",
"delete",
"(",
")",
"self",
".",
"_vertices_buffer",
"=",
"VertexBuffer",
"(",
"self",
".",
"_vertices_list",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_layout | Retrieve a graph layout
Some graph layouts accept extra options. Please refer to their
documentation for more information.
Parameters
----------
name : string
The name of the layout. The variable `AVAILABLE_LAYOUTS`
contains all available layouts.
*args
Positional argum... | glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/__init__.py | def get_layout(name, *args, **kwargs):
"""
Retrieve a graph layout
Some graph layouts accept extra options. Please refer to their
documentation for more information.
Parameters
----------
name : string
The name of the layout. The variable `AVAILABLE_LAYOUTS`
contains all av... | def get_layout(name, *args, **kwargs):
"""
Retrieve a graph layout
Some graph layouts accept extra options. Please refer to their
documentation for more information.
Parameters
----------
name : string
The name of the layout. The variable `AVAILABLE_LAYOUTS`
contains all av... | [
"Retrieve",
"a",
"graph",
"layout"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/__init__.py#L22-L53 | [
"def",
"get_layout",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"name",
"not",
"in",
"_layout_map",
":",
"raise",
"KeyError",
"(",
"\"Graph layout '%s' not found. Should be one of %s\"",
"%",
"(",
"name",
",",
"AVAILABLE_LAYOUTS",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | update_viewer_state | Given viewer session information, make sure the session information is
compatible with the current version of the viewers, and if not, update
the session information in-place. | glue_vispy_viewers/common/compat.py | def update_viewer_state(rec, context):
"""
Given viewer session information, make sure the session information is
compatible with the current version of the viewers, and if not, update
the session information in-place.
"""
if '_protocol' not in rec:
rec.pop('properties')
rec['... | def update_viewer_state(rec, context):
"""
Given viewer session information, make sure the session information is
compatible with the current version of the viewers, and if not, update
the session information in-place.
"""
if '_protocol' not in rec:
rec.pop('properties')
rec['... | [
"Given",
"viewer",
"session",
"information",
"make",
"sure",
"the",
"session",
"information",
"is",
"compatible",
"with",
"the",
"current",
"version",
"of",
"the",
"viewers",
"and",
"if",
"not",
"update",
"the",
"session",
"information",
"in",
"-",
"place",
".... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/common/compat.py#L18-L55 | [
"def",
"update_viewer_state",
"(",
"rec",
",",
"context",
")",
":",
"if",
"'_protocol'",
"not",
"in",
"rec",
":",
"rec",
".",
"pop",
"(",
"'properties'",
")",
"rec",
"[",
"'state'",
"]",
"=",
"{",
"}",
"rec",
"[",
"'state'",
"]",
"[",
"'values'",
"]"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | remove_comments | Remove C-style comment from GLSL code string. | glue_vispy_viewers/extern/vispy/gloo/preprocessor.py | def remove_comments(code):
"""Remove C-style comment from GLSL code string."""
pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*\n)"
# first group captures quoted strings (double or single)
# second group captures comments (//single-line or /* multi-line */)
regex = re.compile(pattern, re.MULTILI... | def remove_comments(code):
"""Remove C-style comment from GLSL code string."""
pattern = r"(\".*?\"|\'.*?\')|(/\*.*?\*/|//[^\r\n]*\n)"
# first group captures quoted strings (double or single)
# second group captures comments (//single-line or /* multi-line */)
regex = re.compile(pattern, re.MULTILI... | [
"Remove",
"C",
"-",
"style",
"comment",
"from",
"GLSL",
"code",
"string",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/preprocessor.py#L12-L28 | [
"def",
"remove_comments",
"(",
"code",
")",
":",
"pattern",
"=",
"r\"(\\\".*?\\\"|\\'.*?\\')|(/\\*.*?\\*/|//[^\\r\\n]*\\n)\"",
"# first group captures quoted strings (double or single)",
"# second group captures comments (//single-line or /* multi-line */)",
"regex",
"=",
"re",
".",
"c... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | merge_includes | Merge all includes recursively. | glue_vispy_viewers/extern/vispy/gloo/preprocessor.py | def merge_includes(code):
"""Merge all includes recursively."""
pattern = '\#\s*include\s*"(?P<filename>[a-zA-Z0-9\_\-\.\/]+)"'
regex = re.compile(pattern)
includes = []
def replace(match):
filename = match.group("filename")
if filename not in includes:
includes.append... | def merge_includes(code):
"""Merge all includes recursively."""
pattern = '\#\s*include\s*"(?P<filename>[a-zA-Z0-9\_\-\.\/]+)"'
regex = re.compile(pattern)
includes = []
def replace(match):
filename = match.group("filename")
if filename not in includes:
includes.append... | [
"Merge",
"all",
"includes",
"recursively",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/preprocessor.py#L31-L61 | [
"def",
"merge_includes",
"(",
"code",
")",
":",
"pattern",
"=",
"'\\#\\s*include\\s*\"(?P<filename>[a-zA-Z0-9\\_\\-\\.\\/]+)\"'",
"regex",
"=",
"re",
".",
"compile",
"(",
"pattern",
")",
"includes",
"=",
"[",
"]",
"def",
"replace",
"(",
"match",
")",
":",
"filen... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Grid.add_widget | Add a new widget to this grid. This will cause other widgets in the
grid to be resized to make room for the new widget. Can be used
to replace a widget as well
Parameters
----------
widget : Widget | None
The Widget to add. New widget is constructed if widget is None... | glue_vispy_viewers/extern/vispy/scene/widgets/grid.py | def add_widget(self, widget=None, row=None, col=None, row_span=1,
col_span=1, **kwargs):
"""
Add a new widget to this grid. This will cause other widgets in the
grid to be resized to make room for the new widget. Can be used
to replace a widget as well
Paramet... | def add_widget(self, widget=None, row=None, col=None, row_span=1,
col_span=1, **kwargs):
"""
Add a new widget to this grid. This will cause other widgets in the
grid to be resized to make room for the new widget. Can be used
to replace a widget as well
Paramet... | [
"Add",
"a",
"new",
"widget",
"to",
"this",
"grid",
".",
"This",
"will",
"cause",
"other",
"widgets",
"in",
"the",
"grid",
"to",
"be",
"resized",
"to",
"make",
"room",
"for",
"the",
"new",
"widget",
".",
"Can",
"be",
"used",
"to",
"replace",
"a",
"wid... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/grid.py#L85-L148 | [
"def",
"add_widget",
"(",
"self",
",",
"widget",
"=",
"None",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"row_span",
"=",
"1",
",",
"col_span",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"row",
"is",
"None",
":",
"row",
"=",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Grid.remove_widget | Remove a widget from this grid
Parameters
----------
widget : Widget
The Widget to remove | glue_vispy_viewers/extern/vispy/scene/widgets/grid.py | def remove_widget(self, widget):
"""Remove a widget from this grid
Parameters
----------
widget : Widget
The Widget to remove
"""
self._grid_widgets = dict((key, val)
for (key, val) in self._grid_widgets.items()
... | def remove_widget(self, widget):
"""Remove a widget from this grid
Parameters
----------
widget : Widget
The Widget to remove
"""
self._grid_widgets = dict((key, val)
for (key, val) in self._grid_widgets.items()
... | [
"Remove",
"a",
"widget",
"from",
"this",
"grid"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/grid.py#L150-L163 | [
"def",
"remove_widget",
"(",
"self",
",",
"widget",
")",
":",
"self",
".",
"_grid_widgets",
"=",
"dict",
"(",
"(",
"key",
",",
"val",
")",
"for",
"(",
"key",
",",
"val",
")",
"in",
"self",
".",
"_grid_widgets",
".",
"items",
"(",
")",
"if",
"val",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Grid.resize_widget | Resize a widget in the grid to new dimensions.
Parameters
----------
widget : Widget
The widget to resize
row_span : int
The number of rows to be occupied by this widget.
col_span : int
The number of columns to be occupied by this widget. | glue_vispy_viewers/extern/vispy/scene/widgets/grid.py | def resize_widget(self, widget, row_span, col_span):
"""Resize a widget in the grid to new dimensions.
Parameters
----------
widget : Widget
The widget to resize
row_span : int
The number of rows to be occupied by this widget.
col_span : int
... | def resize_widget(self, widget, row_span, col_span):
"""Resize a widget in the grid to new dimensions.
Parameters
----------
widget : Widget
The widget to resize
row_span : int
The number of rows to be occupied by this widget.
col_span : int
... | [
"Resize",
"a",
"widget",
"in",
"the",
"grid",
"to",
"new",
"dimensions",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/grid.py#L165-L193 | [
"def",
"resize_widget",
"(",
"self",
",",
"widget",
",",
"row_span",
",",
"col_span",
")",
":",
"row",
"=",
"None",
"col",
"=",
"None",
"for",
"(",
"r",
",",
"c",
",",
"rspan",
",",
"cspan",
",",
"w",
")",
"in",
"self",
".",
"_grid_widgets",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Grid.add_grid | Create a new Grid and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
The column in which to add the widget (0 is the leftmost column)
row_span : int
The number of r... | glue_vispy_viewers/extern/vispy/scene/widgets/grid.py | def add_grid(self, row=None, col=None, row_span=1, col_span=1,
**kwargs):
"""
Create a new Grid and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
The ... | def add_grid(self, row=None, col=None, row_span=1, col_span=1,
**kwargs):
"""
Create a new Grid and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
The ... | [
"Create",
"a",
"new",
"Grid",
"and",
"add",
"it",
"as",
"a",
"child",
"widget",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/grid.py#L198-L218 | [
"def",
"add_grid",
"(",
"self",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"row_span",
"=",
"1",
",",
"col_span",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"grid",
"import",
"Grid",
"grid",
"=",
"Grid",
"(",
"*",
"*"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Grid.add_view | Create a new ViewBox and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
The column in which to add the widget (0 is the leftmost column)
row_span : int
The number o... | glue_vispy_viewers/extern/vispy/scene/widgets/grid.py | def add_view(self, row=None, col=None, row_span=1, col_span=1,
**kwargs):
"""
Create a new ViewBox and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
T... | def add_view(self, row=None, col=None, row_span=1, col_span=1,
**kwargs):
"""
Create a new ViewBox and add it as a child widget.
Parameters
----------
row : int
The row in which to add the widget (0 is the topmost row)
col : int
T... | [
"Create",
"a",
"new",
"ViewBox",
"and",
"add",
"it",
"as",
"a",
"child",
"widget",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/widgets/grid.py#L220-L240 | [
"def",
"add_view",
"(",
"self",
",",
"row",
"=",
"None",
",",
"col",
"=",
"None",
",",
"row_span",
"=",
"1",
",",
"col_span",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"viewbox",
"import",
"ViewBox",
"view",
"=",
"ViewBox",
"(",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | find_font | Find font | glue_vispy_viewers/extern/vispy/ext/fontconfig.py | def find_font(face, bold, italic):
"""Find font"""
bold = FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR
italic = FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN
face = face.encode('utf8')
fontconfig.FcInit()
pattern = fontconfig.FcPatternCreate()
fontconfig.FcPatternAddInteger(pattern, FC_WEIG... | def find_font(face, bold, italic):
"""Find font"""
bold = FC_WEIGHT_BOLD if bold else FC_WEIGHT_REGULAR
italic = FC_SLANT_ITALIC if italic else FC_SLANT_ROMAN
face = face.encode('utf8')
fontconfig.FcInit()
pattern = fontconfig.FcPatternCreate()
fontconfig.FcPatternAddInteger(pattern, FC_WEIG... | [
"Find",
"font"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/fontconfig.py#L85-L111 | [
"def",
"find_font",
"(",
"face",
",",
"bold",
",",
"italic",
")",
":",
"bold",
"=",
"FC_WEIGHT_BOLD",
"if",
"bold",
"else",
"FC_WEIGHT_REGULAR",
"italic",
"=",
"FC_SLANT_ITALIC",
"if",
"italic",
"else",
"FC_SLANT_ROMAN",
"face",
"=",
"face",
".",
"encode",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _list_fonts | List system fonts | glue_vispy_viewers/extern/vispy/ext/fontconfig.py | def _list_fonts():
"""List system fonts"""
stdout_, stderr = run_subprocess(['fc-list', ':scalable=true', 'family'])
vals = [v.split(',')[0] for v in stdout_.strip().splitlines(False)]
return vals | def _list_fonts():
"""List system fonts"""
stdout_, stderr = run_subprocess(['fc-list', ':scalable=true', 'family'])
vals = [v.split(',')[0] for v in stdout_.strip().splitlines(False)]
return vals | [
"List",
"system",
"fonts"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/fontconfig.py#L114-L118 | [
"def",
"_list_fonts",
"(",
")",
":",
"stdout_",
",",
"stderr",
"=",
"run_subprocess",
"(",
"[",
"'fc-list'",
",",
"':scalable=true'",
",",
"'family'",
"]",
")",
"vals",
"=",
"[",
"v",
".",
"split",
"(",
"','",
")",
"[",
"0",
"]",
"for",
"v",
"in",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _get_vispy_caller | Helper to get vispy calling function from the stack | glue_vispy_viewers/extern/vispy/util/logs.py | def _get_vispy_caller():
"""Helper to get vispy calling function from the stack"""
records = inspect.stack()
# first few records are vispy-based logging calls
for record in records[5:]:
module = record[0].f_globals['__name__']
if module.startswith('vispy'):
line = str(record[... | def _get_vispy_caller():
"""Helper to get vispy calling function from the stack"""
records = inspect.stack()
# first few records are vispy-based logging calls
for record in records[5:]:
module = record[0].f_globals['__name__']
if module.startswith('vispy'):
line = str(record[... | [
"Helper",
"to",
"get",
"vispy",
"calling",
"function",
"from",
"the",
"stack"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L22-L35 | [
"def",
"_get_vispy_caller",
"(",
")",
":",
"records",
"=",
"inspect",
".",
"stack",
"(",
")",
"# first few records are vispy-based logging calls",
"for",
"record",
"in",
"records",
"[",
"5",
":",
"]",
":",
"module",
"=",
"record",
"[",
"0",
"]",
".",
"f_glob... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | set_log_level | Convenience function for setting the logging level
Parameters
----------
verbose : bool, str, int, or None
The verbosity of messages to print. If a str, it can be either DEBUG,
INFO, WARNING, ERROR, or CRITICAL. Note that these are for
convenience and are equivalent to passing in lo... | glue_vispy_viewers/extern/vispy/util/logs.py | def set_log_level(verbose, match=None, return_old=False):
"""Convenience function for setting the logging level
Parameters
----------
verbose : bool, str, int, or None
The verbosity of messages to print. If a str, it can be either DEBUG,
INFO, WARNING, ERROR, or CRITICAL. Note that thes... | def set_log_level(verbose, match=None, return_old=False):
"""Convenience function for setting the logging level
Parameters
----------
verbose : bool, str, int, or None
The verbosity of messages to print. If a str, it can be either DEBUG,
INFO, WARNING, ERROR, or CRITICAL. Note that thes... | [
"Convenience",
"function",
"for",
"setting",
"the",
"logging",
"level"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L129-L183 | [
"def",
"set_log_level",
"(",
"verbose",
",",
"match",
"=",
"None",
",",
"return_old",
"=",
"False",
")",
":",
"# This method is responsible for setting properties of the handler and",
"# formatter such that proper messages (possibly with the vispy caller",
"# prepended) are displayed... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | log_exception | Send an exception and traceback to the logger.
This function is used in cases where an exception is handled safely but
nevertheless should generate a descriptive error message. An extra line
is inserted into the stack trace indicating where the exception was caught.
Parameters
----------
... | glue_vispy_viewers/extern/vispy/util/logs.py | def log_exception(level='warning', tb_skip=2):
"""
Send an exception and traceback to the logger.
This function is used in cases where an exception is handled safely but
nevertheless should generate a descriptive error message. An extra line
is inserted into the stack trace indicating where the... | def log_exception(level='warning', tb_skip=2):
"""
Send an exception and traceback to the logger.
This function is used in cases where an exception is handled safely but
nevertheless should generate a descriptive error message. An extra line
is inserted into the stack trace indicating where the... | [
"Send",
"an",
"exception",
"and",
"traceback",
"to",
"the",
"logger",
".",
"This",
"function",
"is",
"used",
"in",
"cases",
"where",
"an",
"exception",
"is",
"handled",
"safely",
"but",
"nevertheless",
"should",
"generate",
"a",
"descriptive",
"error",
"messag... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L249-L271 | [
"def",
"log_exception",
"(",
"level",
"=",
"'warning'",
",",
"tb_skip",
"=",
"2",
")",
":",
"stack",
"=",
"\"\"",
".",
"join",
"(",
"traceback",
".",
"format_stack",
"(",
")",
"[",
":",
"-",
"tb_skip",
"]",
")",
"tb",
"=",
"traceback",
".",
"format_e... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _handle_exception | Helper for prining errors in callbacks
See EventEmitter._invoke_callback for a use example. | glue_vispy_viewers/extern/vispy/util/logs.py | def _handle_exception(ignore_callback_errors, print_callback_errors, obj,
cb_event=None, node=None):
"""Helper for prining errors in callbacks
See EventEmitter._invoke_callback for a use example.
"""
if not hasattr(obj, '_vispy_err_registry'):
obj._vispy_err_registry = {}
... | def _handle_exception(ignore_callback_errors, print_callback_errors, obj,
cb_event=None, node=None):
"""Helper for prining errors in callbacks
See EventEmitter._invoke_callback for a use example.
"""
if not hasattr(obj, '_vispy_err_registry'):
obj._vispy_err_registry = {}
... | [
"Helper",
"for",
"prining",
"errors",
"in",
"callbacks"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L276-L334 | [
"def",
"_handle_exception",
"(",
"ignore_callback_errors",
",",
"print_callback_errors",
",",
"obj",
",",
"cb_event",
"=",
"None",
",",
"node",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"obj",
",",
"'_vispy_err_registry'",
")",
":",
"obj",
".",
"_v... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _serialize_buffer | Serialize a NumPy array. | glue_vispy_viewers/extern/vispy/util/logs.py | def _serialize_buffer(buffer, array_serialization=None):
"""Serialize a NumPy array."""
if array_serialization == 'binary':
# WARNING: in NumPy 1.9, tostring() has been renamed to tobytes()
# but tostring() is still here for now for backward compatibility.
return buffer.ravel().tostring(... | def _serialize_buffer(buffer, array_serialization=None):
"""Serialize a NumPy array."""
if array_serialization == 'binary':
# WARNING: in NumPy 1.9, tostring() has been renamed to tobytes()
# but tostring() is still here for now for backward compatibility.
return buffer.ravel().tostring(... | [
"Serialize",
"a",
"NumPy",
"array",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L337-L348 | [
"def",
"_serialize_buffer",
"(",
"buffer",
",",
"array_serialization",
"=",
"None",
")",
":",
"if",
"array_serialization",
"==",
"'binary'",
":",
"# WARNING: in NumPy 1.9, tostring() has been renamed to tobytes()",
"# but tostring() is still here for now for backward compatibility.",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _VispyStreamHandler._vispy_emit_match_andor_record | Log message emitter that optionally matches and/or records | glue_vispy_viewers/extern/vispy/util/logs.py | def _vispy_emit_match_andor_record(self, record):
"""Log message emitter that optionally matches and/or records"""
test = record.getMessage()
match = self._vispy_match
if (match is None or re.search(match, test) or
re.search(match, _get_vispy_caller())):
if se... | def _vispy_emit_match_andor_record(self, record):
"""Log message emitter that optionally matches and/or records"""
test = record.getMessage()
match = self._vispy_match
if (match is None or re.search(match, test) or
re.search(match, _get_vispy_caller())):
if se... | [
"Log",
"message",
"emitter",
"that",
"optionally",
"matches",
"and",
"/",
"or",
"records"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/logs.py#L82-L94 | [
"def",
"_vispy_emit_match_andor_record",
"(",
"self",
",",
"record",
")",
":",
"test",
"=",
"record",
".",
"getMessage",
"(",
")",
"match",
"=",
"self",
".",
"_vispy_match",
"if",
"(",
"match",
"is",
"None",
"or",
"re",
".",
"search",
"(",
"match",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject.create | Convert *obj* to a new ShaderObject. If the output is a Variable
with no name, then set its name using *ref*. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def create(self, obj, ref=None):
""" Convert *obj* to a new ShaderObject. If the output is a Variable
with no name, then set its name using *ref*.
"""
if isinstance(ref, Variable):
ref = ref.name
elif isinstance(ref, string_types) and ref.startswith('gl_'):
... | def create(self, obj, ref=None):
""" Convert *obj* to a new ShaderObject. If the output is a Variable
with no name, then set its name using *ref*.
"""
if isinstance(ref, Variable):
ref = ref.name
elif isinstance(ref, string_types) and ref.startswith('gl_'):
... | [
"Convert",
"*",
"obj",
"*",
"to",
"a",
"new",
"ShaderObject",
".",
"If",
"the",
"output",
"is",
"a",
"Variable",
"with",
"no",
"name",
"then",
"set",
"its",
"name",
"using",
"*",
"ref",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L24-L50 | [
"def",
"create",
"(",
"self",
",",
"obj",
",",
"ref",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"ref",
",",
"Variable",
")",
":",
"ref",
"=",
"ref",
".",
"name",
"elif",
"isinstance",
"(",
"ref",
",",
"string_types",
")",
"and",
"ref",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject.dependencies | Return all dependencies required to use this object. The last item
in the list is *self*. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def dependencies(self, sort=False):
""" Return all dependencies required to use this object. The last item
in the list is *self*.
"""
alldeps = []
if sort:
def key(obj):
# sort deps such that we get functions, variables, self.
if not i... | def dependencies(self, sort=False):
""" Return all dependencies required to use this object. The last item
in the list is *self*.
"""
alldeps = []
if sort:
def key(obj):
# sort deps such that we get functions, variables, self.
if not i... | [
"Return",
"all",
"dependencies",
"required",
"to",
"use",
"this",
"object",
".",
"The",
"last",
"item",
"in",
"the",
"list",
"is",
"*",
"self",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L77-L97 | [
"def",
"dependencies",
"(",
"self",
",",
"sort",
"=",
"False",
")",
":",
"alldeps",
"=",
"[",
"]",
"if",
"sort",
":",
"def",
"key",
"(",
"obj",
")",
":",
"# sort deps such that we get functions, variables, self.",
"if",
"not",
"isinstance",
"(",
"obj",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject._add_dep | Increment the reference count for *dep*. If this is a new
dependency, then connect to its *changed* event. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def _add_dep(self, dep):
""" Increment the reference count for *dep*. If this is a new
dependency, then connect to its *changed* event.
"""
if dep in self._deps:
self._deps[dep] += 1
else:
self._deps[dep] = 1
dep._dependents[self] = None | def _add_dep(self, dep):
""" Increment the reference count for *dep*. If this is a new
dependency, then connect to its *changed* event.
"""
if dep in self._deps:
self._deps[dep] += 1
else:
self._deps[dep] = 1
dep._dependents[self] = None | [
"Increment",
"the",
"reference",
"count",
"for",
"*",
"dep",
"*",
".",
"If",
"this",
"is",
"a",
"new",
"dependency",
"then",
"connect",
"to",
"its",
"*",
"changed",
"*",
"event",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L108-L116 | [
"def",
"_add_dep",
"(",
"self",
",",
"dep",
")",
":",
"if",
"dep",
"in",
"self",
".",
"_deps",
":",
"self",
".",
"_deps",
"[",
"dep",
"]",
"+=",
"1",
"else",
":",
"self",
".",
"_deps",
"[",
"dep",
"]",
"=",
"1",
"dep",
".",
"_dependents",
"[",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject._remove_dep | Decrement the reference count for *dep*. If the reference count
reaches 0, then the dependency is removed and its *changed* event is
disconnected. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def _remove_dep(self, dep):
""" Decrement the reference count for *dep*. If the reference count
reaches 0, then the dependency is removed and its *changed* event is
disconnected.
"""
refcount = self._deps[dep]
if refcount == 1:
self._deps.pop(dep)
... | def _remove_dep(self, dep):
""" Decrement the reference count for *dep*. If the reference count
reaches 0, then the dependency is removed and its *changed* event is
disconnected.
"""
refcount = self._deps[dep]
if refcount == 1:
self._deps.pop(dep)
... | [
"Decrement",
"the",
"reference",
"count",
"for",
"*",
"dep",
"*",
".",
"If",
"the",
"reference",
"count",
"reaches",
"0",
"then",
"the",
"dependency",
"is",
"removed",
"and",
"its",
"*",
"changed",
"*",
"event",
"is",
"disconnected",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L118-L128 | [
"def",
"_remove_dep",
"(",
"self",
",",
"dep",
")",
":",
"refcount",
"=",
"self",
".",
"_deps",
"[",
"dep",
"]",
"if",
"refcount",
"==",
"1",
":",
"self",
".",
"_deps",
".",
"pop",
"(",
"dep",
")",
"dep",
".",
"_dependents",
".",
"pop",
"(",
"sel... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject._dep_changed | Called when a dependency's expression has changed. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def _dep_changed(self, dep, code_changed=False, value_changed=False):
""" Called when a dependency's expression has changed.
"""
self.changed(code_changed, value_changed) | def _dep_changed(self, dep, code_changed=False, value_changed=False):
""" Called when a dependency's expression has changed.
"""
self.changed(code_changed, value_changed) | [
"Called",
"when",
"a",
"dependency",
"s",
"expression",
"has",
"changed",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L130-L133 | [
"def",
"_dep_changed",
"(",
"self",
",",
"dep",
",",
"code_changed",
"=",
"False",
",",
"value_changed",
"=",
"False",
")",
":",
"self",
".",
"changed",
"(",
"code_changed",
",",
"value_changed",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ShaderObject.changed | Inform dependents that this shaderobject has changed. | glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py | def changed(self, code_changed=False, value_changed=False):
"""Inform dependents that this shaderobject has changed.
"""
for d in self._dependents:
d._dep_changed(self, code_changed=code_changed,
value_changed=value_changed) | def changed(self, code_changed=False, value_changed=False):
"""Inform dependents that this shaderobject has changed.
"""
for d in self._dependents:
d._dep_changed(self, code_changed=code_changed,
value_changed=value_changed) | [
"Inform",
"dependents",
"that",
"this",
"shaderobject",
"has",
"changed",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/shader_object.py#L135-L140 | [
"def",
"changed",
"(",
"self",
",",
"code_changed",
"=",
"False",
",",
"value_changed",
"=",
"False",
")",
":",
"for",
"d",
"in",
"self",
".",
"_dependents",
":",
"d",
".",
"_dep_changed",
"(",
"self",
",",
"code_changed",
"=",
"code_changed",
",",
"valu... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | eq | The great missing equivalence function: Guaranteed evaluation
to a single bool value. | glue_vispy_viewers/extern/vispy/util/eq.py | def eq(a, b):
""" The great missing equivalence function: Guaranteed evaluation
to a single bool value.
"""
if a is b:
return True
if a is None or b is None:
return True if a is None and b is None else False
try:
e = a == b
except ValueError:
return False
... | def eq(a, b):
""" The great missing equivalence function: Guaranteed evaluation
to a single bool value.
"""
if a is b:
return True
if a is None or b is None:
return True if a is None and b is None else False
try:
e = a == b
except ValueError:
return False
... | [
"The",
"great",
"missing",
"equivalence",
"function",
":",
"Guaranteed",
"evaluation",
"to",
"a",
"single",
"bool",
"value",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/eq.py#L5-L41 | [
"def",
"eq",
"(",
"a",
",",
"b",
")",
":",
"if",
"a",
"is",
"b",
":",
"return",
"True",
"if",
"a",
"is",
"None",
"or",
"b",
"is",
"None",
":",
"return",
"True",
"if",
"a",
"is",
"None",
"and",
"b",
"is",
"None",
"else",
"False",
"try",
":",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomCamera.zoom | Zoom in (or out) at the given center
Parameters
----------
factor : float or tuple
Fraction by which the scene should be zoomed (e.g. a factor of 2
causes the scene to appear twice as large).
center : tuple of 2-4 elements
The center of the view. If n... | glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py | def zoom(self, factor, center=None):
""" Zoom in (or out) at the given center
Parameters
----------
factor : float or tuple
Fraction by which the scene should be zoomed (e.g. a factor of 2
causes the scene to appear twice as large).
center : tuple of 2-4 ... | def zoom(self, factor, center=None):
""" Zoom in (or out) at the given center
Parameters
----------
factor : float or tuple
Fraction by which the scene should be zoomed (e.g. a factor of 2
causes the scene to appear twice as large).
center : tuple of 2-4 ... | [
"Zoom",
"in",
"(",
"or",
"out",
")",
"at",
"the",
"given",
"center"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py#L76-L114 | [
"def",
"zoom",
"(",
"self",
",",
"factor",
",",
"center",
"=",
"None",
")",
":",
"assert",
"len",
"(",
"center",
")",
"in",
"(",
"2",
",",
"3",
",",
"4",
")",
"# Get scale factor, take scale ratio into account",
"if",
"np",
".",
"isscalar",
"(",
"factor"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomCamera.pan | Pan the view.
Parameters
----------
*pan : length-2 sequence
The distance to pan the view, in the coordinate system of the
scene. | glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py | def pan(self, *pan):
"""Pan the view.
Parameters
----------
*pan : length-2 sequence
The distance to pan the view, in the coordinate system of the
scene.
"""
if len(pan) == 1:
pan = pan[0]
self.rect = self.rect + pan | def pan(self, *pan):
"""Pan the view.
Parameters
----------
*pan : length-2 sequence
The distance to pan the view, in the coordinate system of the
scene.
"""
if len(pan) == 1:
pan = pan[0]
self.rect = self.rect + pan | [
"Pan",
"the",
"view",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py#L116-L127 | [
"def",
"pan",
"(",
"self",
",",
"*",
"pan",
")",
":",
"if",
"len",
"(",
"pan",
")",
"==",
"1",
":",
"pan",
"=",
"pan",
"[",
"0",
"]",
"self",
".",
"rect",
"=",
"self",
".",
"rect",
"+",
"pan"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | PanZoomCamera.viewbox_mouse_event | The SubScene received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py | def viewbox_mouse_event(self, event):
"""
The SubScene received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
#... | def viewbox_mouse_event(self, event):
"""
The SubScene received a mouse event; update transform
accordingly.
Parameters
----------
event : instance of Event
The event.
"""
if event.handled or not self.interactive:
return
#... | [
"The",
"SubScene",
"received",
"a",
"mouse",
"event",
";",
"update",
"transform",
"accordingly",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/cameras/panzoom.py#L191-L244 | [
"def",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"handled",
"or",
"not",
"self",
".",
"interactive",
":",
"return",
"# Scrolling",
"BaseCamera",
".",
"viewbox_mouse_event",
"(",
"self",
",",
"event",
")",
"if",
"event",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | VolumeVisual.set_data | Set the volume data.
Parameters
----------
vol : ndarray
The 3D volume.
clim : tuple | None
Colormap limits to use. None will use the min and max values. | glue_vispy_viewers/extern/vispy/visuals/volume.py | def set_data(self, vol, clim=None):
""" Set the volume data.
Parameters
----------
vol : ndarray
The 3D volume.
clim : tuple | None
Colormap limits to use. None will use the min and max values.
"""
# Check volume
if not isinstance... | def set_data(self, vol, clim=None):
""" Set the volume data.
Parameters
----------
vol : ndarray
The 3D volume.
clim : tuple | None
Colormap limits to use. None will use the min and max values.
"""
# Check volume
if not isinstance... | [
"Set",
"the",
"volume",
"data",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/volume.py#L450-L496 | [
"def",
"set_data",
"(",
"self",
",",
"vol",
",",
"clim",
"=",
"None",
")",
":",
"# Check volume",
"if",
"not",
"isinstance",
"(",
"vol",
",",
"np",
".",
"ndarray",
")",
":",
"raise",
"ValueError",
"(",
"'Volume visual needs a numpy array.'",
")",
"if",
"no... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | VolumeVisual._create_vertex_data | Create and set positions and texture coords from the given shape
We have six faces with 1 quad (2 triangles) each, resulting in
6*2*3 = 36 vertices in total. | glue_vispy_viewers/extern/vispy/visuals/volume.py | def _create_vertex_data(self):
""" Create and set positions and texture coords from the given shape
We have six faces with 1 quad (2 triangles) each, resulting in
6*2*3 = 36 vertices in total.
"""
shape = self._vol_shape
# Get corner coordinates. The -0.... | def _create_vertex_data(self):
""" Create and set positions and texture coords from the given shape
We have six faces with 1 quad (2 triangles) each, resulting in
6*2*3 = 36 vertices in total.
"""
shape = self._vol_shape
# Get corner coordinates. The -0.... | [
"Create",
"and",
"set",
"positions",
"and",
"texture",
"coords",
"from",
"the",
"given",
"shape",
"We",
"have",
"six",
"faces",
"with",
"1",
"quad",
"(",
"2",
"triangles",
")",
"each",
"resulting",
"in",
"6",
"*",
"2",
"*",
"3",
"=",
"36",
"vertices",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/volume.py#L583-L625 | [
"def",
"_create_vertex_data",
"(",
"self",
")",
":",
"shape",
"=",
"self",
".",
"_vol_shape",
"# Get corner coordinates. The -0.5 offset is to center",
"# pixels/voxels. This works correctly for anisotropic data.",
"x0",
",",
"x1",
"=",
"-",
"0.5",
",",
"shape",
"[",
"2",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | LinearRegionVisual.set_data | Set the data
Parameters
----------
pos : list, tuple or numpy array
Bounds of the region along the axis. len(pos) must be >=2.
color : list, tuple, or array
The color to use when drawing the line. It must have a shape of
(1, 4) for a single color regi... | glue_vispy_viewers/extern/vispy/visuals/linear_region.py | def set_data(self, pos=None, color=None):
"""Set the data
Parameters
----------
pos : list, tuple or numpy array
Bounds of the region along the axis. len(pos) must be >=2.
color : list, tuple, or array
The color to use when drawing the line. It must have ... | def set_data(self, pos=None, color=None):
"""Set the data
Parameters
----------
pos : list, tuple or numpy array
Bounds of the region along the axis. len(pos) must be >=2.
color : list, tuple, or array
The color to use when drawing the line. It must have ... | [
"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/linear_region.py#L87-L142 | [
"def",
"set_data",
"(",
"self",
",",
"pos",
"=",
"None",
",",
"color",
"=",
"None",
")",
":",
"new_pos",
"=",
"self",
".",
"_pos",
"new_color",
"=",
"self",
".",
"_color",
"if",
"pos",
"is",
"not",
"None",
":",
"num_elements",
"=",
"len",
"(",
"pos... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | LinearRegionVisual._prepare_draw | This method is called immediately before each draw.
The *view* argument indicates which view is about to be drawn. | glue_vispy_viewers/extern/vispy/visuals/linear_region.py | def _prepare_draw(self, view=None):
"""This method is called immediately before each draw.
The *view* argument indicates which view is about to be drawn.
"""
if self._changed['pos']:
self.pos_buf.set_data(self._pos)
self._changed['pos'] = False
if self.... | def _prepare_draw(self, view=None):
"""This method is called immediately before each draw.
The *view* argument indicates which view is about to be drawn.
"""
if self._changed['pos']:
self.pos_buf.set_data(self._pos)
self._changed['pos'] = False
if self.... | [
"This",
"method",
"is",
"called",
"immediately",
"before",
"each",
"draw",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/linear_region.py#L180-L195 | [
"def",
"_prepare_draw",
"(",
"self",
",",
"view",
"=",
"None",
")",
":",
"if",
"self",
".",
"_changed",
"[",
"'pos'",
"]",
":",
"self",
".",
"pos_buf",
".",
"set_data",
"(",
"self",
".",
"_pos",
")",
"self",
".",
"_changed",
"[",
"'pos'",
"]",
"=",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SimplePostsCache.refresh_cache | Repopulate cache | examples/useful_science/useful_science.py | def refresh_cache(self, cat_id):
'''
Repopulate cache
'''
self.cache[cat_id] = most_recent_25_posts_by_category(cat_id)
self.last_refresh[cat_id] = datetime.now()
print ('Cache refresh at...', str(self.last_refresh[cat_id])) | def refresh_cache(self, cat_id):
'''
Repopulate cache
'''
self.cache[cat_id] = most_recent_25_posts_by_category(cat_id)
self.last_refresh[cat_id] = datetime.now()
print ('Cache refresh at...', str(self.last_refresh[cat_id])) | [
"Repopulate",
"cache"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/examples/useful_science/useful_science.py#L57-L63 | [
"def",
"refresh_cache",
"(",
"self",
",",
"cat_id",
")",
":",
"self",
".",
"cache",
"[",
"cat_id",
"]",
"=",
"most_recent_25_posts_by_category",
"(",
"cat_id",
")",
"self",
".",
"last_refresh",
"[",
"cat_id",
"]",
"=",
"datetime",
".",
"now",
"(",
")",
"... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | IntervalSet._merge_intervals | Merge overlapping intervals.
This method is called only once in the constructor. | mocpy/interval_set.py | def _merge_intervals(self, min_depth):
"""
Merge overlapping intervals.
This method is called only once in the constructor.
"""
def add_interval(ret, start, stop):
if min_depth is not None:
shift = 2 * (29 - min_depth)
mask = (int(1) <... | def _merge_intervals(self, min_depth):
"""
Merge overlapping intervals.
This method is called only once in the constructor.
"""
def add_interval(ret, start, stop):
if min_depth is not None:
shift = 2 * (29 - min_depth)
mask = (int(1) <... | [
"Merge",
"overlapping",
"intervals",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L98-L147 | [
"def",
"_merge_intervals",
"(",
"self",
",",
"min_depth",
")",
":",
"def",
"add_interval",
"(",
"ret",
",",
"start",
",",
"stop",
")",
":",
"if",
"min_depth",
"is",
"not",
"None",
":",
"shift",
"=",
"2",
"*",
"(",
"29",
"-",
"min_depth",
")",
"mask",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | IntervalSet.union | Return the union between self and ``another_is``.
Parameters
----------
another_is : `IntervalSet`
an IntervalSet object.
Returns
-------
interval : `IntervalSet`
the union of self with ``another_is``. | mocpy/interval_set.py | def union(self, another_is):
"""
Return the union between self and ``another_is``.
Parameters
----------
another_is : `IntervalSet`
an IntervalSet object.
Returns
-------
interval : `IntervalSet`
the union of self with ``another_is... | def union(self, another_is):
"""
Return the union between self and ``another_is``.
Parameters
----------
another_is : `IntervalSet`
an IntervalSet object.
Returns
-------
interval : `IntervalSet`
the union of self with ``another_is... | [
"Return",
"the",
"union",
"between",
"self",
"and",
"another_is",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L149-L172 | [
"def",
"union",
"(",
"self",
",",
"another_is",
")",
":",
"result",
"=",
"IntervalSet",
"(",
")",
"if",
"another_is",
".",
"empty",
"(",
")",
":",
"result",
".",
"_intervals",
"=",
"self",
".",
"_intervals",
"elif",
"self",
".",
"empty",
"(",
")",
":... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | IntervalSet.to_nuniq_interval_set | Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix
cells.
Parameters
----------
nested_is : `IntervalSet`
IntervalSet object storing HEALPix cells as [ipix*4^(29-order), (ipix+1)*4^(29-order)[ intervals.
Re... | mocpy/interval_set.py | def to_nuniq_interval_set(cls, nested_is):
"""
Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix
cells.
Parameters
----------
nested_is : `IntervalSet`
IntervalSet object storing HEALPix cells as [i... | def to_nuniq_interval_set(cls, nested_is):
"""
Convert an IntervalSet using the NESTED numbering scheme to an IntervalSet containing UNIQ numbers for HEALPix
cells.
Parameters
----------
nested_is : `IntervalSet`
IntervalSet object storing HEALPix cells as [i... | [
"Convert",
"an",
"IntervalSet",
"using",
"the",
"NESTED",
"numbering",
"scheme",
"to",
"an",
"IntervalSet",
"containing",
"UNIQ",
"numbers",
"for",
"HEALPix",
"cells",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L217-L261 | [
"def",
"to_nuniq_interval_set",
"(",
"cls",
",",
"nested_is",
")",
":",
"r2",
"=",
"nested_is",
".",
"copy",
"(",
")",
"res",
"=",
"[",
"]",
"if",
"r2",
".",
"empty",
"(",
")",
":",
"return",
"IntervalSet",
"(",
")",
"order",
"=",
"0",
"while",
"no... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | IntervalSet.from_nuniq_interval_set | Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix
cells following the NESTED numbering scheme.
Parameters
----------
nuniq_is : `IntervalSet`
IntervalSet object storing HEALPix cells as [ipix + 4*4^(order), ipix+1 + 4*4^(order)[ interva... | mocpy/interval_set.py | def from_nuniq_interval_set(cls, nuniq_is):
"""
Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix
cells following the NESTED numbering scheme.
Parameters
----------
nuniq_is : `IntervalSet`
IntervalSet object storing HEA... | def from_nuniq_interval_set(cls, nuniq_is):
"""
Convert an IntervalSet containing NUNIQ intervals to an IntervalSet representing HEALPix
cells following the NESTED numbering scheme.
Parameters
----------
nuniq_is : `IntervalSet`
IntervalSet object storing HEA... | [
"Convert",
"an",
"IntervalSet",
"containing",
"NUNIQ",
"intervals",
"to",
"an",
"IntervalSet",
"representing",
"HEALPix",
"cells",
"following",
"the",
"NESTED",
"numbering",
"scheme",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L264-L301 | [
"def",
"from_nuniq_interval_set",
"(",
"cls",
",",
"nuniq_is",
")",
":",
"nested_is",
"=",
"IntervalSet",
"(",
")",
"# Appending a list is faster than appending a numpy array",
"# For these algorithms we append a list and create the interval set from the finished list",
"rtmp",
"=",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | IntervalSet.merge | Merge two lists of intervals according to the boolean function op
``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals).
This operation keeps the resulting interval set consistent.
Parameters
----------
a_intervals : `~numpy.ndarray`
... | mocpy/interval_set.py | def merge(a_intervals, b_intervals, op):
"""
Merge two lists of intervals according to the boolean function op
``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals).
This operation keeps the resulting interval set consistent.
Parameters... | def merge(a_intervals, b_intervals, op):
"""
Merge two lists of intervals according to the boolean function op
``a_intervals`` and ``b_intervals`` need to be sorted and consistent (no overlapping intervals).
This operation keeps the resulting interval set consistent.
Parameters... | [
"Merge",
"two",
"lists",
"of",
"intervals",
"according",
"to",
"the",
"boolean",
"function",
"op"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/interval_set.py#L304-L357 | [
"def",
"merge",
"(",
"a_intervals",
",",
"b_intervals",
",",
"op",
")",
":",
"a_endpoints",
"=",
"a_intervals",
".",
"flatten",
"(",
")",
".",
"tolist",
"(",
")",
"b_endpoints",
"=",
"b_intervals",
".",
"flatten",
"(",
")",
".",
"tolist",
"(",
")",
"se... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | GLObject.delete | Delete the object from GPU memory.
Note that the GPU object will also be deleted when this gloo
object is about to be deleted. However, sometimes you want to
explicitly delete the GPU object explicitly. | glue_vispy_viewers/extern/vispy/gloo/globject.py | def delete(self):
""" Delete the object from GPU memory.
Note that the GPU object will also be deleted when this gloo
object is about to be deleted. However, sometimes you want to
explicitly delete the GPU object explicitly.
"""
# We only allow the object from being del... | def delete(self):
""" Delete the object from GPU memory.
Note that the GPU object will also be deleted when this gloo
object is about to be deleted. However, sometimes you want to
explicitly delete the GPU object explicitly.
"""
# We only allow the object from being del... | [
"Delete",
"the",
"object",
"from",
"GPU",
"memory",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/globject.py#L80-L97 | [
"def",
"delete",
"(",
"self",
")",
":",
"# We only allow the object from being deleted once, otherwise",
"# we might be deleting another GPU object that got our gl-id",
"# after our GPU object was deleted. Also note that e.g.",
"# DataBufferView does not have the _glir attribute.",
"if",
"hasa... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ImageVisual.set_data | Set the data
Parameters
----------
image : array-like
The image data. | glue_vispy_viewers/extern/vispy/visuals/image.py | def set_data(self, image):
"""Set the data
Parameters
----------
image : array-like
The image data.
"""
data = np.asarray(image)
if self._data is None or self._data.shape != data.shape:
self._need_vertex_update = True
self._data = ... | def set_data(self, image):
"""Set the data
Parameters
----------
image : array-like
The image data.
"""
data = np.asarray(image)
if self._data is None or self._data.shape != data.shape:
self._need_vertex_update = True
self._data = ... | [
"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/image.py#L219-L231 | [
"def",
"set_data",
"(",
"self",
",",
"image",
")",
":",
"data",
"=",
"np",
".",
"asarray",
"(",
"image",
")",
"if",
"self",
".",
"_data",
"is",
"None",
"or",
"self",
".",
"_data",
".",
"shape",
"!=",
"data",
".",
"shape",
":",
"self",
".",
"_need... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ImageVisual._build_interpolation | Rebuild the _data_lookup_fn using different interpolations within
the shader | glue_vispy_viewers/extern/vispy/visuals/image.py | def _build_interpolation(self):
"""Rebuild the _data_lookup_fn using different interpolations within
the shader
"""
interpolation = self._interpolation
self._data_lookup_fn = self._interpolation_fun[interpolation]
self.shared_program.frag['get_data'] = self._data_lookup_f... | def _build_interpolation(self):
"""Rebuild the _data_lookup_fn using different interpolations within
the shader
"""
interpolation = self._interpolation
self._data_lookup_fn = self._interpolation_fun[interpolation]
self.shared_program.frag['get_data'] = self._data_lookup_f... | [
"Rebuild",
"the",
"_data_lookup_fn",
"using",
"different",
"interpolations",
"within",
"the",
"shader"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L306-L330 | [
"def",
"_build_interpolation",
"(",
"self",
")",
":",
"interpolation",
"=",
"self",
".",
"_interpolation",
"self",
".",
"_data_lookup_fn",
"=",
"self",
".",
"_interpolation_fun",
"[",
"interpolation",
"]",
"self",
".",
"shared_program",
".",
"frag",
"[",
"'get_d... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ImageVisual._build_vertex_data | Rebuild the vertex buffers used for rendering the image when using
the subdivide method. | glue_vispy_viewers/extern/vispy/visuals/image.py | def _build_vertex_data(self):
"""Rebuild the vertex buffers used for rendering the image when using
the subdivide method.
"""
grid = self._grid
w = 1.0 / grid[1]
h = 1.0 / grid[0]
quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0],
[0, 0, 0... | def _build_vertex_data(self):
"""Rebuild the vertex buffers used for rendering the image when using
the subdivide method.
"""
grid = self._grid
w = 1.0 / grid[1]
h = 1.0 / grid[0]
quad = np.array([[0, 0, 0], [w, 0, 0], [w, h, 0],
[0, 0, 0... | [
"Rebuild",
"the",
"vertex",
"buffers",
"used",
"for",
"rendering",
"the",
"image",
"when",
"using",
"the",
"subdivide",
"method",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L332-L357 | [
"def",
"_build_vertex_data",
"(",
"self",
")",
":",
"grid",
"=",
"self",
".",
"_grid",
"w",
"=",
"1.0",
"/",
"grid",
"[",
"1",
"]",
"h",
"=",
"1.0",
"/",
"grid",
"[",
"0",
"]",
"quad",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"0",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ImageVisual._update_method | Decide which method to use for *view* and configure it accordingly. | glue_vispy_viewers/extern/vispy/visuals/image.py | def _update_method(self, view):
"""Decide which method to use for *view* and configure it accordingly.
"""
method = self._method
if method == 'auto':
if view.transforms.get_transform().Linear:
method = 'subdivide'
else:
method = 'im... | def _update_method(self, view):
"""Decide which method to use for *view* and configure it accordingly.
"""
method = self._method
if method == 'auto':
if view.transforms.get_transform().Linear:
method = 'subdivide'
else:
method = 'im... | [
"Decide",
"which",
"method",
"to",
"use",
"for",
"*",
"view",
"*",
"and",
"configure",
"it",
"accordingly",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/image.py#L359-L383 | [
"def",
"_update_method",
"(",
"self",
",",
"view",
")",
":",
"method",
"=",
"self",
".",
"_method",
"if",
"method",
"==",
"'auto'",
":",
"if",
"view",
".",
"transforms",
".",
"get_transform",
"(",
")",
".",
"Linear",
":",
"method",
"=",
"'subdivide'",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AggFastPathCollection.append | Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices positions of the path(s) to be added
closed: bool
Whether path(s... | glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | def append(self, P, closed=False, itemsize=None, **kwargs):
"""
Append a new set of vertices to the collection.
For kwargs argument, n is the number of vertices (local) or the number
of item (shared)
Parameters
----------
P : np.array
Vertices posit... | [
"Append",
"a",
"new",
"set",
"of",
"vertices",
"to",
"the",
"collection",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py#L93-L177 | [
"def",
"append",
"(",
"self",
",",
"P",
",",
"closed",
"=",
"False",
",",
"itemsize",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"len",
"(",
"P",
")",
"itemcount",
"=",
"len",
"(",
"P",
")",
"/",
"itemsize"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AggFastPathCollection.bake | Given a path P, return the baked vertices as they should be copied in
the collection if the path has already been appended.
Example:
--------
paths.append(P)
P *= 2
paths['prev'][0] = bake(P,'prev')
paths['curr'][0] = bake(P,'curr')
paths['next'][0] = ba... | glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py | def bake(self, P, key='curr', closed=False, itemsize=None):
"""
Given a path P, return the baked vertices as they should be copied in
the collection if the path has already been appended.
Example:
--------
paths.append(P)
P *= 2
paths['prev'][0] = bake(P... | def bake(self, P, key='curr', closed=False, itemsize=None):
"""
Given a path P, return the baked vertices as they should be copied in
the collection if the path has already been appended.
Example:
--------
paths.append(P)
P *= 2
paths['prev'][0] = bake(P... | [
"Given",
"a",
"path",
"P",
"return",
"the",
"baked",
"vertices",
"as",
"they",
"should",
"be",
"copied",
"in",
"the",
"collection",
"if",
"the",
"path",
"has",
"already",
"been",
"appended",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py#L179-L219 | [
"def",
"bake",
"(",
"self",
",",
"P",
",",
"key",
"=",
"'curr'",
",",
"closed",
"=",
"False",
",",
"itemsize",
"=",
"None",
")",
":",
"itemsize",
"=",
"itemsize",
"or",
"len",
"(",
"P",
")",
"itemcount",
"=",
"len",
"(",
"P",
")",
"/",
"itemsize"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | AggFastPathCollection.draw | Draw collection | glue_vispy_viewers/extern/vispy/visuals/collections/agg_fast_path_collection.py | def draw(self, mode="triangle_strip"):
""" Draw collection """
gl.glDepthMask(gl.GL_FALSE)
Collection.draw(self, mode)
gl.glDepthMask(gl.GL_TRUE) | def draw(self, mode="triangle_strip"):
""" Draw collection """
gl.glDepthMask(gl.GL_FALSE)
Collection.draw(self, mode)
gl.glDepthMask(gl.GL_TRUE) | [
"Draw",
"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_fast_path_collection.py#L221-L226 | [
"def",
"draw",
"(",
"self",
",",
"mode",
"=",
"\"triangle_strip\"",
")",
":",
"gl",
".",
"glDepthMask",
"(",
"gl",
".",
"GL_FALSE",
")",
"Collection",
".",
"draw",
"(",
"self",
",",
"mode",
")",
"gl",
".",
"glDepthMask",
"(",
"gl",
".",
"GL_TRUE",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _stop_timers | Stop all timers in a canvas. | glue_vispy_viewers/extern/vispy/app/backends/ipython/_widget.py | def _stop_timers(canvas):
"""Stop all timers in a canvas."""
for attr in dir(canvas):
try:
attr_obj = getattr(canvas, attr)
except NotImplementedError:
# This try/except is needed because canvas.position raises
# an error (it is not implemented in this backend... | def _stop_timers(canvas):
"""Stop all timers in a canvas."""
for attr in dir(canvas):
try:
attr_obj = getattr(canvas, attr)
except NotImplementedError:
# This try/except is needed because canvas.position raises
# an error (it is not implemented in this backend... | [
"Stop",
"all",
"timers",
"in",
"a",
"canvas",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/backends/ipython/_widget.py#L21-L31 | [
"def",
"_stop_timers",
"(",
"canvas",
")",
":",
"for",
"attr",
"in",
"dir",
"(",
"canvas",
")",
":",
"try",
":",
"attr_obj",
"=",
"getattr",
"(",
"canvas",
",",
"attr",
")",
"except",
"NotImplementedError",
":",
"# This try/except is needed because canvas.positi... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _last_stack_str | Print stack trace from call that didn't originate from here | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def _last_stack_str():
"""Print stack trace from call that didn't originate from here"""
stack = extract_stack()
for s in stack[::-1]:
if op.join('vispy', 'gloo', 'buffer.py') not in __file__:
break
return format_list([s])[0] | def _last_stack_str():
"""Print stack trace from call that didn't originate from here"""
stack = extract_stack()
for s in stack[::-1]:
if op.join('vispy', 'gloo', 'buffer.py') not in __file__:
break
return format_list([s])[0] | [
"Print",
"stack",
"trace",
"from",
"call",
"that",
"didn",
"t",
"originate",
"from",
"here"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L457-L463 | [
"def",
"_last_stack_str",
"(",
")",
":",
"stack",
"=",
"extract_stack",
"(",
")",
"for",
"s",
"in",
"stack",
"[",
":",
":",
"-",
"1",
"]",
":",
"if",
"op",
".",
"join",
"(",
"'vispy'",
",",
"'gloo'",
",",
"'buffer.py'",
")",
"not",
"in",
"__file__"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Buffer.set_subdata | Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
Since the operation is deferred, data may change befo... | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def set_subdata(self, data, offset=0, copy=False):
""" Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
... | def set_subdata(self, data, offset=0, copy=False):
""" Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
... | [
"Set",
"a",
"sub",
"-",
"region",
"of",
"the",
"buffer",
"(",
"deferred",
"operation",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L61-L88 | [
"def",
"set_subdata",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"0",
",",
"copy",
"=",
"False",
")",
":",
"data",
"=",
"np",
".",
"array",
"(",
"data",
",",
"copy",
"=",
"copy",
")",
"nbytes",
"=",
"data",
".",
"nbytes",
"if",
"offset",
"<",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Buffer.set_data | Set data in the buffer (deferred operation).
This completely resets the size and contents of the buffer.
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actua... | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def set_data(self, data, copy=False):
""" Set data in the buffer (deferred operation).
This completely resets the size and contents of the buffer.
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred... | def set_data(self, data, copy=False):
""" Set data in the buffer (deferred operation).
This completely resets the size and contents of the buffer.
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred... | [
"Set",
"data",
"in",
"the",
"buffer",
"(",
"deferred",
"operation",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L90-L114 | [
"def",
"set_data",
"(",
"self",
",",
"data",
",",
"copy",
"=",
"False",
")",
":",
"data",
"=",
"np",
".",
"array",
"(",
"data",
",",
"copy",
"=",
"copy",
")",
"nbytes",
"=",
"data",
".",
"nbytes",
"if",
"nbytes",
"!=",
"self",
".",
"_nbytes",
":"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Buffer.resize_bytes | Resize this buffer (deferred operation).
Parameters
----------
size : int
New buffer size in bytes. | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def resize_bytes(self, size):
""" Resize this buffer (deferred operation).
Parameters
----------
size : int
New buffer size in bytes.
"""
self._nbytes = size
self._glir.command('SIZE', self._id, size)
# Invalidate any view on this buf... | def resize_bytes(self, size):
""" Resize this buffer (deferred operation).
Parameters
----------
size : int
New buffer size in bytes.
"""
self._nbytes = size
self._glir.command('SIZE', self._id, size)
# Invalidate any view on this buf... | [
"Resize",
"this",
"buffer",
"(",
"deferred",
"operation",
")",
".",
"Parameters",
"----------",
"size",
":",
"int",
"New",
"buffer",
"size",
"in",
"bytes",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L116-L130 | [
"def",
"resize_bytes",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"_nbytes",
"=",
"size",
"self",
".",
"_glir",
".",
"command",
"(",
"'SIZE'",
",",
"self",
".",
"_id",
",",
"size",
")",
"# Invalidate any view on this buffer",
"for",
"view",
"in",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | DataBuffer.set_subdata | Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
copy: bool
Since the operation is deferred, data may change befo... | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def set_subdata(self, data, offset=0, copy=False, **kwargs):
""" Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
cop... | def set_subdata(self, data, offset=0, copy=False, **kwargs):
""" Set a sub-region of the buffer (deferred operation).
Parameters
----------
data : ndarray
Data to be uploaded
offset: int
Offset in buffer where to start copying data (in bytes)
cop... | [
"Set",
"a",
"sub",
"-",
"region",
"of",
"the",
"buffer",
"(",
"deferred",
"operation",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L157-L176 | [
"def",
"set_subdata",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"0",
",",
"copy",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_prepare_data",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
"offset",
"=",
"offset",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | DataBuffer.set_data | Set data (deferred operation)
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memory.
Asking explicitly for a copy will prevent th... | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def set_data(self, data, copy=False, **kwargs):
""" Set data (deferred operation)
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memo... | def set_data(self, data, copy=False, **kwargs):
""" Set data (deferred operation)
Parameters
----------
data : ndarray
Data to be uploaded
copy: bool
Since the operation is deferred, data may change before
data is actually uploaded to GPU memo... | [
"Set",
"data",
"(",
"deferred",
"operation",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L178-L196 | [
"def",
"set_data",
"(",
"self",
",",
"data",
",",
"copy",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"_prepare_data",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"_dtype",
"=",
"data",
".",
"dtype",
"se... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | DataBuffer.glsl_type | GLSL declaration strings required for a variable to hold this data. | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def glsl_type(self):
""" GLSL declaration strings required for a variable to hold this data.
"""
if self.dtype is None:
return None
dtshape = self.dtype[0].shape
n = dtshape[0] if dtshape else 1
if n > 1:
dtype = 'vec%d' % n
else:
... | def glsl_type(self):
""" GLSL declaration strings required for a variable to hold this data.
"""
if self.dtype is None:
return None
dtshape = self.dtype[0].shape
n = dtshape[0] if dtshape else 1
if n > 1:
dtype = 'vec%d' % n
else:
... | [
"GLSL",
"declaration",
"strings",
"required",
"for",
"a",
"variable",
"to",
"hold",
"this",
"data",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L228-L239 | [
"def",
"glsl_type",
"(",
"self",
")",
":",
"if",
"self",
".",
"dtype",
"is",
"None",
":",
"return",
"None",
"dtshape",
"=",
"self",
".",
"dtype",
"[",
"0",
"]",
".",
"shape",
"n",
"=",
"dtshape",
"[",
"0",
"]",
"if",
"dtshape",
"else",
"1",
"if",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | DataBuffer.resize_bytes | Resize the buffer (in-place, deferred operation)
Parameters
----------
size : integer
New buffer size in bytes
Notes
-----
This clears any pending operations. | glue_vispy_viewers/extern/vispy/gloo/buffer.py | def resize_bytes(self, size):
""" Resize the buffer (in-place, deferred operation)
Parameters
----------
size : integer
New buffer size in bytes
Notes
-----
This clears any pending operations.
"""
Buffer.resize_bytes(self, size)
... | def resize_bytes(self, size):
""" Resize the buffer (in-place, deferred operation)
Parameters
----------
size : integer
New buffer size in bytes
Notes
-----
This clears any pending operations.
"""
Buffer.resize_bytes(self, size)
... | [
"Resize",
"the",
"buffer",
"(",
"in",
"-",
"place",
"deferred",
"operation",
")"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/buffer.py#L241-L254 | [
"def",
"resize_bytes",
"(",
"self",
",",
"size",
")",
":",
"Buffer",
".",
"resize_bytes",
"(",
"self",
",",
"size",
")",
"self",
".",
"_size",
"=",
"size",
"//",
"self",
".",
"itemsize"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Compiler.compile | Compile all code and return a dict {name: code} where the keys
are determined by the keyword arguments passed to __init__().
Parameters
----------
pretty : bool
If True, use a slower method to mangle object names. This produces
GLSL that is more readable.
... | glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py | def compile(self, pretty=True):
""" Compile all code and return a dict {name: code} where the keys
are determined by the keyword arguments passed to __init__().
Parameters
----------
pretty : bool
If True, use a slower method to mangle object names. This produces
... | def compile(self, pretty=True):
""" Compile all code and return a dict {name: code} where the keys
are determined by the keyword arguments passed to __init__().
Parameters
----------
pretty : bool
If True, use a slower method to mangle object names. This produces
... | [
"Compile",
"all",
"code",
"and",
"return",
"a",
"dict",
"{",
"name",
":",
"code",
"}",
"where",
"the",
"keys",
"are",
"determined",
"by",
"the",
"keyword",
"arguments",
"passed",
"to",
"__init__",
"()",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L49-L118 | [
"def",
"compile",
"(",
"self",
",",
"pretty",
"=",
"True",
")",
":",
"# Authoritative mapping of {obj: name}",
"self",
".",
"_object_names",
"=",
"{",
"}",
"#",
"# 1. collect list of dependencies for each shader",
"#",
"# maps {shader_name: [deps]}",
"self",
".",
"_shad... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Compiler._rename_objects_fast | Rename all objects quickly to guaranteed-unique names using the
id() of each object.
This produces mostly unreadable GLSL, but is about 10x faster to
compile. | glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py | def _rename_objects_fast(self):
""" Rename all objects quickly to guaranteed-unique names using the
id() of each object.
This produces mostly unreadable GLSL, but is about 10x faster to
compile.
"""
for shader_name, deps in self._shader_deps.items():
for dep ... | def _rename_objects_fast(self):
""" Rename all objects quickly to guaranteed-unique names using the
id() of each object.
This produces mostly unreadable GLSL, but is about 10x faster to
compile.
"""
for shader_name, deps in self._shader_deps.items():
for dep ... | [
"Rename",
"all",
"objects",
"quickly",
"to",
"guaranteed",
"-",
"unique",
"names",
"using",
"the",
"id",
"()",
"of",
"each",
"object",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L120-L133 | [
"def",
"_rename_objects_fast",
"(",
"self",
")",
":",
"for",
"shader_name",
",",
"deps",
"in",
"self",
".",
"_shader_deps",
".",
"items",
"(",
")",
":",
"for",
"dep",
"in",
"deps",
":",
"name",
"=",
"dep",
".",
"name",
"if",
"name",
"!=",
"'main'",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Compiler._rename_objects_pretty | Rename all objects like "name_1" to avoid conflicts. Objects are
only renamed if necessary.
This method produces more readable GLSL, but is rather slow. | glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py | def _rename_objects_pretty(self):
""" Rename all objects like "name_1" to avoid conflicts. Objects are
only renamed if necessary.
This method produces more readable GLSL, but is rather slow.
"""
#
# 1. For each object, add its static names to the global namespace
... | def _rename_objects_pretty(self):
""" Rename all objects like "name_1" to avoid conflicts. Objects are
only renamed if necessary.
This method produces more readable GLSL, but is rather slow.
"""
#
# 1. For each object, add its static names to the global namespace
... | [
"Rename",
"all",
"objects",
"like",
"name_1",
"to",
"avoid",
"conflicts",
".",
"Objects",
"are",
"only",
"renamed",
"if",
"necessary",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L135-L181 | [
"def",
"_rename_objects_pretty",
"(",
"self",
")",
":",
"#",
"# 1. For each object, add its static names to the global namespace",
"# and make a list of the shaders used by the object.",
"#",
"# {name: obj} mapping for finding unique names",
"# initialize with reserved keywords.",
"self",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Compiler._name_available | Return True if *name* is available for *obj* in *shaders*. | glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py | def _name_available(self, obj, name, shaders):
""" Return True if *name* is available for *obj* in *shaders*.
"""
if name in self._global_ns:
return False
shaders = self.shaders if self._is_global(obj) else shaders
for shader in shaders:
if name in self._s... | def _name_available(self, obj, name, shaders):
""" Return True if *name* is available for *obj* in *shaders*.
"""
if name in self._global_ns:
return False
shaders = self.shaders if self._is_global(obj) else shaders
for shader in shaders:
if name in self._s... | [
"Return",
"True",
"if",
"*",
"name",
"*",
"is",
"available",
"for",
"*",
"obj",
"*",
"in",
"*",
"shaders",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L196-L205 | [
"def",
"_name_available",
"(",
"self",
",",
"obj",
",",
"name",
",",
"shaders",
")",
":",
"if",
"name",
"in",
"self",
".",
"_global_ns",
":",
"return",
"False",
"shaders",
"=",
"self",
".",
"shaders",
"if",
"self",
".",
"_is_global",
"(",
"obj",
")",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Compiler._assign_name | Assign *name* to *obj* in *shaders*. | glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py | def _assign_name(self, obj, name, shaders):
""" Assign *name* to *obj* in *shaders*.
"""
if self._is_global(obj):
assert name not in self._global_ns
self._global_ns[name] = obj
else:
for shader in shaders:
ns = self._shader_ns[shader]
... | def _assign_name(self, obj, name, shaders):
""" Assign *name* to *obj* in *shaders*.
"""
if self._is_global(obj):
assert name not in self._global_ns
self._global_ns[name] = obj
else:
for shader in shaders:
ns = self._shader_ns[shader]
... | [
"Assign",
"*",
"name",
"*",
"to",
"*",
"obj",
"*",
"in",
"*",
"shaders",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/shaders/compiler.py#L207-L218 | [
"def",
"_assign_name",
"(",
"self",
",",
"obj",
",",
"name",
",",
"shaders",
")",
":",
"if",
"self",
".",
"_is_global",
"(",
"obj",
")",
":",
"assert",
"name",
"not",
"in",
"self",
".",
"_global_ns",
"self",
".",
"_global_ns",
"[",
"name",
"]",
"=",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _CoreColorBarVisual._update | Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual | glue_vispy_viewers/extern/vispy/visuals/colorbar.py | def _update(self):
"""Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual
"""
x, y = self._pos
halfw, halfh = self._halfdim
# test that width and height are non-zero
if halfw <= 0:
raise ValueError("hal... | def _update(self):
"""Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual
"""
x, y = self._pos
halfw, halfh = self._halfdim
# test that width and height are non-zero
if halfw <= 0:
raise ValueError("hal... | [
"Rebuilds",
"the",
"shaders",
"and",
"repositions",
"the",
"objects",
"that",
"are",
"used",
"internally",
"by",
"the",
"ColorBarVisual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L117-L158 | [
"def",
"_update",
"(",
"self",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"_pos",
"halfw",
",",
"halfh",
"=",
"self",
".",
"_halfdim",
"# test that width and height are non-zero",
"if",
"halfw",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"half-width must ... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorBarVisual._update | Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual | glue_vispy_viewers/extern/vispy/visuals/colorbar.py | def _update(self):
"""Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual
"""
self._colorbar.halfdim = self._halfdim
self._border.halfdim = self._halfdim
self._label.text = self._label_str
self._ticks[0].text = str(... | def _update(self):
"""Rebuilds the shaders, and repositions the objects
that are used internally by the ColorBarVisual
"""
self._colorbar.halfdim = self._halfdim
self._border.halfdim = self._halfdim
self._label.text = self._label_str
self._ticks[0].text = str(... | [
"Rebuilds",
"the",
"shaders",
"and",
"repositions",
"the",
"objects",
"that",
"are",
"used",
"internally",
"by",
"the",
"ColorBarVisual"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L319-L333 | [
"def",
"_update",
"(",
"self",
")",
":",
"self",
".",
"_colorbar",
".",
"halfdim",
"=",
"self",
".",
"_halfdim",
"self",
".",
"_border",
".",
"halfdim",
"=",
"self",
".",
"_halfdim",
"self",
".",
"_label",
".",
"text",
"=",
"self",
".",
"_label_str",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorBarVisual._update_positions | updates the positions of the colorbars and labels | glue_vispy_viewers/extern/vispy/visuals/colorbar.py | def _update_positions(self):
"""
updates the positions of the colorbars and labels
"""
self._colorbar.pos = self._pos
self._border.pos = self._pos
if self._orientation == "right" or self._orientation == "left":
self._label.rotation = -90
x, y = self... | def _update_positions(self):
"""
updates the positions of the colorbars and labels
"""
self._colorbar.pos = self._pos
self._border.pos = self._pos
if self._orientation == "right" or self._orientation == "left":
self._label.rotation = -90
x, y = self... | [
"updates",
"the",
"positions",
"of",
"the",
"colorbars",
"and",
"labels"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L335-L374 | [
"def",
"_update_positions",
"(",
"self",
")",
":",
"self",
".",
"_colorbar",
".",
"pos",
"=",
"self",
".",
"_pos",
"self",
".",
"_border",
".",
"pos",
"=",
"self",
".",
"_pos",
"if",
"self",
".",
"_orientation",
"==",
"\"right\"",
"or",
"self",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorBarVisual._calc_positions | Calculate the text centeritions given the ColorBar
parameters.
Note
----
This is static because in principle, this
function does not need access to the state of the ColorBar
at all. It's a computation function that computes coordinate
transforms
Paramete... | glue_vispy_viewers/extern/vispy/visuals/colorbar.py | def _calc_positions(center, halfdim, border_width,
orientation, transforms):
"""
Calculate the text centeritions given the ColorBar
parameters.
Note
----
This is static because in principle, this
function does not need access to the state ... | def _calc_positions(center, halfdim, border_width,
orientation, transforms):
"""
Calculate the text centeritions given the ColorBar
parameters.
Note
----
This is static because in principle, this
function does not need access to the state ... | [
"Calculate",
"the",
"text",
"centeritions",
"given",
"the",
"ColorBar",
"parameters",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L471-L551 | [
"def",
"_calc_positions",
"(",
"center",
",",
"halfdim",
",",
"border_width",
",",
"orientation",
",",
"transforms",
")",
":",
"(",
"x",
",",
"y",
")",
"=",
"center",
"(",
"halfw",
",",
"halfh",
")",
"=",
"halfdim",
"visual_to_doc",
"=",
"transforms",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ColorBarVisual.size | The size of the ColorBar
Returns
-------
size: (major_axis_length, minor_axis_length)
major and minor axis are defined by the
orientation of the ColorBar | glue_vispy_viewers/extern/vispy/visuals/colorbar.py | def size(self):
""" The size of the ColorBar
Returns
-------
size: (major_axis_length, minor_axis_length)
major and minor axis are defined by the
orientation of the ColorBar
"""
(halfw, halfh) = self._halfdim
if self.orientation in ["top",... | def size(self):
""" The size of the ColorBar
Returns
-------
size: (major_axis_length, minor_axis_length)
major and minor axis are defined by the
orientation of the ColorBar
"""
(halfw, halfh) = self._halfdim
if self.orientation in ["top",... | [
"The",
"size",
"of",
"the",
"ColorBar"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/colorbar.py#L645-L658 | [
"def",
"size",
"(",
"self",
")",
":",
"(",
"halfw",
",",
"halfh",
")",
"=",
"self",
".",
"_halfdim",
"if",
"self",
".",
"orientation",
"in",
"[",
"\"top\"",
",",
"\"bottom\"",
"]",
":",
"return",
"(",
"halfw",
"*",
"2.",
",",
"halfh",
"*",
"2.",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MpdRunner.add_pseudo_fields | Add 'pseudo' fields (e.g non-displayed fields) to the display. | mpdlcd/lcdrunner.py | def add_pseudo_fields(self):
"""Add 'pseudo' fields (e.g non-displayed fields) to the display."""
fields = []
if self.backlight_on != enums.BACKLIGHT_ON_NEVER:
fields.append(
display_fields.BacklightPseudoField(ref='0', backlight_rule=self.backlight_on)
)
... | def add_pseudo_fields(self):
"""Add 'pseudo' fields (e.g non-displayed fields) to the display."""
fields = []
if self.backlight_on != enums.BACKLIGHT_ON_NEVER:
fields.append(
display_fields.BacklightPseudoField(ref='0', backlight_rule=self.backlight_on)
)
... | [
"Add",
"pseudo",
"fields",
"(",
"e",
".",
"g",
"non",
"-",
"displayed",
"fields",
")",
"to",
"the",
"display",
"."
] | rbarrois/mpdlcd | python | https://github.com/rbarrois/mpdlcd/blob/85f16c8cc0883f8abb4c2cc7f69729c3e2f857da/mpdlcd/lcdrunner.py#L63-L79 | [
"def",
"add_pseudo_fields",
"(",
"self",
")",
":",
"fields",
"=",
"[",
"]",
"if",
"self",
".",
"backlight_on",
"!=",
"enums",
".",
"BACKLIGHT_ON_NEVER",
":",
"fields",
".",
"append",
"(",
"display_fields",
".",
"BacklightPseudoField",
"(",
"ref",
"=",
"'0'",... | 85f16c8cc0883f8abb4c2cc7f69729c3e2f857da |
train | Rect.padded | Return a new Rect padded (smaller) by padding on all sides
Parameters
----------
padding : float
The padding.
Returns
-------
rect : instance of Rect
The padded rectangle. | glue_vispy_viewers/extern/vispy/geometry/rect.py | def padded(self, padding):
"""Return a new Rect padded (smaller) by padding on all sides
Parameters
----------
padding : float
The padding.
Returns
-------
rect : instance of Rect
The padded rectangle.
"""
return Rect(pos=... | def padded(self, padding):
"""Return a new Rect padded (smaller) by padding on all sides
Parameters
----------
padding : float
The padding.
Returns
-------
rect : instance of Rect
The padded rectangle.
"""
return Rect(pos=... | [
"Return",
"a",
"new",
"Rect",
"padded",
"(",
"smaller",
")",
"by",
"padding",
"on",
"all",
"sides"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L115-L129 | [
"def",
"padded",
"(",
"self",
",",
"padding",
")",
":",
"return",
"Rect",
"(",
"pos",
"=",
"(",
"self",
".",
"pos",
"[",
"0",
"]",
"+",
"padding",
",",
"self",
".",
"pos",
"[",
"1",
"]",
"+",
"padding",
")",
",",
"size",
"=",
"(",
"self",
"."... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Rect.normalized | Return a Rect covering the same area, but with height and width
guaranteed to be positive. | glue_vispy_viewers/extern/vispy/geometry/rect.py | def normalized(self):
"""Return a Rect covering the same area, but with height and width
guaranteed to be positive."""
return Rect(pos=(min(self.left, self.right),
min(self.top, self.bottom)),
size=(abs(self.width), abs(self.height))) | def normalized(self):
"""Return a Rect covering the same area, but with height and width
guaranteed to be positive."""
return Rect(pos=(min(self.left, self.right),
min(self.top, self.bottom)),
size=(abs(self.width), abs(self.height))) | [
"Return",
"a",
"Rect",
"covering",
"the",
"same",
"area",
"but",
"with",
"height",
"and",
"width",
"guaranteed",
"to",
"be",
"positive",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L131-L136 | [
"def",
"normalized",
"(",
"self",
")",
":",
"return",
"Rect",
"(",
"pos",
"=",
"(",
"min",
"(",
"self",
".",
"left",
",",
"self",
".",
"right",
")",
",",
"min",
"(",
"self",
".",
"top",
",",
"self",
".",
"bottom",
")",
")",
",",
"size",
"=",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Rect.flipped | Return a Rect with the same bounds but with axes inverted
Parameters
----------
x : bool
Flip the X axis.
y : bool
Flip the Y axis.
Returns
-------
rect : instance of Rect
The flipped rectangle. | glue_vispy_viewers/extern/vispy/geometry/rect.py | def flipped(self, x=False, y=True):
"""Return a Rect with the same bounds but with axes inverted
Parameters
----------
x : bool
Flip the X axis.
y : bool
Flip the Y axis.
Returns
-------
rect : instance of Rect
The fli... | def flipped(self, x=False, y=True):
"""Return a Rect with the same bounds but with axes inverted
Parameters
----------
x : bool
Flip the X axis.
y : bool
Flip the Y axis.
Returns
-------
rect : instance of Rect
The fli... | [
"Return",
"a",
"Rect",
"with",
"the",
"same",
"bounds",
"but",
"with",
"axes",
"inverted"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L138-L159 | [
"def",
"flipped",
"(",
"self",
",",
"x",
"=",
"False",
",",
"y",
"=",
"True",
")",
":",
"pos",
"=",
"list",
"(",
"self",
".",
"pos",
")",
"size",
"=",
"list",
"(",
"self",
".",
"size",
")",
"for",
"i",
",",
"flip",
"in",
"enumerate",
"(",
"("... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Rect._transform_in | Return array of coordinates that can be mapped by Transform
classes. | glue_vispy_viewers/extern/vispy/geometry/rect.py | def _transform_in(self):
"""Return array of coordinates that can be mapped by Transform
classes."""
return np.array([
[self.left, self.bottom, 0, 1],
[self.right, self.top, 0, 1]]) | def _transform_in(self):
"""Return array of coordinates that can be mapped by Transform
classes."""
return np.array([
[self.left, self.bottom, 0, 1],
[self.right, self.top, 0, 1]]) | [
"Return",
"array",
"of",
"coordinates",
"that",
"can",
"be",
"mapped",
"by",
"Transform",
"classes",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/geometry/rect.py#L193-L198 | [
"def",
"_transform_in",
"(",
"self",
")",
":",
"return",
"np",
".",
"array",
"(",
"[",
"[",
"self",
".",
"left",
",",
"self",
".",
"bottom",
",",
"0",
",",
"1",
"]",
",",
"[",
"self",
".",
"right",
",",
"self",
".",
"top",
",",
"0",
",",
"1",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TransformSystem.configure | Automatically configure the TransformSystem:
* canvas_transform maps from the Canvas logical pixel
coordinate system to the framebuffer coordinate system, taking into
account the logical/physical pixel scale factor, current FBO
position, and y-axis inversion.
* framebuff... | glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py | def configure(self, viewport=None, fbo_size=None, fbo_rect=None,
canvas=None):
"""Automatically configure the TransformSystem:
* canvas_transform maps from the Canvas logical pixel
coordinate system to the framebuffer coordinate system, taking into
account the log... | def configure(self, viewport=None, fbo_size=None, fbo_rect=None,
canvas=None):
"""Automatically configure the TransformSystem:
* canvas_transform maps from the Canvas logical pixel
coordinate system to the framebuffer coordinate system, taking into
account the log... | [
"Automatically",
"configure",
"the",
"TransformSystem",
":"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L164-L228 | [
"def",
"configure",
"(",
"self",
",",
"viewport",
"=",
"None",
",",
"fbo_size",
"=",
"None",
",",
"fbo_rect",
"=",
"None",
",",
"canvas",
"=",
"None",
")",
":",
"# TODO: check that d2f and f2r transforms still contain a single",
"# STTransform (if the user has modified ... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TransformSystem.dpi | Physical resolution of the document coordinate system (dots per
inch). | glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py | def dpi(self):
""" Physical resolution of the document coordinate system (dots per
inch).
"""
if self._dpi is None:
if self._canvas is None:
return None
else:
return self.canvas.dpi
else:
return self._dpi | def dpi(self):
""" Physical resolution of the document coordinate system (dots per
inch).
"""
if self._dpi is None:
if self._canvas is None:
return None
else:
return self.canvas.dpi
else:
return self._dpi | [
"Physical",
"resolution",
"of",
"the",
"document",
"coordinate",
"system",
"(",
"dots",
"per",
"inch",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L241-L251 | [
"def",
"dpi",
"(",
"self",
")",
":",
"if",
"self",
".",
"_dpi",
"is",
"None",
":",
"if",
"self",
".",
"_canvas",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
"canvas",
".",
"dpi",
"else",
":",
"return",
"self",
".",
"_... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TransformSystem.get_transform | Return a transform mapping between any two coordinate systems.
Parameters
----------
map_from : str
The starting coordinate system to map from. Must be one of: visual,
scene, document, canvas, framebuffer, or render.
map_to : str
The ending co... | glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py | def get_transform(self, map_from='visual', map_to='render'):
"""Return a transform mapping between any two coordinate systems.
Parameters
----------
map_from : str
The starting coordinate system to map from. Must be one of: visual,
scene, document, canvas... | def get_transform(self, map_from='visual', map_to='render'):
"""Return a transform mapping between any two coordinate systems.
Parameters
----------
map_from : str
The starting coordinate system to map from. Must be one of: visual,
scene, document, canvas... | [
"Return",
"a",
"transform",
"mapping",
"between",
"any",
"two",
"coordinate",
"systems",
".",
"Parameters",
"----------",
"map_from",
":",
"str",
"The",
"starting",
"coordinate",
"system",
"to",
"map",
"from",
".",
"Must",
"be",
"one",
"of",
":",
"visual",
"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/transform_system.py#L313-L335 | [
"def",
"get_transform",
"(",
"self",
",",
"map_from",
"=",
"'visual'",
",",
"map_to",
"=",
"'render'",
")",
":",
"tr",
"=",
"[",
"'visual'",
",",
"'scene'",
",",
"'document'",
",",
"'canvas'",
",",
"'framebuffer'",
",",
"'render'",
"]",
"ifrom",
"=",
"tr... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _calculate_delta_pos | Helper to calculate the delta position | glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/force_directed.py | def _calculate_delta_pos(adjacency_arr, pos, t, optimal):
"""Helper to calculate the delta position"""
# XXX eventually this should be refactored for the sparse case to only
# do the necessary pairwise distances
delta = pos[:, np.newaxis, :] - pos
# Distance between points
distance2 = (delta*de... | def _calculate_delta_pos(adjacency_arr, pos, t, optimal):
"""Helper to calculate the delta position"""
# XXX eventually this should be refactored for the sparse case to only
# do the necessary pairwise distances
delta = pos[:, np.newaxis, :] - pos
# Distance between points
distance2 = (delta*de... | [
"Helper",
"to",
"calculate",
"the",
"delta",
"position"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/graphs/layouts/force_directed.py#L190-L212 | [
"def",
"_calculate_delta_pos",
"(",
"adjacency_arr",
",",
"pos",
",",
"t",
",",
"optimal",
")",
":",
"# XXX eventually this should be refactored for the sparse case to only",
"# do the necessary pairwise distances",
"delta",
"=",
"pos",
"[",
":",
",",
"np",
".",
"newaxis"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_recipe_intent_handler | You can insert arbitrary business logic code here | lambda_function.py | def get_recipe_intent_handler(request):
"""
You can insert arbitrary business logic code here
"""
# Get variables like userId, slots, intent name etc from the 'Request' object
ingredient = request.slots["Ingredient"] # Gets an Ingredient Slot from the Request object.
if ingredient == ... | def get_recipe_intent_handler(request):
"""
You can insert arbitrary business logic code here
"""
# Get variables like userId, slots, intent name etc from the 'Request' object
ingredient = request.slots["Ingredient"] # Gets an Ingredient Slot from the Request object.
if ingredient == ... | [
"You",
"can",
"insert",
"arbitrary",
"business",
"logic",
"code",
"here"
] | anjishnu/ask-alexa-pykit | python | https://github.com/anjishnu/ask-alexa-pykit/blob/a47c278ca7a60532bbe1a9b789f6c37e609fea8b/lambda_function.py#L47-L71 | [
"def",
"get_recipe_intent_handler",
"(",
"request",
")",
":",
"# Get variables like userId, slots, intent name etc from the 'Request' object",
"ingredient",
"=",
"request",
".",
"slots",
"[",
"\"Ingredient\"",
"]",
"# Gets an Ingredient Slot from the Request object.",
"if",
"ingred... | a47c278ca7a60532bbe1a9b789f6c37e609fea8b |
train | use | Set the usage options for vispy
Specify what app backend and GL backend to use.
Parameters
----------
app : str
The app backend to use (case insensitive). Standard backends:
* 'PyQt4': use Qt widget toolkit via PyQt4.
* 'PyQt5': use Qt widget toolkit via PyQt5.
... | glue_vispy_viewers/extern/vispy/util/wrappers.py | def use(app=None, gl=None):
""" Set the usage options for vispy
Specify what app backend and GL backend to use.
Parameters
----------
app : str
The app backend to use (case insensitive). Standard backends:
* 'PyQt4': use Qt widget toolkit via PyQt4.
* 'PyQt5': use Q... | def use(app=None, gl=None):
""" Set the usage options for vispy
Specify what app backend and GL backend to use.
Parameters
----------
app : str
The app backend to use (case insensitive). Standard backends:
* 'PyQt4': use Qt widget toolkit via PyQt4.
* 'PyQt5': use Q... | [
"Set",
"the",
"usage",
"options",
"for",
"vispy"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/wrappers.py#L23-L94 | [
"def",
"use",
"(",
"app",
"=",
"None",
",",
"gl",
"=",
"None",
")",
":",
"if",
"app",
"is",
"None",
"and",
"gl",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'Must specify at least one of \"app\" or \"gl\".'",
")",
"# Example for future. This wont work (yet).",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | run_subprocess | Run command using subprocess.Popen
Run command and wait for command to complete. If the return code was zero
then return, otherwise raise CalledProcessError.
By default, this will also add stdout= and stderr=subproces.PIPE
to the call to Popen to suppress printing to the terminal.
Parameters
-... | glue_vispy_viewers/extern/vispy/util/wrappers.py | def run_subprocess(command, return_code=False, **kwargs):
"""Run command using subprocess.Popen
Run command and wait for command to complete. If the return code was zero
then return, otherwise raise CalledProcessError.
By default, this will also add stdout= and stderr=subproces.PIPE
to the call to ... | def run_subprocess(command, return_code=False, **kwargs):
"""Run command using subprocess.Popen
Run command and wait for command to complete. If the return code was zero
then return, otherwise raise CalledProcessError.
By default, this will also add stdout= and stderr=subproces.PIPE
to the call to ... | [
"Run",
"command",
"using",
"subprocess",
".",
"Popen"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/wrappers.py#L97-L148 | [
"def",
"run_subprocess",
"(",
"command",
",",
"return_code",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# code adapted with permission from mne-python",
"use_kwargs",
"=",
"dict",
"(",
"stderr",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subproc... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Timer.start | Start the timer.
A timeout event will be generated every *interval* seconds.
If *interval* is None, then self.interval will be used.
If *iterations* is specified, the timer will stop after
emitting that number of events. If unspecified, then
the previous value of self.iteration... | glue_vispy_viewers/extern/vispy/app/timer.py | def start(self, interval=None, iterations=None):
"""Start the timer.
A timeout event will be generated every *interval* seconds.
If *interval* is None, then self.interval will be used.
If *iterations* is specified, the timer will stop after
emitting that number of events. If un... | def start(self, interval=None, iterations=None):
"""Start the timer.
A timeout event will be generated every *interval* seconds.
If *interval* is None, then self.interval will be used.
If *iterations* is specified, the timer will stop after
emitting that number of events. If un... | [
"Start",
"the",
"timer",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/timer.py#L97-L124 | [
"def",
"start",
"(",
"self",
",",
"interval",
"=",
"None",
",",
"iterations",
"=",
"None",
")",
":",
"if",
"self",
".",
"running",
":",
"return",
"# don't do anything if already running",
"self",
".",
"iter_count",
"=",
"0",
"if",
"interval",
"is",
"not",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Timer.stop | Stop the timer. | glue_vispy_viewers/extern/vispy/app/timer.py | def stop(self):
"""Stop the timer."""
self._backend._vispy_stop()
self._running = False
self.events.stop(type='timer_stop') | def stop(self):
"""Stop the timer."""
self._backend._vispy_stop()
self._running = False
self.events.stop(type='timer_stop') | [
"Stop",
"the",
"timer",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/app/timer.py#L126-L130 | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"_backend",
".",
"_vispy_stop",
"(",
")",
"self",
".",
"_running",
"=",
"False",
"self",
".",
"events",
".",
"stop",
"(",
"type",
"=",
"'timer_stop'",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | MOC._best_res_pixels | Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order.
Returns
-------
result : `~numpy.ndarray`
The array of HEALPix at ``max_order`` | mocpy/moc/moc.py | def _best_res_pixels(self):
"""
Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order.
Returns
-------
result : `~numpy.ndarray`
The array of HEALPix at ``max_order``
"""
factor = 2 * (AbstractMOC.HPY_MAX_NORDER - self... | def _best_res_pixels(self):
"""
Returns a numpy array of all the HEALPix indexes contained in the MOC at its max order.
Returns
-------
result : `~numpy.ndarray`
The array of HEALPix at ``max_order``
"""
factor = 2 * (AbstractMOC.HPY_MAX_NORDER - self... | [
"Returns",
"a",
"numpy",
"array",
"of",
"all",
"the",
"HEALPix",
"indexes",
"contained",
"in",
"the",
"MOC",
"at",
"its",
"max",
"order",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L71-L86 | [
"def",
"_best_res_pixels",
"(",
"self",
")",
":",
"factor",
"=",
"2",
"*",
"(",
"AbstractMOC",
".",
"HPY_MAX_NORDER",
"-",
"self",
".",
"max_order",
")",
"pix_l",
"=",
"[",
"]",
"for",
"iv",
"in",
"self",
".",
"_interval_set",
".",
"_intervals",
":",
"... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.contains | Returns a boolean mask array of the positions lying inside (or outside) the MOC instance.
Parameters
----------
ra : `astropy.units.Quantity`
Right ascension array
dec : `astropy.units.Quantity`
Declination array
keep_inside : bool, optional
T... | mocpy/moc/moc.py | def contains(self, ra, dec, keep_inside=True):
"""
Returns a boolean mask array of the positions lying inside (or outside) the MOC instance.
Parameters
----------
ra : `astropy.units.Quantity`
Right ascension array
dec : `astropy.units.Quantity`
D... | def contains(self, ra, dec, keep_inside=True):
"""
Returns a boolean mask array of the positions lying inside (or outside) the MOC instance.
Parameters
----------
ra : `astropy.units.Quantity`
Right ascension array
dec : `astropy.units.Quantity`
D... | [
"Returns",
"a",
"boolean",
"mask",
"array",
"of",
"the",
"positions",
"lying",
"inside",
"(",
"or",
"outside",
")",
"the",
"MOC",
"instance",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L88-L119 | [
"def",
"contains",
"(",
"self",
",",
"ra",
",",
"dec",
",",
"keep_inside",
"=",
"True",
")",
":",
"depth",
"=",
"self",
".",
"max_order",
"m",
"=",
"np",
".",
"zeros",
"(",
"nside2npix",
"(",
"1",
"<<",
"depth",
")",
",",
"dtype",
"=",
"bool",
")... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.