Search is not available for this dataset
identifier
stringlengths 1
155
| parameters
stringlengths 2
6.09k
| docstring
stringlengths 11
63.4k
| docstring_summary
stringlengths 0
63.4k
| function
stringlengths 29
99.8k
| function_tokens
sequence | start_point
sequence | end_point
sequence | language
stringclasses 1
value | docstring_language
stringlengths 2
7
| docstring_language_predictions
stringlengths 18
23
| is_langid_reliable
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|
Volume.opacityscale | (self) |
Sets the opacityscale. The opacityscale must be an array
containing arrays mapping a normalized value to an opacity
value. At minimum, a mapping for the lowest (0) and highest (1)
values are required. For example, `[[0, 1], [0.5, 0.2], [1,
1]]` means that higher/lower values would have higher opacity
values and those in the middle would be more transparent
Alternatively, `opacityscale` may be a palette name string of
the following list: 'min', 'max', 'extremes' and 'uniform'. The
default is 'uniform'.
The 'opacityscale' property accepts values of any type
Returns
-------
Any
|
Sets the opacityscale. The opacityscale must be an array
containing arrays mapping a normalized value to an opacity
value. At minimum, a mapping for the lowest (0) and highest (1)
values are required. For example, `[[0, 1], [0.5, 0.2], [1,
1]]` means that higher/lower values would have higher opacity
values and those in the middle would be more transparent
Alternatively, `opacityscale` may be a palette name string of
the following list: 'min', 'max', 'extremes' and 'uniform'. The
default is 'uniform'.
The 'opacityscale' property accepts values of any type | def opacityscale(self):
"""
Sets the opacityscale. The opacityscale must be an array
containing arrays mapping a normalized value to an opacity
value. At minimum, a mapping for the lowest (0) and highest (1)
values are required. For example, `[[0, 1], [0.5, 0.2], [1,
1]]` means that higher/lower values would have higher opacity
values and those in the middle would be more transparent
Alternatively, `opacityscale` may be a palette name string of
the following list: 'min', 'max', 'extremes' and 'uniform'. The
default is 'uniform'.
The 'opacityscale' property accepts values of any type
Returns
-------
Any
"""
return self["opacityscale"] | [
"def",
"opacityscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacityscale\"",
"]"
] | [
1118,
4
] | [
1136,
35
] | python | en | ['en', 'error', 'th'] | False |
Volume.reversescale | (self) |
Reverses the color mapping if true. If true, `cmin` will
correspond to the last color in the array and `cmax` will
correspond to the first color.
The 'reversescale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Reverses the color mapping if true. If true, `cmin` will
correspond to the last color in the array and `cmax` will
correspond to the first color.
The 'reversescale' property must be specified as a bool
(either True, or False) | def reversescale(self):
"""
Reverses the color mapping if true. If true, `cmin` will
correspond to the last color in the array and `cmax` will
correspond to the first color.
The 'reversescale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["reversescale"] | [
"def",
"reversescale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"reversescale\"",
"]"
] | [
1145,
4
] | [
1158,
35
] | python | en | ['en', 'error', 'th'] | False |
Volume.scene | (self) |
Sets a reference between this trace's 3D coordinate system and
a 3D scene. If "scene" (the default value), the (x,y,z)
coordinates refer to `layout.scene`. If "scene2", the (x,y,z)
coordinates refer to `layout.scene2`, and so on.
The 'scene' property is an identifier of a particular
subplot, of type 'scene', that may be specified as the string 'scene'
optionally followed by an integer >= 1
(e.g. 'scene', 'scene1', 'scene2', 'scene3', etc.)
Returns
-------
str
|
Sets a reference between this trace's 3D coordinate system and
a 3D scene. If "scene" (the default value), the (x,y,z)
coordinates refer to `layout.scene`. If "scene2", the (x,y,z)
coordinates refer to `layout.scene2`, and so on.
The 'scene' property is an identifier of a particular
subplot, of type 'scene', that may be specified as the string 'scene'
optionally followed by an integer >= 1
(e.g. 'scene', 'scene1', 'scene2', 'scene3', etc.) | def scene(self):
"""
Sets a reference between this trace's 3D coordinate system and
a 3D scene. If "scene" (the default value), the (x,y,z)
coordinates refer to `layout.scene`. If "scene2", the (x,y,z)
coordinates refer to `layout.scene2`, and so on.
The 'scene' property is an identifier of a particular
subplot, of type 'scene', that may be specified as the string 'scene'
optionally followed by an integer >= 1
(e.g. 'scene', 'scene1', 'scene2', 'scene3', etc.)
Returns
-------
str
"""
return self["scene"] | [
"def",
"scene",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"scene\"",
"]"
] | [
1167,
4
] | [
1183,
28
] | python | en | ['en', 'error', 'th'] | False |
Volume.showlegend | (self) |
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False) | def showlegend(self):
"""
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showlegend"] | [
"def",
"showlegend",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showlegend\"",
"]"
] | [
1192,
4
] | [
1204,
33
] | python | en | ['en', 'error', 'th'] | False |
Volume.showscale | (self) |
Determines whether or not a colorbar is displayed for this
trace.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a colorbar is displayed for this
trace.
The 'showscale' property must be specified as a bool
(either True, or False) | def showscale(self):
"""
Determines whether or not a colorbar is displayed for this
trace.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showscale"] | [
"def",
"showscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showscale\"",
"]"
] | [
1213,
4
] | [
1225,
32
] | python | en | ['en', 'error', 'th'] | False |
Volume.slices | (self) |
The 'slices' property is an instance of Slices
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Slices`
- A dict of string/value properties that will be passed
to the Slices constructor
Supported dict properties:
x
:class:`plotly.graph_objects.volume.slices.X`
instance or dict with compatible properties
y
:class:`plotly.graph_objects.volume.slices.Y`
instance or dict with compatible properties
z
:class:`plotly.graph_objects.volume.slices.Z`
instance or dict with compatible properties
Returns
-------
plotly.graph_objs.volume.Slices
|
The 'slices' property is an instance of Slices
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Slices`
- A dict of string/value properties that will be passed
to the Slices constructor
Supported dict properties:
x
:class:`plotly.graph_objects.volume.slices.X`
instance or dict with compatible properties
y
:class:`plotly.graph_objects.volume.slices.Y`
instance or dict with compatible properties
z
:class:`plotly.graph_objects.volume.slices.Z`
instance or dict with compatible properties | def slices(self):
"""
The 'slices' property is an instance of Slices
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Slices`
- A dict of string/value properties that will be passed
to the Slices constructor
Supported dict properties:
x
:class:`plotly.graph_objects.volume.slices.X`
instance or dict with compatible properties
y
:class:`plotly.graph_objects.volume.slices.Y`
instance or dict with compatible properties
z
:class:`plotly.graph_objects.volume.slices.Z`
instance or dict with compatible properties
Returns
-------
plotly.graph_objs.volume.Slices
"""
return self["slices"] | [
"def",
"slices",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"slices\"",
"]"
] | [
1234,
4
] | [
1258,
29
] | python | en | ['en', 'error', 'th'] | False |
Volume.spaceframe | (self) |
The 'spaceframe' property is an instance of Spaceframe
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Spaceframe`
- A dict of string/value properties that will be passed
to the Spaceframe constructor
Supported dict properties:
fill
Sets the fill ratio of the `spaceframe`
elements. The default fill value is 1 meaning
that they are entirely shaded. Applying a
`fill` ratio less than one would allow the
creation of openings parallel to the edges.
show
Displays/hides tetrahedron shapes between
minimum and maximum iso-values. Often useful
when either caps or surfaces are disabled or
filled with values less than 1.
Returns
-------
plotly.graph_objs.volume.Spaceframe
|
The 'spaceframe' property is an instance of Spaceframe
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Spaceframe`
- A dict of string/value properties that will be passed
to the Spaceframe constructor
Supported dict properties:
fill
Sets the fill ratio of the `spaceframe`
elements. The default fill value is 1 meaning
that they are entirely shaded. Applying a
`fill` ratio less than one would allow the
creation of openings parallel to the edges.
show
Displays/hides tetrahedron shapes between
minimum and maximum iso-values. Often useful
when either caps or surfaces are disabled or
filled with values less than 1. | def spaceframe(self):
"""
The 'spaceframe' property is an instance of Spaceframe
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Spaceframe`
- A dict of string/value properties that will be passed
to the Spaceframe constructor
Supported dict properties:
fill
Sets the fill ratio of the `spaceframe`
elements. The default fill value is 1 meaning
that they are entirely shaded. Applying a
`fill` ratio less than one would allow the
creation of openings parallel to the edges.
show
Displays/hides tetrahedron shapes between
minimum and maximum iso-values. Often useful
when either caps or surfaces are disabled or
filled with values less than 1.
Returns
-------
plotly.graph_objs.volume.Spaceframe
"""
return self["spaceframe"] | [
"def",
"spaceframe",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"spaceframe\"",
"]"
] | [
1267,
4
] | [
1293,
33
] | python | en | ['en', 'error', 'th'] | False |
Volume.stream | (self) |
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.volume.Stream
|
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details. | def stream(self):
"""
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.volume.Stream
"""
return self["stream"] | [
"def",
"stream",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"stream\"",
"]"
] | [
1302,
4
] | [
1326,
29
] | python | en | ['en', 'error', 'th'] | False |
Volume.surface | (self) |
The 'surface' property is an instance of Surface
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Surface`
- A dict of string/value properties that will be passed
to the Surface constructor
Supported dict properties:
count
Sets the number of iso-surfaces between minimum
and maximum iso-values. By default this value
is 2 meaning that only minimum and maximum
surfaces would be drawn.
fill
Sets the fill ratio of the iso-surface. The
default fill value of the surface is 1 meaning
that they are entirely shaded. On the other
hand Applying a `fill` ratio less than one
would allow the creation of openings parallel
to the edges.
pattern
Sets the surface pattern of the iso-surface 3-D
sections. The default pattern of the surface is
`all` meaning that the rest of surface elements
would be shaded. The check options (either 1 or
2) could be used to draw half of the squares on
the surface. Using various combinations of
capital `A`, `B`, `C`, `D` and `E` may also be
used to reduce the number of triangles on the
iso-surfaces and creating other patterns of
interest.
show
Hides/displays surfaces between minimum and
maximum iso-values.
Returns
-------
plotly.graph_objs.volume.Surface
|
The 'surface' property is an instance of Surface
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Surface`
- A dict of string/value properties that will be passed
to the Surface constructor
Supported dict properties:
count
Sets the number of iso-surfaces between minimum
and maximum iso-values. By default this value
is 2 meaning that only minimum and maximum
surfaces would be drawn.
fill
Sets the fill ratio of the iso-surface. The
default fill value of the surface is 1 meaning
that they are entirely shaded. On the other
hand Applying a `fill` ratio less than one
would allow the creation of openings parallel
to the edges.
pattern
Sets the surface pattern of the iso-surface 3-D
sections. The default pattern of the surface is
`all` meaning that the rest of surface elements
would be shaded. The check options (either 1 or
2) could be used to draw half of the squares on
the surface. Using various combinations of
capital `A`, `B`, `C`, `D` and `E` may also be
used to reduce the number of triangles on the
iso-surfaces and creating other patterns of
interest.
show
Hides/displays surfaces between minimum and
maximum iso-values. | def surface(self):
"""
The 'surface' property is an instance of Surface
that may be specified as:
- An instance of :class:`plotly.graph_objs.volume.Surface`
- A dict of string/value properties that will be passed
to the Surface constructor
Supported dict properties:
count
Sets the number of iso-surfaces between minimum
and maximum iso-values. By default this value
is 2 meaning that only minimum and maximum
surfaces would be drawn.
fill
Sets the fill ratio of the iso-surface. The
default fill value of the surface is 1 meaning
that they are entirely shaded. On the other
hand Applying a `fill` ratio less than one
would allow the creation of openings parallel
to the edges.
pattern
Sets the surface pattern of the iso-surface 3-D
sections. The default pattern of the surface is
`all` meaning that the rest of surface elements
would be shaded. The check options (either 1 or
2) could be used to draw half of the squares on
the surface. Using various combinations of
capital `A`, `B`, `C`, `D` and `E` may also be
used to reduce the number of triangles on the
iso-surfaces and creating other patterns of
interest.
show
Hides/displays surfaces between minimum and
maximum iso-values.
Returns
-------
plotly.graph_objs.volume.Surface
"""
return self["surface"] | [
"def",
"surface",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"surface\"",
"]"
] | [
1335,
4
] | [
1376,
30
] | python | en | ['en', 'error', 'th'] | False |
Volume.text | (self) |
Sets the text elements associated with the vertices. If trace
`hoverinfo` contains a "text" flag and "hovertext" is not set,
these elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Sets the text elements associated with the vertices. If trace
`hoverinfo` contains a "text" flag and "hovertext" is not set,
these elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def text(self):
"""
Sets the text elements associated with the vertices. If trace
`hoverinfo` contains a "text" flag and "hovertext" is not set,
these elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["text"] | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
1385,
4
] | [
1400,
27
] | python | en | ['en', 'error', 'th'] | False |
Volume.textsrc | (self) |
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def textsrc(self):
"""
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["textsrc"] | [
"def",
"textsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"textsrc\"",
"]"
] | [
1409,
4
] | [
1420,
30
] | python | en | ['en', 'error', 'th'] | False |
Volume.uid | (self) |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["uid"] | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | [
1429,
4
] | [
1442,
26
] | python | en | ['en', 'error', 'th'] | False |
Volume.uirevision | (self) |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
|
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
"""
return self["uirevision"] | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | [
1451,
4
] | [
1475,
33
] | python | en | ['en', 'error', 'th'] | False |
Volume.value | (self) |
Sets the 4th dimension (value) of the vertices.
The 'value' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the 4th dimension (value) of the vertices.
The 'value' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def value(self):
"""
Sets the 4th dimension (value) of the vertices.
The 'value' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["value"] | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
1484,
4
] | [
1495,
28
] | python | en | ['en', 'error', 'th'] | False |
Volume.valuesrc | (self) |
Sets the source reference on Chart Studio Cloud for value .
The 'valuesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for value .
The 'valuesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def valuesrc(self):
"""
Sets the source reference on Chart Studio Cloud for value .
The 'valuesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["valuesrc"] | [
"def",
"valuesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"valuesrc\"",
"]"
] | [
1504,
4
] | [
1515,
31
] | python | en | ['en', 'error', 'th'] | False |
Volume.visible | (self) |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
|
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly'] | def visible(self):
"""
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
1524,
4
] | [
1538,
30
] | python | en | ['en', 'error', 'th'] | False |
Volume.x | (self) |
Sets the X coordinates of the vertices on X axis.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the X coordinates of the vertices on X axis.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def x(self):
"""
Sets the X coordinates of the vertices on X axis.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
1547,
4
] | [
1558,
24
] | python | en | ['en', 'error', 'th'] | False |
Volume.xsrc | (self) |
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def xsrc(self):
"""
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["xsrc"] | [
"def",
"xsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xsrc\"",
"]"
] | [
1567,
4
] | [
1578,
27
] | python | en | ['en', 'error', 'th'] | False |
Volume.y | (self) |
Sets the Y coordinates of the vertices on Y axis.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the Y coordinates of the vertices on Y axis.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def y(self):
"""
Sets the Y coordinates of the vertices on Y axis.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["y"] | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
1587,
4
] | [
1598,
24
] | python | en | ['en', 'error', 'th'] | False |
Volume.ysrc | (self) |
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def ysrc(self):
"""
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["ysrc"] | [
"def",
"ysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ysrc\"",
"]"
] | [
1607,
4
] | [
1618,
27
] | python | en | ['en', 'error', 'th'] | False |
Volume.z | (self) |
Sets the Z coordinates of the vertices on Z axis.
The 'z' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the Z coordinates of the vertices on Z axis.
The 'z' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def z(self):
"""
Sets the Z coordinates of the vertices on Z axis.
The 'z' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["z"] | [
"def",
"z",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"z\"",
"]"
] | [
1627,
4
] | [
1638,
24
] | python | en | ['en', 'error', 'th'] | False |
Volume.zsrc | (self) |
Sets the source reference on Chart Studio Cloud for z .
The 'zsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for z .
The 'zsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def zsrc(self):
"""
Sets the source reference on Chart Studio Cloud for z .
The 'zsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["zsrc"] | [
"def",
"zsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"zsrc\"",
"]"
] | [
1647,
4
] | [
1658,
27
] | python | en | ['en', 'error', 'th'] | False |
Volume.__init__ | (
self,
arg=None,
autocolorscale=None,
caps=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
coloraxis=None,
colorbar=None,
colorscale=None,
contour=None,
customdata=None,
customdatasrc=None,
flatshading=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplatesrc=None,
hovertext=None,
hovertextsrc=None,
ids=None,
idssrc=None,
isomax=None,
isomin=None,
legendgroup=None,
lighting=None,
lightposition=None,
meta=None,
metasrc=None,
name=None,
opacity=None,
opacityscale=None,
reversescale=None,
scene=None,
showlegend=None,
showscale=None,
slices=None,
spaceframe=None,
stream=None,
surface=None,
text=None,
textsrc=None,
uid=None,
uirevision=None,
value=None,
valuesrc=None,
visible=None,
x=None,
xsrc=None,
y=None,
ysrc=None,
z=None,
zsrc=None,
**kwargs
) |
Construct a new Volume object
Draws volume trace between iso-min and iso-max values with
coordinates given by four 1-dimensional arrays containing the
`value`, `x`, `y` and `z` of every vertex of a uniform or non-
uniform 3-D grid. Horizontal or vertical slices, caps as well
as spaceframe between iso-min and iso-max values could also be
drawn using this trace.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Volume`
autocolorscale
Determines whether the colorscale is a default palette
(`autocolorscale: true`) or the palette determined by
`colorscale`. In case `colorscale` is unspecified or
`autocolorscale` is true, the default palette will be
chosen according to whether numbers in the `color`
array are all positive, all negative or mixed.
caps
:class:`plotly.graph_objects.volume.Caps` instance or
dict with compatible properties
cauto
Determines whether or not the color domain is computed
with respect to the input data (here `value`) or the
bounds set in `cmin` and `cmax` Defaults to `false`
when `cmin` and `cmax` are set by the user.
cmax
Sets the upper bound of the color domain. Value should
have the same units as `value` and if set, `cmin` must
be set as well.
cmid
Sets the mid-point of the color domain by scaling
`cmin` and/or `cmax` to be equidistant to this point.
Value should have the same units as `value`. Has no
effect when `cauto` is `false`.
cmin
Sets the lower bound of the color domain. Value should
have the same units as `value` and if set, `cmax` must
be set as well.
coloraxis
Sets a reference to a shared color axis. References to
these shared color axes are "coloraxis", "coloraxis2",
"coloraxis3", etc. Settings for these shared color axes
are set in the layout, under `layout.coloraxis`,
`layout.coloraxis2`, etc. Note that multiple color
scales can be linked to the same color axis.
colorbar
:class:`plotly.graph_objects.volume.ColorBar` instance
or dict with compatible properties
colorscale
Sets the colorscale. The colorscale must be an array
containing arrays mapping a normalized value to an rgb,
rgba, hex, hsl, hsv, or named color string. At minimum,
a mapping for the lowest (0) and highest (1) values are
required. For example, `[[0, 'rgb(0,0,255)'], [1,
'rgb(255,0,0)']]`. To control the bounds of the
colorscale in color space, use`cmin` and `cmax`.
Alternatively, `colorscale` may be a palette name
string of the following list: Greys,YlGnBu,Greens,YlOrR
d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H
ot,Blackbody,Earth,Electric,Viridis,Cividis.
contour
:class:`plotly.graph_objects.volume.Contour` instance
or dict with compatible properties
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
flatshading
Determines whether or not normal smoothing is applied
to the meshes, creating meshes with an angular, low-
poly look via flat reflections.
hoverinfo
Determines which trace information appear on hover. If
`none` or `skip` are set, no information is displayed
upon hovering. But, if `none` is set, click and hover
events are still fired.
hoverinfosrc
Sets the source reference on Chart Studio Cloud for
hoverinfo .
hoverlabel
:class:`plotly.graph_objects.volume.Hoverlabel`
instance or dict with compatible properties
hovertemplate
Template string used for rendering the information that
appear on hover box. Note that this will override
`hoverinfo`. Variables are inserted using %{variable},
for example "y: %{y}". Numbers are formatted using
d3-format's syntax %{variable:d3-format}, for example
"Price: %{y:$.2f}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for
details on the formatting syntax. Dates are formatted
using d3-time-format's syntax %{variable|d3-time-
format}, for example "Day: %{2019-01-01|%A}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for
details on the date formatting syntax. The variables
available in `hovertemplate` are the ones emitted as
event data described at this link
https://plotly.com/javascript/plotlyjs-events/#event-
data. Additionally, every attributes that can be
specified per-point (the ones that are `arrayOk: true`)
are available. Anything contained in tag `<extra>` is
displayed in the secondary box, for example
"<extra>{fullData.name}</extra>". To hide the secondary
box completely, use an empty tag `<extra></extra>`.
hovertemplatesrc
Sets the source reference on Chart Studio Cloud for
hovertemplate .
hovertext
Same as `text`.
hovertextsrc
Sets the source reference on Chart Studio Cloud for
hovertext .
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
isomax
Sets the maximum boundary for iso-surface plot.
isomin
Sets the minimum boundary for iso-surface plot.
legendgroup
Sets the legend group for this trace. Traces part of
the same legend group hide/show at the same time when
toggling legend items.
lighting
:class:`plotly.graph_objects.volume.Lighting` instance
or dict with compatible properties
lightposition
:class:`plotly.graph_objects.volume.Lightposition`
instance or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
opacity
Sets the opacity of the surface. Please note that in
the case of using high `opacity` values for example a
value greater than or equal to 0.5 on two surfaces (and
0.25 with four surfaces), an overlay of multiple
transparent surfaces may not perfectly be sorted in
depth by the webgl API. This behavior may be improved
in the near future and is subject to change.
opacityscale
Sets the opacityscale. The opacityscale must be an
array containing arrays mapping a normalized value to
an opacity value. At minimum, a mapping for the lowest
(0) and highest (1) values are required. For example,
`[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower
values would have higher opacity values and those in
the middle would be more transparent Alternatively,
`opacityscale` may be a palette name string of the
following list: 'min', 'max', 'extremes' and 'uniform'.
The default is 'uniform'.
reversescale
Reverses the color mapping if true. If true, `cmin`
will correspond to the last color in the array and
`cmax` will correspond to the first color.
scene
Sets a reference between this trace's 3D coordinate
system and a 3D scene. If "scene" (the default value),
the (x,y,z) coordinates refer to `layout.scene`. If
"scene2", the (x,y,z) coordinates refer to
`layout.scene2`, and so on.
showlegend
Determines whether or not an item corresponding to this
trace is shown in the legend.
showscale
Determines whether or not a colorbar is displayed for
this trace.
slices
:class:`plotly.graph_objects.volume.Slices` instance or
dict with compatible properties
spaceframe
:class:`plotly.graph_objects.volume.Spaceframe`
instance or dict with compatible properties
stream
:class:`plotly.graph_objects.volume.Stream` instance or
dict with compatible properties
surface
:class:`plotly.graph_objects.volume.Surface` instance
or dict with compatible properties
text
Sets the text elements associated with the vertices. If
trace `hoverinfo` contains a "text" flag and
"hovertext" is not set, these elements will be seen in
the hover labels.
textsrc
Sets the source reference on Chart Studio Cloud for
text .
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
value
Sets the 4th dimension (value) of the vertices.
valuesrc
Sets the source reference on Chart Studio Cloud for
value .
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
x
Sets the X coordinates of the vertices on X axis.
xsrc
Sets the source reference on Chart Studio Cloud for x
.
y
Sets the Y coordinates of the vertices on Y axis.
ysrc
Sets the source reference on Chart Studio Cloud for y
.
z
Sets the Z coordinates of the vertices on Z axis.
zsrc
Sets the source reference on Chart Studio Cloud for z
.
Returns
-------
Volume
|
Construct a new Volume object
Draws volume trace between iso-min and iso-max values with
coordinates given by four 1-dimensional arrays containing the
`value`, `x`, `y` and `z` of every vertex of a uniform or non-
uniform 3-D grid. Horizontal or vertical slices, caps as well
as spaceframe between iso-min and iso-max values could also be
drawn using this trace. | def __init__(
self,
arg=None,
autocolorscale=None,
caps=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
coloraxis=None,
colorbar=None,
colorscale=None,
contour=None,
customdata=None,
customdatasrc=None,
flatshading=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplatesrc=None,
hovertext=None,
hovertextsrc=None,
ids=None,
idssrc=None,
isomax=None,
isomin=None,
legendgroup=None,
lighting=None,
lightposition=None,
meta=None,
metasrc=None,
name=None,
opacity=None,
opacityscale=None,
reversescale=None,
scene=None,
showlegend=None,
showscale=None,
slices=None,
spaceframe=None,
stream=None,
surface=None,
text=None,
textsrc=None,
uid=None,
uirevision=None,
value=None,
valuesrc=None,
visible=None,
x=None,
xsrc=None,
y=None,
ysrc=None,
z=None,
zsrc=None,
**kwargs
):
"""
Construct a new Volume object
Draws volume trace between iso-min and iso-max values with
coordinates given by four 1-dimensional arrays containing the
`value`, `x`, `y` and `z` of every vertex of a uniform or non-
uniform 3-D grid. Horizontal or vertical slices, caps as well
as spaceframe between iso-min and iso-max values could also be
drawn using this trace.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Volume`
autocolorscale
Determines whether the colorscale is a default palette
(`autocolorscale: true`) or the palette determined by
`colorscale`. In case `colorscale` is unspecified or
`autocolorscale` is true, the default palette will be
chosen according to whether numbers in the `color`
array are all positive, all negative or mixed.
caps
:class:`plotly.graph_objects.volume.Caps` instance or
dict with compatible properties
cauto
Determines whether or not the color domain is computed
with respect to the input data (here `value`) or the
bounds set in `cmin` and `cmax` Defaults to `false`
when `cmin` and `cmax` are set by the user.
cmax
Sets the upper bound of the color domain. Value should
have the same units as `value` and if set, `cmin` must
be set as well.
cmid
Sets the mid-point of the color domain by scaling
`cmin` and/or `cmax` to be equidistant to this point.
Value should have the same units as `value`. Has no
effect when `cauto` is `false`.
cmin
Sets the lower bound of the color domain. Value should
have the same units as `value` and if set, `cmax` must
be set as well.
coloraxis
Sets a reference to a shared color axis. References to
these shared color axes are "coloraxis", "coloraxis2",
"coloraxis3", etc. Settings for these shared color axes
are set in the layout, under `layout.coloraxis`,
`layout.coloraxis2`, etc. Note that multiple color
scales can be linked to the same color axis.
colorbar
:class:`plotly.graph_objects.volume.ColorBar` instance
or dict with compatible properties
colorscale
Sets the colorscale. The colorscale must be an array
containing arrays mapping a normalized value to an rgb,
rgba, hex, hsl, hsv, or named color string. At minimum,
a mapping for the lowest (0) and highest (1) values are
required. For example, `[[0, 'rgb(0,0,255)'], [1,
'rgb(255,0,0)']]`. To control the bounds of the
colorscale in color space, use`cmin` and `cmax`.
Alternatively, `colorscale` may be a palette name
string of the following list: Greys,YlGnBu,Greens,YlOrR
d,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,H
ot,Blackbody,Earth,Electric,Viridis,Cividis.
contour
:class:`plotly.graph_objects.volume.Contour` instance
or dict with compatible properties
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
flatshading
Determines whether or not normal smoothing is applied
to the meshes, creating meshes with an angular, low-
poly look via flat reflections.
hoverinfo
Determines which trace information appear on hover. If
`none` or `skip` are set, no information is displayed
upon hovering. But, if `none` is set, click and hover
events are still fired.
hoverinfosrc
Sets the source reference on Chart Studio Cloud for
hoverinfo .
hoverlabel
:class:`plotly.graph_objects.volume.Hoverlabel`
instance or dict with compatible properties
hovertemplate
Template string used for rendering the information that
appear on hover box. Note that this will override
`hoverinfo`. Variables are inserted using %{variable},
for example "y: %{y}". Numbers are formatted using
d3-format's syntax %{variable:d3-format}, for example
"Price: %{y:$.2f}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for
details on the formatting syntax. Dates are formatted
using d3-time-format's syntax %{variable|d3-time-
format}, for example "Day: %{2019-01-01|%A}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for
details on the date formatting syntax. The variables
available in `hovertemplate` are the ones emitted as
event data described at this link
https://plotly.com/javascript/plotlyjs-events/#event-
data. Additionally, every attributes that can be
specified per-point (the ones that are `arrayOk: true`)
are available. Anything contained in tag `<extra>` is
displayed in the secondary box, for example
"<extra>{fullData.name}</extra>". To hide the secondary
box completely, use an empty tag `<extra></extra>`.
hovertemplatesrc
Sets the source reference on Chart Studio Cloud for
hovertemplate .
hovertext
Same as `text`.
hovertextsrc
Sets the source reference on Chart Studio Cloud for
hovertext .
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
isomax
Sets the maximum boundary for iso-surface plot.
isomin
Sets the minimum boundary for iso-surface plot.
legendgroup
Sets the legend group for this trace. Traces part of
the same legend group hide/show at the same time when
toggling legend items.
lighting
:class:`plotly.graph_objects.volume.Lighting` instance
or dict with compatible properties
lightposition
:class:`plotly.graph_objects.volume.Lightposition`
instance or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
opacity
Sets the opacity of the surface. Please note that in
the case of using high `opacity` values for example a
value greater than or equal to 0.5 on two surfaces (and
0.25 with four surfaces), an overlay of multiple
transparent surfaces may not perfectly be sorted in
depth by the webgl API. This behavior may be improved
in the near future and is subject to change.
opacityscale
Sets the opacityscale. The opacityscale must be an
array containing arrays mapping a normalized value to
an opacity value. At minimum, a mapping for the lowest
(0) and highest (1) values are required. For example,
`[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower
values would have higher opacity values and those in
the middle would be more transparent Alternatively,
`opacityscale` may be a palette name string of the
following list: 'min', 'max', 'extremes' and 'uniform'.
The default is 'uniform'.
reversescale
Reverses the color mapping if true. If true, `cmin`
will correspond to the last color in the array and
`cmax` will correspond to the first color.
scene
Sets a reference between this trace's 3D coordinate
system and a 3D scene. If "scene" (the default value),
the (x,y,z) coordinates refer to `layout.scene`. If
"scene2", the (x,y,z) coordinates refer to
`layout.scene2`, and so on.
showlegend
Determines whether or not an item corresponding to this
trace is shown in the legend.
showscale
Determines whether or not a colorbar is displayed for
this trace.
slices
:class:`plotly.graph_objects.volume.Slices` instance or
dict with compatible properties
spaceframe
:class:`plotly.graph_objects.volume.Spaceframe`
instance or dict with compatible properties
stream
:class:`plotly.graph_objects.volume.Stream` instance or
dict with compatible properties
surface
:class:`plotly.graph_objects.volume.Surface` instance
or dict with compatible properties
text
Sets the text elements associated with the vertices. If
trace `hoverinfo` contains a "text" flag and
"hovertext" is not set, these elements will be seen in
the hover labels.
textsrc
Sets the source reference on Chart Studio Cloud for
text .
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
value
Sets the 4th dimension (value) of the vertices.
valuesrc
Sets the source reference on Chart Studio Cloud for
value .
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
x
Sets the X coordinates of the vertices on X axis.
xsrc
Sets the source reference on Chart Studio Cloud for x
.
y
Sets the Y coordinates of the vertices on Y axis.
ysrc
Sets the source reference on Chart Studio Cloud for y
.
z
Sets the Z coordinates of the vertices on Z axis.
zsrc
Sets the source reference on Chart Studio Cloud for z
.
Returns
-------
Volume
"""
super(Volume, self).__init__("volume")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.Volume
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Volume`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("autocolorscale", None)
_v = autocolorscale if autocolorscale is not None else _v
if _v is not None:
self["autocolorscale"] = _v
_v = arg.pop("caps", None)
_v = caps if caps is not None else _v
if _v is not None:
self["caps"] = _v
_v = arg.pop("cauto", None)
_v = cauto if cauto is not None else _v
if _v is not None:
self["cauto"] = _v
_v = arg.pop("cmax", None)
_v = cmax if cmax is not None else _v
if _v is not None:
self["cmax"] = _v
_v = arg.pop("cmid", None)
_v = cmid if cmid is not None else _v
if _v is not None:
self["cmid"] = _v
_v = arg.pop("cmin", None)
_v = cmin if cmin is not None else _v
if _v is not None:
self["cmin"] = _v
_v = arg.pop("coloraxis", None)
_v = coloraxis if coloraxis is not None else _v
if _v is not None:
self["coloraxis"] = _v
_v = arg.pop("colorbar", None)
_v = colorbar if colorbar is not None else _v
if _v is not None:
self["colorbar"] = _v
_v = arg.pop("colorscale", None)
_v = colorscale if colorscale is not None else _v
if _v is not None:
self["colorscale"] = _v
_v = arg.pop("contour", None)
_v = contour if contour is not None else _v
if _v is not None:
self["contour"] = _v
_v = arg.pop("customdata", None)
_v = customdata if customdata is not None else _v
if _v is not None:
self["customdata"] = _v
_v = arg.pop("customdatasrc", None)
_v = customdatasrc if customdatasrc is not None else _v
if _v is not None:
self["customdatasrc"] = _v
_v = arg.pop("flatshading", None)
_v = flatshading if flatshading is not None else _v
if _v is not None:
self["flatshading"] = _v
_v = arg.pop("hoverinfo", None)
_v = hoverinfo if hoverinfo is not None else _v
if _v is not None:
self["hoverinfo"] = _v
_v = arg.pop("hoverinfosrc", None)
_v = hoverinfosrc if hoverinfosrc is not None else _v
if _v is not None:
self["hoverinfosrc"] = _v
_v = arg.pop("hoverlabel", None)
_v = hoverlabel if hoverlabel is not None else _v
if _v is not None:
self["hoverlabel"] = _v
_v = arg.pop("hovertemplate", None)
_v = hovertemplate if hovertemplate is not None else _v
if _v is not None:
self["hovertemplate"] = _v
_v = arg.pop("hovertemplatesrc", None)
_v = hovertemplatesrc if hovertemplatesrc is not None else _v
if _v is not None:
self["hovertemplatesrc"] = _v
_v = arg.pop("hovertext", None)
_v = hovertext if hovertext is not None else _v
if _v is not None:
self["hovertext"] = _v
_v = arg.pop("hovertextsrc", None)
_v = hovertextsrc if hovertextsrc is not None else _v
if _v is not None:
self["hovertextsrc"] = _v
_v = arg.pop("ids", None)
_v = ids if ids is not None else _v
if _v is not None:
self["ids"] = _v
_v = arg.pop("idssrc", None)
_v = idssrc if idssrc is not None else _v
if _v is not None:
self["idssrc"] = _v
_v = arg.pop("isomax", None)
_v = isomax if isomax is not None else _v
if _v is not None:
self["isomax"] = _v
_v = arg.pop("isomin", None)
_v = isomin if isomin is not None else _v
if _v is not None:
self["isomin"] = _v
_v = arg.pop("legendgroup", None)
_v = legendgroup if legendgroup is not None else _v
if _v is not None:
self["legendgroup"] = _v
_v = arg.pop("lighting", None)
_v = lighting if lighting is not None else _v
if _v is not None:
self["lighting"] = _v
_v = arg.pop("lightposition", None)
_v = lightposition if lightposition is not None else _v
if _v is not None:
self["lightposition"] = _v
_v = arg.pop("meta", None)
_v = meta if meta is not None else _v
if _v is not None:
self["meta"] = _v
_v = arg.pop("metasrc", None)
_v = metasrc if metasrc is not None else _v
if _v is not None:
self["metasrc"] = _v
_v = arg.pop("name", None)
_v = name if name is not None else _v
if _v is not None:
self["name"] = _v
_v = arg.pop("opacity", None)
_v = opacity if opacity is not None else _v
if _v is not None:
self["opacity"] = _v
_v = arg.pop("opacityscale", None)
_v = opacityscale if opacityscale is not None else _v
if _v is not None:
self["opacityscale"] = _v
_v = arg.pop("reversescale", None)
_v = reversescale if reversescale is not None else _v
if _v is not None:
self["reversescale"] = _v
_v = arg.pop("scene", None)
_v = scene if scene is not None else _v
if _v is not None:
self["scene"] = _v
_v = arg.pop("showlegend", None)
_v = showlegend if showlegend is not None else _v
if _v is not None:
self["showlegend"] = _v
_v = arg.pop("showscale", None)
_v = showscale if showscale is not None else _v
if _v is not None:
self["showscale"] = _v
_v = arg.pop("slices", None)
_v = slices if slices is not None else _v
if _v is not None:
self["slices"] = _v
_v = arg.pop("spaceframe", None)
_v = spaceframe if spaceframe is not None else _v
if _v is not None:
self["spaceframe"] = _v
_v = arg.pop("stream", None)
_v = stream if stream is not None else _v
if _v is not None:
self["stream"] = _v
_v = arg.pop("surface", None)
_v = surface if surface is not None else _v
if _v is not None:
self["surface"] = _v
_v = arg.pop("text", None)
_v = text if text is not None else _v
if _v is not None:
self["text"] = _v
_v = arg.pop("textsrc", None)
_v = textsrc if textsrc is not None else _v
if _v is not None:
self["textsrc"] = _v
_v = arg.pop("uid", None)
_v = uid if uid is not None else _v
if _v is not None:
self["uid"] = _v
_v = arg.pop("uirevision", None)
_v = uirevision if uirevision is not None else _v
if _v is not None:
self["uirevision"] = _v
_v = arg.pop("value", None)
_v = value if value is not None else _v
if _v is not None:
self["value"] = _v
_v = arg.pop("valuesrc", None)
_v = valuesrc if valuesrc is not None else _v
if _v is not None:
self["valuesrc"] = _v
_v = arg.pop("visible", None)
_v = visible if visible is not None else _v
if _v is not None:
self["visible"] = _v
_v = arg.pop("x", None)
_v = x if x is not None else _v
if _v is not None:
self["x"] = _v
_v = arg.pop("xsrc", None)
_v = xsrc if xsrc is not None else _v
if _v is not None:
self["xsrc"] = _v
_v = arg.pop("y", None)
_v = y if y is not None else _v
if _v is not None:
self["y"] = _v
_v = arg.pop("ysrc", None)
_v = ysrc if ysrc is not None else _v
if _v is not None:
self["ysrc"] = _v
_v = arg.pop("z", None)
_v = z if z is not None else _v
if _v is not None:
self["z"] = _v
_v = arg.pop("zsrc", None)
_v = zsrc if zsrc is not None else _v
if _v is not None:
self["zsrc"] = _v
# Read-only literals
# ------------------
self._props["type"] = "volume"
arg.pop("type", None)
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"autocolorscale",
"=",
"None",
",",
"caps",
"=",
"None",
",",
"cauto",
"=",
"None",
",",
"cmax",
"=",
"None",
",",
"cmid",
"=",
"None",
",",
"cmin",
"=",
"None",
",",
"coloraxis",
"=",
"None",
",",
"colorbar",
"=",
"None",
",",
"colorscale",
"=",
"None",
",",
"contour",
"=",
"None",
",",
"customdata",
"=",
"None",
",",
"customdatasrc",
"=",
"None",
",",
"flatshading",
"=",
"None",
",",
"hoverinfo",
"=",
"None",
",",
"hoverinfosrc",
"=",
"None",
",",
"hoverlabel",
"=",
"None",
",",
"hovertemplate",
"=",
"None",
",",
"hovertemplatesrc",
"=",
"None",
",",
"hovertext",
"=",
"None",
",",
"hovertextsrc",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"idssrc",
"=",
"None",
",",
"isomax",
"=",
"None",
",",
"isomin",
"=",
"None",
",",
"legendgroup",
"=",
"None",
",",
"lighting",
"=",
"None",
",",
"lightposition",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"metasrc",
"=",
"None",
",",
"name",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"opacityscale",
"=",
"None",
",",
"reversescale",
"=",
"None",
",",
"scene",
"=",
"None",
",",
"showlegend",
"=",
"None",
",",
"showscale",
"=",
"None",
",",
"slices",
"=",
"None",
",",
"spaceframe",
"=",
"None",
",",
"stream",
"=",
"None",
",",
"surface",
"=",
"None",
",",
"text",
"=",
"None",
",",
"textsrc",
"=",
"None",
",",
"uid",
"=",
"None",
",",
"uirevision",
"=",
"None",
",",
"value",
"=",
"None",
",",
"valuesrc",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"x",
"=",
"None",
",",
"xsrc",
"=",
"None",
",",
"y",
"=",
"None",
",",
"ysrc",
"=",
"None",
",",
"z",
"=",
"None",
",",
"zsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Volume",
",",
"self",
")",
".",
"__init__",
"(",
"\"volume\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.Volume \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.Volume`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"autocolorscale\"",
",",
"None",
")",
"_v",
"=",
"autocolorscale",
"if",
"autocolorscale",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"autocolorscale\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"caps\"",
",",
"None",
")",
"_v",
"=",
"caps",
"if",
"caps",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"caps\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"cauto\"",
",",
"None",
")",
"_v",
"=",
"cauto",
"if",
"cauto",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"cauto\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"cmax\"",
",",
"None",
")",
"_v",
"=",
"cmax",
"if",
"cmax",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"cmax\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"cmid\"",
",",
"None",
")",
"_v",
"=",
"cmid",
"if",
"cmid",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"cmid\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"cmin\"",
",",
"None",
")",
"_v",
"=",
"cmin",
"if",
"cmin",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"cmin\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"coloraxis\"",
",",
"None",
")",
"_v",
"=",
"coloraxis",
"if",
"coloraxis",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"coloraxis\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"colorbar\"",
",",
"None",
")",
"_v",
"=",
"colorbar",
"if",
"colorbar",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"colorbar\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"colorscale\"",
",",
"None",
")",
"_v",
"=",
"colorscale",
"if",
"colorscale",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"colorscale\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"contour\"",
",",
"None",
")",
"_v",
"=",
"contour",
"if",
"contour",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"contour\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdata\"",
",",
"None",
")",
"_v",
"=",
"customdata",
"if",
"customdata",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdata\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdatasrc\"",
",",
"None",
")",
"_v",
"=",
"customdatasrc",
"if",
"customdatasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdatasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"flatshading\"",
",",
"None",
")",
"_v",
"=",
"flatshading",
"if",
"flatshading",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"flatshading\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverinfo\"",
",",
"None",
")",
"_v",
"=",
"hoverinfo",
"if",
"hoverinfo",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverinfo\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverinfosrc\"",
",",
"None",
")",
"_v",
"=",
"hoverinfosrc",
"if",
"hoverinfosrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverinfosrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverlabel\"",
",",
"None",
")",
"_v",
"=",
"hoverlabel",
"if",
"hoverlabel",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverlabel\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hovertemplate\"",
",",
"None",
")",
"_v",
"=",
"hovertemplate",
"if",
"hovertemplate",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hovertemplate\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hovertemplatesrc\"",
",",
"None",
")",
"_v",
"=",
"hovertemplatesrc",
"if",
"hovertemplatesrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hovertemplatesrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hovertext\"",
",",
"None",
")",
"_v",
"=",
"hovertext",
"if",
"hovertext",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hovertext\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hovertextsrc\"",
",",
"None",
")",
"_v",
"=",
"hovertextsrc",
"if",
"hovertextsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hovertextsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ids\"",
",",
"None",
")",
"_v",
"=",
"ids",
"if",
"ids",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ids\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"idssrc\"",
",",
"None",
")",
"_v",
"=",
"idssrc",
"if",
"idssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"idssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"isomax\"",
",",
"None",
")",
"_v",
"=",
"isomax",
"if",
"isomax",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"isomax\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"isomin\"",
",",
"None",
")",
"_v",
"=",
"isomin",
"if",
"isomin",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"isomin\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"legendgroup\"",
",",
"None",
")",
"_v",
"=",
"legendgroup",
"if",
"legendgroup",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"legendgroup\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"lighting\"",
",",
"None",
")",
"_v",
"=",
"lighting",
"if",
"lighting",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"lighting\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"lightposition\"",
",",
"None",
")",
"_v",
"=",
"lightposition",
"if",
"lightposition",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"lightposition\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"meta\"",
",",
"None",
")",
"_v",
"=",
"meta",
"if",
"meta",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"meta\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"metasrc\"",
",",
"None",
")",
"_v",
"=",
"metasrc",
"if",
"metasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"metasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"name\"",
",",
"None",
")",
"_v",
"=",
"name",
"if",
"name",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"name\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"opacity\"",
",",
"None",
")",
"_v",
"=",
"opacity",
"if",
"opacity",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"opacity\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"opacityscale\"",
",",
"None",
")",
"_v",
"=",
"opacityscale",
"if",
"opacityscale",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"opacityscale\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"reversescale\"",
",",
"None",
")",
"_v",
"=",
"reversescale",
"if",
"reversescale",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"reversescale\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"scene\"",
",",
"None",
")",
"_v",
"=",
"scene",
"if",
"scene",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"scene\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showlegend\"",
",",
"None",
")",
"_v",
"=",
"showlegend",
"if",
"showlegend",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showlegend\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showscale\"",
",",
"None",
")",
"_v",
"=",
"showscale",
"if",
"showscale",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showscale\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"slices\"",
",",
"None",
")",
"_v",
"=",
"slices",
"if",
"slices",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"slices\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"spaceframe\"",
",",
"None",
")",
"_v",
"=",
"spaceframe",
"if",
"spaceframe",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"spaceframe\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"stream\"",
",",
"None",
")",
"_v",
"=",
"stream",
"if",
"stream",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"stream\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"surface\"",
",",
"None",
")",
"_v",
"=",
"surface",
"if",
"surface",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"surface\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"text\"",
",",
"None",
")",
"_v",
"=",
"text",
"if",
"text",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"text\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"textsrc\"",
",",
"None",
")",
"_v",
"=",
"textsrc",
"if",
"textsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"textsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uid\"",
",",
"None",
")",
"_v",
"=",
"uid",
"if",
"uid",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uid\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uirevision\"",
",",
"None",
")",
"_v",
"=",
"uirevision",
"if",
"uirevision",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uirevision\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"value\"",
",",
"None",
")",
"_v",
"=",
"value",
"if",
"value",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"value\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"valuesrc\"",
",",
"None",
")",
"_v",
"=",
"valuesrc",
"if",
"valuesrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"valuesrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"visible\"",
",",
"None",
")",
"_v",
"=",
"visible",
"if",
"visible",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"visible\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"x\"",
",",
"None",
")",
"_v",
"=",
"x",
"if",
"x",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"x\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xsrc\"",
",",
"None",
")",
"_v",
"=",
"xsrc",
"if",
"xsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"y\"",
",",
"None",
")",
"_v",
"=",
"y",
"if",
"y",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"y\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ysrc\"",
",",
"None",
")",
"_v",
"=",
"ysrc",
"if",
"ysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ysrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"z\"",
",",
"None",
")",
"_v",
"=",
"z",
"if",
"z",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"z\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"zsrc\"",
",",
"None",
")",
"_v",
"=",
"zsrc",
"if",
"zsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"zsrc\"",
"]",
"=",
"_v",
"# Read-only literals",
"# ------------------",
"self",
".",
"_props",
"[",
"\"type\"",
"]",
"=",
"\"volume\"",
"arg",
".",
"pop",
"(",
"\"type\"",
",",
"None",
")",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
1926,
4
] | [
2507,
34
] | python | en | ['en', 'error', 'th'] | False |
RnnDocReader.forward | (self, x1, x1_f, x1_mask, x2, x2_mask) | Inputs:
x1 = document word indices [batch * len_d]
x1_f = document word features indices [batch * len_d * nfeat]
x1_mask = document padding mask [batch * len_d]
x2 = question word indices [batch * len_q]
x2_mask = question padding mask [batch * len_q]
| Inputs:
x1 = document word indices [batch * len_d]
x1_f = document word features indices [batch * len_d * nfeat]
x1_mask = document padding mask [batch * len_d]
x2 = question word indices [batch * len_q]
x2_mask = question padding mask [batch * len_q]
| def forward(self, x1, x1_f, x1_mask, x2, x2_mask):
"""Inputs:
x1 = document word indices [batch * len_d]
x1_f = document word features indices [batch * len_d * nfeat]
x1_mask = document padding mask [batch * len_d]
x2 = question word indices [batch * len_q]
x2_mask = question padding mask [batch * len_q]
"""
# Embed both document and question
x1_emb = self.embedding(x1)
x2_emb = self.embedding(x2)
# Dropout on embeddings
if self.opt['dropout_emb'] > 0:
x1_emb = nn.functional.dropout(
x1_emb, p=self.opt['dropout_emb'], training=self.training
)
x2_emb = nn.functional.dropout(
x2_emb, p=self.opt['dropout_emb'], training=self.training
)
# Add attention-weighted question representation
if self.opt['use_qemb']:
x2_weighted_emb = self.qemb_match(x1_emb, x2_emb, x2_mask)
drnn_input = torch.cat([x1_emb, x2_weighted_emb, x1_f], 2)
else:
drnn_input = torch.cat([x1_emb, x1_f], 2)
# Encode document with RNN
doc_hiddens = self.doc_rnn(drnn_input, x1_mask)
# Encode question with RNN + merge hiddens
question_hiddens = self.question_rnn(x2_emb, x2_mask)
if self.opt['question_merge'] == 'avg':
q_merge_weights = layers.uniform_weights(question_hiddens, x2_mask)
elif self.opt['question_merge'] == 'self_attn':
q_merge_weights = self.self_attn(question_hiddens, x2_mask)
question_hidden = layers.weighted_avg(question_hiddens, q_merge_weights)
# Predict start and end positions
start_scores = self.start_attn(doc_hiddens, question_hidden, x1_mask)
end_scores = self.end_attn(doc_hiddens, question_hidden, x1_mask)
return start_scores, end_scores | [
"def",
"forward",
"(",
"self",
",",
"x1",
",",
"x1_f",
",",
"x1_mask",
",",
"x2",
",",
"x2_mask",
")",
":",
"# Embed both document and question",
"x1_emb",
"=",
"self",
".",
"embedding",
"(",
"x1",
")",
"x2_emb",
"=",
"self",
".",
"embedding",
"(",
"x2",
")",
"# Dropout on embeddings",
"if",
"self",
".",
"opt",
"[",
"'dropout_emb'",
"]",
">",
"0",
":",
"x1_emb",
"=",
"nn",
".",
"functional",
".",
"dropout",
"(",
"x1_emb",
",",
"p",
"=",
"self",
".",
"opt",
"[",
"'dropout_emb'",
"]",
",",
"training",
"=",
"self",
".",
"training",
")",
"x2_emb",
"=",
"nn",
".",
"functional",
".",
"dropout",
"(",
"x2_emb",
",",
"p",
"=",
"self",
".",
"opt",
"[",
"'dropout_emb'",
"]",
",",
"training",
"=",
"self",
".",
"training",
")",
"# Add attention-weighted question representation",
"if",
"self",
".",
"opt",
"[",
"'use_qemb'",
"]",
":",
"x2_weighted_emb",
"=",
"self",
".",
"qemb_match",
"(",
"x1_emb",
",",
"x2_emb",
",",
"x2_mask",
")",
"drnn_input",
"=",
"torch",
".",
"cat",
"(",
"[",
"x1_emb",
",",
"x2_weighted_emb",
",",
"x1_f",
"]",
",",
"2",
")",
"else",
":",
"drnn_input",
"=",
"torch",
".",
"cat",
"(",
"[",
"x1_emb",
",",
"x1_f",
"]",
",",
"2",
")",
"# Encode document with RNN",
"doc_hiddens",
"=",
"self",
".",
"doc_rnn",
"(",
"drnn_input",
",",
"x1_mask",
")",
"# Encode question with RNN + merge hiddens",
"question_hiddens",
"=",
"self",
".",
"question_rnn",
"(",
"x2_emb",
",",
"x2_mask",
")",
"if",
"self",
".",
"opt",
"[",
"'question_merge'",
"]",
"==",
"'avg'",
":",
"q_merge_weights",
"=",
"layers",
".",
"uniform_weights",
"(",
"question_hiddens",
",",
"x2_mask",
")",
"elif",
"self",
".",
"opt",
"[",
"'question_merge'",
"]",
"==",
"'self_attn'",
":",
"q_merge_weights",
"=",
"self",
".",
"self_attn",
"(",
"question_hiddens",
",",
"x2_mask",
")",
"question_hidden",
"=",
"layers",
".",
"weighted_avg",
"(",
"question_hiddens",
",",
"q_merge_weights",
")",
"# Predict start and end positions",
"start_scores",
"=",
"self",
".",
"start_attn",
"(",
"doc_hiddens",
",",
"question_hidden",
",",
"x1_mask",
")",
"end_scores",
"=",
"self",
".",
"end_attn",
"(",
"doc_hiddens",
",",
"question_hidden",
",",
"x1_mask",
")",
"return",
"start_scores",
",",
"end_scores"
] | [
89,
4
] | [
131,
39
] | python | de | ['de', 'zh', 'en'] | False |
ConnectionInvitation.__init__ | (
self,
*,
label: str = None,
did: str = None,
recipient_keys: Sequence[str] = None,
endpoint: str = None,
routing_keys: Sequence[str] = None,
image_url: str = None,
**kwargs,
) |
Initialize connection invitation object.
Args:
label: Optional label for connection
did: DID for this connection invitation
recipient_keys: List of recipient keys
endpoint: Endpoint which this agent can be reached at
routing_keys: List of routing keys
image_url: Optional image URL for connection invitation
|
Initialize connection invitation object. | def __init__(
self,
*,
label: str = None,
did: str = None,
recipient_keys: Sequence[str] = None,
endpoint: str = None,
routing_keys: Sequence[str] = None,
image_url: str = None,
**kwargs,
):
"""
Initialize connection invitation object.
Args:
label: Optional label for connection
did: DID for this connection invitation
recipient_keys: List of recipient keys
endpoint: Endpoint which this agent can be reached at
routing_keys: List of routing keys
image_url: Optional image URL for connection invitation
"""
super(ConnectionInvitation, self).__init__(**kwargs)
self.label = label
self.did = did
self.recipient_keys = list(recipient_keys) if recipient_keys else None
self.endpoint = endpoint
self.routing_keys = list(routing_keys) if routing_keys else None | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"label",
":",
"str",
"=",
"None",
",",
"did",
":",
"str",
"=",
"None",
",",
"recipient_keys",
":",
"Sequence",
"[",
"str",
"]",
"=",
"None",
",",
"endpoint",
":",
"str",
"=",
"None",
",",
"routing_keys",
":",
"Sequence",
"[",
"str",
"]",
"=",
"None",
",",
"image_url",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
",",
")",
":",
"super",
"(",
"ConnectionInvitation",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"label",
"=",
"label",
"self",
".",
"did",
"=",
"did",
"self",
".",
"recipient_keys",
"=",
"list",
"(",
"recipient_keys",
")",
"if",
"recipient_keys",
"else",
"None",
"self",
".",
"endpoint",
"=",
"endpoint",
"self",
".",
"routing_keys",
"=",
"list",
"(",
"routing_keys",
")",
"if",
"routing_keys",
"else",
"None"
] | [
29,
4
] | [
56,
72
] | python | en | ['en', 'error', 'th'] | False |
ConnectionInvitation.to_url | (self, base_url: str = None) |
Convert an invitation to URL format for sharing.
Returns:
An invite url
|
Convert an invitation to URL format for sharing. | def to_url(self, base_url: str = None) -> str:
"""
Convert an invitation to URL format for sharing.
Returns:
An invite url
"""
c_json = self.to_json()
c_i = bytes_to_b64(c_json.encode("ascii"), urlsafe=True)
result = urljoin(base_url or self.endpoint or "", "?c_i={}".format(c_i))
return result | [
"def",
"to_url",
"(",
"self",
",",
"base_url",
":",
"str",
"=",
"None",
")",
"->",
"str",
":",
"c_json",
"=",
"self",
".",
"to_json",
"(",
")",
"c_i",
"=",
"bytes_to_b64",
"(",
"c_json",
".",
"encode",
"(",
"\"ascii\"",
")",
",",
"urlsafe",
"=",
"True",
")",
"result",
"=",
"urljoin",
"(",
"base_url",
"or",
"self",
".",
"endpoint",
"or",
"\"\"",
",",
"\"?c_i={}\"",
".",
"format",
"(",
"c_i",
")",
")",
"return",
"result"
] | [
58,
4
] | [
69,
21
] | python | en | ['en', 'error', 'th'] | False |
ConnectionInvitation.from_url | (cls, url: str) |
Parse a URL-encoded invitation into a `ConnectionInvitation` message.
Args:
url: Url to decode
Returns:
A `ConnectionInvitation` object.
|
Parse a URL-encoded invitation into a `ConnectionInvitation` message. | def from_url(cls, url: str) -> "ConnectionInvitation":
"""
Parse a URL-encoded invitation into a `ConnectionInvitation` message.
Args:
url: Url to decode
Returns:
A `ConnectionInvitation` object.
"""
parts = urlparse(url)
query = parse_qs(parts.query)
if "c_i" in query:
c_i = b64_to_bytes(query["c_i"][0], urlsafe=True)
return cls.from_json(c_i)
return None | [
"def",
"from_url",
"(",
"cls",
",",
"url",
":",
"str",
")",
"->",
"\"ConnectionInvitation\"",
":",
"parts",
"=",
"urlparse",
"(",
"url",
")",
"query",
"=",
"parse_qs",
"(",
"parts",
".",
"query",
")",
"if",
"\"c_i\"",
"in",
"query",
":",
"c_i",
"=",
"b64_to_bytes",
"(",
"query",
"[",
"\"c_i\"",
"]",
"[",
"0",
"]",
",",
"urlsafe",
"=",
"True",
")",
"return",
"cls",
".",
"from_json",
"(",
"c_i",
")",
"return",
"None"
] | [
72,
4
] | [
88,
19
] | python | en | ['en', 'error', 'th'] | False |
ConnectionInvitationSchema.validate_fields | (self, data, **kwargs) |
Validate schema fields.
Args:
data: The data to validate
Raises:
ValidationError: If any of the fields do not validate
|
Validate schema fields. | def validate_fields(self, data, **kwargs):
"""
Validate schema fields.
Args:
data: The data to validate
Raises:
ValidationError: If any of the fields do not validate
"""
if data.get("did"):
if data.get("recipient_keys"):
raise ValidationError(
"Fields are incompatible", ("did", "recipientKeys")
)
if data.get("endpoint"):
raise ValidationError(
"Fields are incompatible", ("did", "serviceEndpoint")
)
elif not data.get("recipient_keys") or not data.get("endpoint"):
raise ValidationError(
"Missing required field(s)", ("did", "recipientKeys", "serviceEndpoint")
) | [
"def",
"validate_fields",
"(",
"self",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"data",
".",
"get",
"(",
"\"did\"",
")",
":",
"if",
"data",
".",
"get",
"(",
"\"recipient_keys\"",
")",
":",
"raise",
"ValidationError",
"(",
"\"Fields are incompatible\"",
",",
"(",
"\"did\"",
",",
"\"recipientKeys\"",
")",
")",
"if",
"data",
".",
"get",
"(",
"\"endpoint\"",
")",
":",
"raise",
"ValidationError",
"(",
"\"Fields are incompatible\"",
",",
"(",
"\"did\"",
",",
"\"serviceEndpoint\"",
")",
")",
"elif",
"not",
"data",
".",
"get",
"(",
"\"recipient_keys\"",
")",
"or",
"not",
"data",
".",
"get",
"(",
"\"endpoint\"",
")",
":",
"raise",
"ValidationError",
"(",
"\"Missing required field(s)\"",
",",
"(",
"\"did\"",
",",
"\"recipientKeys\"",
",",
"\"serviceEndpoint\"",
")",
")"
] | [
132,
4
] | [
155,
13
] | python | en | ['en', 'error', 'th'] | False |
PerformanceCog.report_latency | (self, ctx, with_graph: bool = True) |
Reports the latency in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_latency yes
|
Reports the latency in the last 24h | async def report_latency(self, ctx, with_graph: bool = True):
"""
Reports the latency in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_latency yes
"""
report_data = await self.general_db.get_latency_data_last_24_hours()
stat_data = [item.latency for item in report_data]
embed_data = {'Mean': round(mean(stat_data), 2), 'Median': round(median(stat_data), 2), "Std-dev": round(stdev(stat_data))}
_file = None
if len(report_data) < 11:
embed_data = embed_data | {item.date_time.strftime(self.bot.std_date_time_format): item.pretty_latency for item in report_data}
embed = await make_basic_embed_inline(title='Latency Data', text="Data of the last 24 hours", symbol='graph', amount_datapoints=str(len(report_data)), ** embed_data)
if with_graph is True:
_file, _url = await self.make_graph(report_data, 'latency')
embed.set_image(url=_url)
await ctx.send(embed=embed, file=_file) | [
"async",
"def",
"report_latency",
"(",
"self",
",",
"ctx",
",",
"with_graph",
":",
"bool",
"=",
"True",
")",
":",
"report_data",
"=",
"await",
"self",
".",
"general_db",
".",
"get_latency_data_last_24_hours",
"(",
")",
"stat_data",
"=",
"[",
"item",
".",
"latency",
"for",
"item",
"in",
"report_data",
"]",
"embed_data",
"=",
"{",
"'Mean'",
":",
"round",
"(",
"mean",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"'Median'",
":",
"round",
"(",
"median",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"\"Std-dev\"",
":",
"round",
"(",
"stdev",
"(",
"stat_data",
")",
")",
"}",
"_file",
"=",
"None",
"if",
"len",
"(",
"report_data",
")",
"<",
"11",
":",
"embed_data",
"=",
"embed_data",
"|",
"{",
"item",
".",
"date_time",
".",
"strftime",
"(",
"self",
".",
"bot",
".",
"std_date_time_format",
")",
":",
"item",
".",
"pretty_latency",
"for",
"item",
"in",
"report_data",
"}",
"embed",
"=",
"await",
"make_basic_embed_inline",
"(",
"title",
"=",
"'Latency Data'",
",",
"text",
"=",
"\"Data of the last 24 hours\"",
",",
"symbol",
"=",
"'graph'",
",",
"amount_datapoints",
"=",
"str",
"(",
"len",
"(",
"report_data",
")",
")",
",",
"*",
"*",
"embed_data",
")",
"if",
"with_graph",
"is",
"True",
":",
"_file",
",",
"_url",
"=",
"await",
"self",
".",
"make_graph",
"(",
"report_data",
",",
"'latency'",
")",
"embed",
".",
"set_image",
"(",
"url",
"=",
"_url",
")",
"await",
"ctx",
".",
"send",
"(",
"embed",
"=",
"embed",
",",
"file",
"=",
"_file",
")"
] | [
194,
4
] | [
216,
47
] | python | en | ['en', 'error', 'th'] | False |
PerformanceCog.report_memory | (self, ctx, with_graph: bool = True, since_last_hours: int = 24) |
Reports the memory use in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_memory yes
|
Reports the memory use in the last 24h | async def report_memory(self, ctx, with_graph: bool = True, since_last_hours: int = 24):
"""
Reports the memory use in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_memory yes
"""
initial_memory = os.getenv('INITIAL_MEMORY_USAGE')
initial_memory_annotated = bytes2human(int(initial_memory), annotate=True)
report_data = await self.general_db.get_memory_data_last_24_hours()
stat_data = [item.memory_in_use for item in report_data]
embed_data = {'Initial': initial_memory_annotated, 'Mean': bytes2human(round(mean(stat_data), 2), True), 'Median': bytes2human(round(median(stat_data), 2), True), "Std-dev": bytes2human(round(stdev(stat_data)), True)}
_file = None
if len(report_data) < 11:
embed_data = embed_data | {item.date_time.strftime(self.bot.std_date_time_format): '\n\n'.join([f'in use absolute: \n{item.pretty_memory_in_use}',
f'percentage used: \n{round(item.as_percent, 1)}%']) for item in report_data}
embed = await make_basic_embed_inline(title='Memory Data',
text=f"Data of the last {str(since_last_hours)} hours",
symbol='graph', amount_datapoints=str(len(report_data)),
**embed_data)
if with_graph is True:
log.debug('calling make_graph')
_file, _url = await self.make_graph(report_data, 'memory')
embed.set_image(url=_url)
await ctx.send(embed=embed, file=_file) | [
"async",
"def",
"report_memory",
"(",
"self",
",",
"ctx",
",",
"with_graph",
":",
"bool",
"=",
"True",
",",
"since_last_hours",
":",
"int",
"=",
"24",
")",
":",
"initial_memory",
"=",
"os",
".",
"getenv",
"(",
"'INITIAL_MEMORY_USAGE'",
")",
"initial_memory_annotated",
"=",
"bytes2human",
"(",
"int",
"(",
"initial_memory",
")",
",",
"annotate",
"=",
"True",
")",
"report_data",
"=",
"await",
"self",
".",
"general_db",
".",
"get_memory_data_last_24_hours",
"(",
")",
"stat_data",
"=",
"[",
"item",
".",
"memory_in_use",
"for",
"item",
"in",
"report_data",
"]",
"embed_data",
"=",
"{",
"'Initial'",
":",
"initial_memory_annotated",
",",
"'Mean'",
":",
"bytes2human",
"(",
"round",
"(",
"mean",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"True",
")",
",",
"'Median'",
":",
"bytes2human",
"(",
"round",
"(",
"median",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"True",
")",
",",
"\"Std-dev\"",
":",
"bytes2human",
"(",
"round",
"(",
"stdev",
"(",
"stat_data",
")",
")",
",",
"True",
")",
"}",
"_file",
"=",
"None",
"if",
"len",
"(",
"report_data",
")",
"<",
"11",
":",
"embed_data",
"=",
"embed_data",
"|",
"{",
"item",
".",
"date_time",
".",
"strftime",
"(",
"self",
".",
"bot",
".",
"std_date_time_format",
")",
":",
"'\\n\\n'",
".",
"join",
"(",
"[",
"f'in use absolute: \\n{item.pretty_memory_in_use}'",
",",
"f'percentage used: \\n{round(item.as_percent, 1)}%'",
"]",
")",
"for",
"item",
"in",
"report_data",
"}",
"embed",
"=",
"await",
"make_basic_embed_inline",
"(",
"title",
"=",
"'Memory Data'",
",",
"text",
"=",
"f\"Data of the last {str(since_last_hours)} hours\"",
",",
"symbol",
"=",
"'graph'",
",",
"amount_datapoints",
"=",
"str",
"(",
"len",
"(",
"report_data",
")",
")",
",",
"*",
"*",
"embed_data",
")",
"if",
"with_graph",
"is",
"True",
":",
"log",
".",
"debug",
"(",
"'calling make_graph'",
")",
"_file",
",",
"_url",
"=",
"await",
"self",
".",
"make_graph",
"(",
"report_data",
",",
"'memory'",
")",
"embed",
".",
"set_image",
"(",
"url",
"=",
"_url",
")",
"await",
"ctx",
".",
"send",
"(",
"embed",
"=",
"embed",
",",
"file",
"=",
"_file",
")"
] | [
220,
4
] | [
250,
47
] | python | en | ['en', 'error', 'th'] | False |
PerformanceCog.report_cpu | (self, ctx, with_graph: bool = True) |
Reports the cpu use in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_cpu yes
|
Reports the cpu use in the last 24h | async def report_cpu(self, ctx, with_graph: bool = True):
"""
Reports the cpu use in the last 24h
Args:
with_graph (bool, optional): if it should be presented in graph form. Defaults to True.
Example:
@AntiPetros report_cpu yes
"""
report_data = await self.general_db.get_cpu_data_last_24_hours()
stat_data = [item.usage_percent for item in report_data]
embed_data = {'Mean': round(mean(stat_data), 2), 'Median': round(median(stat_data), 2), "Std-dev": round(stdev(stat_data))}
_file = None
if len(report_data) < 11:
embed_data = embed_data | {item.date_time.strftime(self.bot.std_date_time_format): item.pretty_usage_percent for item in report_data}
embed = await make_basic_embed_inline(title='CPU Data', text="Data of the last 24 hours", symbol='graph', amount_datapoints=str(len(report_data)), ** embed_data)
if with_graph is True:
_file, _url = await self.make_graph(report_data, 'cpu')
embed.set_image(url=_url)
await ctx.send(embed=embed, file=_file) | [
"async",
"def",
"report_cpu",
"(",
"self",
",",
"ctx",
",",
"with_graph",
":",
"bool",
"=",
"True",
")",
":",
"report_data",
"=",
"await",
"self",
".",
"general_db",
".",
"get_cpu_data_last_24_hours",
"(",
")",
"stat_data",
"=",
"[",
"item",
".",
"usage_percent",
"for",
"item",
"in",
"report_data",
"]",
"embed_data",
"=",
"{",
"'Mean'",
":",
"round",
"(",
"mean",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"'Median'",
":",
"round",
"(",
"median",
"(",
"stat_data",
")",
",",
"2",
")",
",",
"\"Std-dev\"",
":",
"round",
"(",
"stdev",
"(",
"stat_data",
")",
")",
"}",
"_file",
"=",
"None",
"if",
"len",
"(",
"report_data",
")",
"<",
"11",
":",
"embed_data",
"=",
"embed_data",
"|",
"{",
"item",
".",
"date_time",
".",
"strftime",
"(",
"self",
".",
"bot",
".",
"std_date_time_format",
")",
":",
"item",
".",
"pretty_usage_percent",
"for",
"item",
"in",
"report_data",
"}",
"embed",
"=",
"await",
"make_basic_embed_inline",
"(",
"title",
"=",
"'CPU Data'",
",",
"text",
"=",
"\"Data of the last 24 hours\"",
",",
"symbol",
"=",
"'graph'",
",",
"amount_datapoints",
"=",
"str",
"(",
"len",
"(",
"report_data",
")",
")",
",",
"*",
"*",
"embed_data",
")",
"if",
"with_graph",
"is",
"True",
":",
"_file",
",",
"_url",
"=",
"await",
"self",
".",
"make_graph",
"(",
"report_data",
",",
"'cpu'",
")",
"embed",
".",
"set_image",
"(",
"url",
"=",
"_url",
")",
"await",
"ctx",
".",
"send",
"(",
"embed",
"=",
"embed",
",",
"file",
"=",
"_file",
")"
] | [
254,
4
] | [
276,
47
] | python | en | ['en', 'error', 'th'] | False |
PerformanceCog.performance_statistic | (self, ctx) |
Reports all collected metrics as Graph.
Example:
@AntiPetros report
|
Reports all collected metrics as Graph. | async def performance_statistic(self, ctx):
"""
Reports all collected metrics as Graph.
Example:
@AntiPetros report
"""
try:
await ctx.invoke(self.bot.get_command('report_memory'))
await ctx.invoke(self.bot.get_command('report_latency'))
await ctx.invoke(self.bot.get_command('report_cpu'))
except StatisticsError as error:
# TODO: make as error embed
await ctx.send('not enough data points collected to report!', delete_after=120) | [
"async",
"def",
"performance_statistic",
"(",
"self",
",",
"ctx",
")",
":",
"try",
":",
"await",
"ctx",
".",
"invoke",
"(",
"self",
".",
"bot",
".",
"get_command",
"(",
"'report_memory'",
")",
")",
"await",
"ctx",
".",
"invoke",
"(",
"self",
".",
"bot",
".",
"get_command",
"(",
"'report_latency'",
")",
")",
"await",
"ctx",
".",
"invoke",
"(",
"self",
".",
"bot",
".",
"get_command",
"(",
"'report_cpu'",
")",
")",
"except",
"StatisticsError",
"as",
"error",
":",
"# TODO: make as error embed",
"await",
"ctx",
".",
"send",
"(",
"'not enough data points collected to report!'",
",",
"delete_after",
"=",
"120",
")"
] | [
280,
4
] | [
293,
91
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.align | (self) |
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
|
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above | def align(self):
"""
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["align"] | [
"def",
"align",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"align\"",
"]"
] | [
25,
4
] | [
40,
28
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.alignsrc | (self) |
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"] | [
"def",
"alignsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"alignsrc\"",
"]"
] | [
49,
4
] | [
60,
31
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bgcolor"] | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
69,
4
] | [
120,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"] | [
"def",
"bgcolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolorsrc\"",
"]"
] | [
129,
4
] | [
140,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bordercolor"] | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
149,
4
] | [
200,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bordercolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bordercolorsrc"] | [
"def",
"bordercolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolorsrc\"",
"]"
] | [
209,
4
] | [
221,
37
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.font | (self) |
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
Returns
-------
plotly.graph_objs.scattergeo.hoverlabel.Font
|
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size . | def font(self):
"""
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
Returns
-------
plotly.graph_objs.scattergeo.hoverlabel.Font
"""
return self["font"] | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
230,
4
] | [
277,
27
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelength | (self) |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|numpy.ndarray
|
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above | def namelength(self):
"""
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|numpy.ndarray
"""
return self["namelength"] | [
"def",
"namelength",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelength\"",
"]"
] | [
286,
4
] | [
304,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelengthsrc | (self) |
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def namelengthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["namelengthsrc"] | [
"def",
"namelengthsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelengthsrc\"",
"]"
] | [
313,
4
] | [
325,
36
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.__init__ | (
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
) |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattergeo.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
Returns
-------
Hoverlabel
|
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattergeo.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength . | def __init__(
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
):
"""
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattergeo.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
Returns
-------
Hoverlabel
"""
super(Hoverlabel, self).__init__("hoverlabel")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.scattergeo.Hoverlabel
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scattergeo.Hoverlabel`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("align", None)
_v = align if align is not None else _v
if _v is not None:
self["align"] = _v
_v = arg.pop("alignsrc", None)
_v = alignsrc if alignsrc is not None else _v
if _v is not None:
self["alignsrc"] = _v
_v = arg.pop("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _v
_v = arg.pop("bgcolorsrc", None)
_v = bgcolorsrc if bgcolorsrc is not None else _v
if _v is not None:
self["bgcolorsrc"] = _v
_v = arg.pop("bordercolor", None)
_v = bordercolor if bordercolor is not None else _v
if _v is not None:
self["bordercolor"] = _v
_v = arg.pop("bordercolorsrc", None)
_v = bordercolorsrc if bordercolorsrc is not None else _v
if _v is not None:
self["bordercolorsrc"] = _v
_v = arg.pop("font", None)
_v = font if font is not None else _v
if _v is not None:
self["font"] = _v
_v = arg.pop("namelength", None)
_v = namelength if namelength is not None else _v
if _v is not None:
self["namelength"] = _v
_v = arg.pop("namelengthsrc", None)
_v = namelengthsrc if namelengthsrc is not None else _v
if _v is not None:
self["namelengthsrc"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"align",
"=",
"None",
",",
"alignsrc",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bgcolorsrc",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"bordercolorsrc",
"=",
"None",
",",
"font",
"=",
"None",
",",
"namelength",
"=",
"None",
",",
"namelengthsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Hoverlabel",
",",
"self",
")",
".",
"__init__",
"(",
"\"hoverlabel\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.scattergeo.Hoverlabel \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.scattergeo.Hoverlabel`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"align\"",
",",
"None",
")",
"_v",
"=",
"align",
"if",
"align",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"align\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"alignsrc\"",
",",
"None",
")",
"_v",
"=",
"alignsrc",
"if",
"alignsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"alignsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bgcolor\"",
",",
"None",
")",
"_v",
"=",
"bgcolor",
"if",
"bgcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bgcolorsrc\"",
",",
"None",
")",
"_v",
"=",
"bgcolorsrc",
"if",
"bgcolorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bordercolor\"",
",",
"None",
")",
"_v",
"=",
"bordercolor",
"if",
"bordercolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bordercolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bordercolorsrc\"",
",",
"None",
")",
"_v",
"=",
"bordercolorsrc",
"if",
"bordercolorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bordercolorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"font\"",
",",
"None",
")",
"_v",
"=",
"font",
"if",
"font",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"font\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"namelength\"",
",",
"None",
")",
"_v",
"=",
"namelength",
"if",
"namelength",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"namelength\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"namelengthsrc\"",
",",
"None",
")",
"_v",
"=",
"namelengthsrc",
"if",
"namelengthsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"namelengthsrc\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
370,
4
] | [
502,
34
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.customdata | (self) |
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def customdata(self):
"""
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["customdata"] | [
"def",
"customdata",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdata\"",
"]"
] | [
51,
4
] | [
65,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.customdatasrc | (self) |
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def customdatasrc(self):
"""
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["customdatasrc"] | [
"def",
"customdatasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdatasrc\"",
"]"
] | [
74,
4
] | [
86,
36
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.hoverinfo | (self) |
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['x', 'y', 'z', 'text', 'name'] joined with '+' characters
(e.g. 'x+y')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above
Returns
-------
Any|numpy.ndarray
|
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['x', 'y', 'z', 'text', 'name'] joined with '+' characters
(e.g. 'x+y')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above | def hoverinfo(self):
"""
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['x', 'y', 'z', 'text', 'name'] joined with '+' characters
(e.g. 'x+y')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["hoverinfo"] | [
"def",
"hoverinfo",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverinfo\"",
"]"
] | [
95,
4
] | [
112,
32
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.hoverinfosrc | (self) |
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def hoverinfosrc(self):
"""
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["hoverinfosrc"] | [
"def",
"hoverinfosrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverinfosrc\"",
"]"
] | [
121,
4
] | [
133,
35
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.hoverlabel | (self) |
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength .
Returns
-------
plotly.graph_objs.pointcloud.Hoverlabel
|
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength . | def hoverlabel(self):
"""
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength .
Returns
-------
plotly.graph_objs.pointcloud.Hoverlabel
"""
return self["hoverlabel"] | [
"def",
"hoverlabel",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverlabel\"",
"]"
] | [
142,
4
] | [
192,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.ids | (self) |
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def ids(self):
"""
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["ids"] | [
"def",
"ids",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ids\"",
"]"
] | [
201,
4
] | [
214,
26
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.idssrc | (self) |
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def idssrc(self):
"""
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["idssrc"] | [
"def",
"idssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"idssrc\"",
"]"
] | [
223,
4
] | [
234,
29
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.indices | (self) |
A sequential value, 0..n, supply it to avoid creating this
array inside plotting. If specified, it must be a typed
`Int32Array` array. Its length must be equal to or greater than
the number of points. For the best performance and memory use,
create one large `indices` typed array that is guaranteed to be
at least as long as the largest number of points during use,
and reuse it on each `Plotly.restyle()` call.
The 'indices' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
A sequential value, 0..n, supply it to avoid creating this
array inside plotting. If specified, it must be a typed
`Int32Array` array. Its length must be equal to or greater than
the number of points. For the best performance and memory use,
create one large `indices` typed array that is guaranteed to be
at least as long as the largest number of points during use,
and reuse it on each `Plotly.restyle()` call.
The 'indices' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def indices(self):
"""
A sequential value, 0..n, supply it to avoid creating this
array inside plotting. If specified, it must be a typed
`Int32Array` array. Its length must be equal to or greater than
the number of points. For the best performance and memory use,
create one large `indices` typed array that is guaranteed to be
at least as long as the largest number of points during use,
and reuse it on each `Plotly.restyle()` call.
The 'indices' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["indices"] | [
"def",
"indices",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"indices\"",
"]"
] | [
243,
4
] | [
260,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.indicessrc | (self) |
Sets the source reference on Chart Studio Cloud for indices .
The 'indicessrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for indices .
The 'indicessrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def indicessrc(self):
"""
Sets the source reference on Chart Studio Cloud for indices .
The 'indicessrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["indicessrc"] | [
"def",
"indicessrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"indicessrc\"",
"]"
] | [
269,
4
] | [
280,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.legendgroup | (self) |
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def legendgroup(self):
"""
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["legendgroup"] | [
"def",
"legendgroup",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"legendgroup\"",
"]"
] | [
289,
4
] | [
303,
34
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.marker | (self) |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
blend
Determines if colors are blended together for a
translucency effect in case `opacity` is
specified as a value less then `1`. Setting
`blend` to `true` reduces zoom/pan speed if
used with large numbers of points.
border
:class:`plotly.graph_objects.pointcloud.marker.
Border` instance or dict with compatible
properties
color
Sets the marker fill color. It accepts a
specific color.If the color is not fully opaque
and there are hundreds of thousandsof points,
it may cause slower zooming and panning.
opacity
Sets the marker opacity. The default value is
`1` (fully opaque). If the markers are not
fully opaque and there are hundreds of
thousands of points, it may cause slower
zooming and panning. Opacity fades the color
even if `blend` is left on `false` even if
there is no translucency effect in that case.
sizemax
Sets the maximum size (in px) of the rendered
marker points. Effective when the `pointcloud`
shows only few points.
sizemin
Sets the minimum size (in px) of the rendered
marker points, effective when the `pointcloud`
shows a million or more points.
Returns
-------
plotly.graph_objs.pointcloud.Marker
|
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
blend
Determines if colors are blended together for a
translucency effect in case `opacity` is
specified as a value less then `1`. Setting
`blend` to `true` reduces zoom/pan speed if
used with large numbers of points.
border
:class:`plotly.graph_objects.pointcloud.marker.
Border` instance or dict with compatible
properties
color
Sets the marker fill color. It accepts a
specific color.If the color is not fully opaque
and there are hundreds of thousandsof points,
it may cause slower zooming and panning.
opacity
Sets the marker opacity. The default value is
`1` (fully opaque). If the markers are not
fully opaque and there are hundreds of
thousands of points, it may cause slower
zooming and panning. Opacity fades the color
even if `blend` is left on `false` even if
there is no translucency effect in that case.
sizemax
Sets the maximum size (in px) of the rendered
marker points. Effective when the `pointcloud`
shows only few points.
sizemin
Sets the minimum size (in px) of the rendered
marker points, effective when the `pointcloud`
shows a million or more points. | def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
blend
Determines if colors are blended together for a
translucency effect in case `opacity` is
specified as a value less then `1`. Setting
`blend` to `true` reduces zoom/pan speed if
used with large numbers of points.
border
:class:`plotly.graph_objects.pointcloud.marker.
Border` instance or dict with compatible
properties
color
Sets the marker fill color. It accepts a
specific color.If the color is not fully opaque
and there are hundreds of thousandsof points,
it may cause slower zooming and panning.
opacity
Sets the marker opacity. The default value is
`1` (fully opaque). If the markers are not
fully opaque and there are hundreds of
thousands of points, it may cause slower
zooming and panning. Opacity fades the color
even if `blend` is left on `false` even if
there is no translucency effect in that case.
sizemax
Sets the maximum size (in px) of the rendered
marker points. Effective when the `pointcloud`
shows only few points.
sizemin
Sets the minimum size (in px) of the rendered
marker points, effective when the `pointcloud`
shows a million or more points.
Returns
-------
plotly.graph_objs.pointcloud.Marker
"""
return self["marker"] | [
"def",
"marker",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"marker\"",
"]"
] | [
312,
4
] | [
358,
29
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.meta | (self) |
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type
Returns
-------
Any|numpy.ndarray
|
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type | def meta(self):
"""
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type
Returns
-------
Any|numpy.ndarray
"""
return self["meta"] | [
"def",
"meta",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"meta\"",
"]"
] | [
367,
4
] | [
386,
27
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.metasrc | (self) |
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def metasrc(self):
"""
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["metasrc"] | [
"def",
"metasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"metasrc\"",
"]"
] | [
395,
4
] | [
406,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.name | (self) |
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def name(self):
"""
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["name"] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"name\"",
"]"
] | [
415,
4
] | [
428,
27
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.opacity | (self) |
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def opacity(self):
"""
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["opacity"] | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
437,
4
] | [
448,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.showlegend | (self) |
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False) | def showlegend(self):
"""
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showlegend"] | [
"def",
"showlegend",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showlegend\"",
"]"
] | [
457,
4
] | [
469,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.stream | (self) |
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.pointcloud.Stream
|
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details. | def stream(self):
"""
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.pointcloud.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.pointcloud.Stream
"""
return self["stream"] | [
"def",
"stream",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"stream\"",
"]"
] | [
478,
4
] | [
502,
29
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.text | (self) |
Sets text elements associated with each (x,y) pair. If a single
string, the same string appears over all the data points. If an
array of string, the items are mapped in order to the this
trace's (x,y) coordinates. If trace `hoverinfo` contains a
"text" flag and "hovertext" is not set, these elements will be
seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Sets text elements associated with each (x,y) pair. If a single
string, the same string appears over all the data points. If an
array of string, the items are mapped in order to the this
trace's (x,y) coordinates. If trace `hoverinfo` contains a
"text" flag and "hovertext" is not set, these elements will be
seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def text(self):
"""
Sets text elements associated with each (x,y) pair. If a single
string, the same string appears over all the data points. If an
array of string, the items are mapped in order to the this
trace's (x,y) coordinates. If trace `hoverinfo` contains a
"text" flag and "hovertext" is not set, these elements will be
seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["text"] | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
511,
4
] | [
529,
27
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.textsrc | (self) |
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def textsrc(self):
"""
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["textsrc"] | [
"def",
"textsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"textsrc\"",
"]"
] | [
538,
4
] | [
549,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.uid | (self) |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["uid"] | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | [
558,
4
] | [
571,
26
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.uirevision | (self) |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
|
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
"""
return self["uirevision"] | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | [
580,
4
] | [
604,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.visible | (self) |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
|
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly'] | def visible(self):
"""
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
613,
4
] | [
627,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.x | (self) |
Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def x(self):
"""
Sets the x coordinates.
The 'x' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["x"] | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
636,
4
] | [
647,
24
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xaxis | (self) |
Sets a reference between this trace's x coordinates and a 2D
cartesian x axis. If "x" (the default value), the x coordinates
refer to `layout.xaxis`. If "x2", the x coordinates refer to
`layout.xaxis2`, and so on.
The 'xaxis' property is an identifier of a particular
subplot, of type 'x', that may be specified as the string 'x'
optionally followed by an integer >= 1
(e.g. 'x', 'x1', 'x2', 'x3', etc.)
Returns
-------
str
|
Sets a reference between this trace's x coordinates and a 2D
cartesian x axis. If "x" (the default value), the x coordinates
refer to `layout.xaxis`. If "x2", the x coordinates refer to
`layout.xaxis2`, and so on.
The 'xaxis' property is an identifier of a particular
subplot, of type 'x', that may be specified as the string 'x'
optionally followed by an integer >= 1
(e.g. 'x', 'x1', 'x2', 'x3', etc.) | def xaxis(self):
"""
Sets a reference between this trace's x coordinates and a 2D
cartesian x axis. If "x" (the default value), the x coordinates
refer to `layout.xaxis`. If "x2", the x coordinates refer to
`layout.xaxis2`, and so on.
The 'xaxis' property is an identifier of a particular
subplot, of type 'x', that may be specified as the string 'x'
optionally followed by an integer >= 1
(e.g. 'x', 'x1', 'x2', 'x3', etc.)
Returns
-------
str
"""
return self["xaxis"] | [
"def",
"xaxis",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xaxis\"",
"]"
] | [
656,
4
] | [
672,
28
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xbounds | (self) |
Specify `xbounds` in the shape of `[xMin, xMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `ybounds` for the performance benefits.
The 'xbounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Specify `xbounds` in the shape of `[xMin, xMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `ybounds` for the performance benefits.
The 'xbounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def xbounds(self):
"""
Specify `xbounds` in the shape of `[xMin, xMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `ybounds` for the performance benefits.
The 'xbounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["xbounds"] | [
"def",
"xbounds",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xbounds\"",
"]"
] | [
681,
4
] | [
694,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xboundssrc | (self) |
Sets the source reference on Chart Studio Cloud for xbounds .
The 'xboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for xbounds .
The 'xboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def xboundssrc(self):
"""
Sets the source reference on Chart Studio Cloud for xbounds .
The 'xboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["xboundssrc"] | [
"def",
"xboundssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xboundssrc\"",
"]"
] | [
703,
4
] | [
714,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xsrc | (self) |
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def xsrc(self):
"""
Sets the source reference on Chart Studio Cloud for x .
The 'xsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["xsrc"] | [
"def",
"xsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xsrc\"",
"]"
] | [
723,
4
] | [
734,
27
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xy | (self) |
Faster alternative to specifying `x` and `y` separately. If
supplied, it must be a typed `Float32Array` array that
represents points such that `xy[i * 2] = x[i]` and `xy[i * 2 +
1] = y[i]`
The 'xy' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Faster alternative to specifying `x` and `y` separately. If
supplied, it must be a typed `Float32Array` array that
represents points such that `xy[i * 2] = x[i]` and `xy[i * 2 +
1] = y[i]`
The 'xy' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def xy(self):
"""
Faster alternative to specifying `x` and `y` separately. If
supplied, it must be a typed `Float32Array` array that
represents points such that `xy[i * 2] = x[i]` and `xy[i * 2 +
1] = y[i]`
The 'xy' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["xy"] | [
"def",
"xy",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xy\"",
"]"
] | [
743,
4
] | [
757,
25
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.xysrc | (self) |
Sets the source reference on Chart Studio Cloud for xy .
The 'xysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for xy .
The 'xysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def xysrc(self):
"""
Sets the source reference on Chart Studio Cloud for xy .
The 'xysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["xysrc"] | [
"def",
"xysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"xysrc\"",
"]"
] | [
766,
4
] | [
777,
28
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.y | (self) |
Sets the y coordinates.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the y coordinates.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def y(self):
"""
Sets the y coordinates.
The 'y' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["y"] | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
786,
4
] | [
797,
24
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.yaxis | (self) |
Sets a reference between this trace's y coordinates and a 2D
cartesian y axis. If "y" (the default value), the y coordinates
refer to `layout.yaxis`. If "y2", the y coordinates refer to
`layout.yaxis2`, and so on.
The 'yaxis' property is an identifier of a particular
subplot, of type 'y', that may be specified as the string 'y'
optionally followed by an integer >= 1
(e.g. 'y', 'y1', 'y2', 'y3', etc.)
Returns
-------
str
|
Sets a reference between this trace's y coordinates and a 2D
cartesian y axis. If "y" (the default value), the y coordinates
refer to `layout.yaxis`. If "y2", the y coordinates refer to
`layout.yaxis2`, and so on.
The 'yaxis' property is an identifier of a particular
subplot, of type 'y', that may be specified as the string 'y'
optionally followed by an integer >= 1
(e.g. 'y', 'y1', 'y2', 'y3', etc.) | def yaxis(self):
"""
Sets a reference between this trace's y coordinates and a 2D
cartesian y axis. If "y" (the default value), the y coordinates
refer to `layout.yaxis`. If "y2", the y coordinates refer to
`layout.yaxis2`, and so on.
The 'yaxis' property is an identifier of a particular
subplot, of type 'y', that may be specified as the string 'y'
optionally followed by an integer >= 1
(e.g. 'y', 'y1', 'y2', 'y3', etc.)
Returns
-------
str
"""
return self["yaxis"] | [
"def",
"yaxis",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"yaxis\"",
"]"
] | [
806,
4
] | [
822,
28
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.ybounds | (self) |
Specify `ybounds` in the shape of `[yMin, yMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `xbounds` for the performance benefits.
The 'ybounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Specify `ybounds` in the shape of `[yMin, yMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `xbounds` for the performance benefits.
The 'ybounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def ybounds(self):
"""
Specify `ybounds` in the shape of `[yMin, yMax] to avoid
looping through the `xy` typed array. Use it in conjunction
with `xy` and `xbounds` for the performance benefits.
The 'ybounds' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["ybounds"] | [
"def",
"ybounds",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ybounds\"",
"]"
] | [
831,
4
] | [
844,
30
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.yboundssrc | (self) |
Sets the source reference on Chart Studio Cloud for ybounds .
The 'yboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for ybounds .
The 'yboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def yboundssrc(self):
"""
Sets the source reference on Chart Studio Cloud for ybounds .
The 'yboundssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["yboundssrc"] | [
"def",
"yboundssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"yboundssrc\"",
"]"
] | [
853,
4
] | [
864,
33
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.ysrc | (self) |
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def ysrc(self):
"""
Sets the source reference on Chart Studio Cloud for y .
The 'ysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["ysrc"] | [
"def",
"ysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ysrc\"",
"]"
] | [
873,
4
] | [
884,
27
] | python | en | ['en', 'error', 'th'] | False |
Pointcloud.__init__ | (
self,
arg=None,
customdata=None,
customdatasrc=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
ids=None,
idssrc=None,
indices=None,
indicessrc=None,
legendgroup=None,
marker=None,
meta=None,
metasrc=None,
name=None,
opacity=None,
showlegend=None,
stream=None,
text=None,
textsrc=None,
uid=None,
uirevision=None,
visible=None,
x=None,
xaxis=None,
xbounds=None,
xboundssrc=None,
xsrc=None,
xy=None,
xysrc=None,
y=None,
yaxis=None,
ybounds=None,
yboundssrc=None,
ysrc=None,
**kwargs
) |
Construct a new Pointcloud object
The data visualized as a point cloud set in `x` and `y` using
the WebGl plotting engine.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Pointcloud`
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
hoverinfo
Determines which trace information appear on hover. If
`none` or `skip` are set, no information is displayed
upon hovering. But, if `none` is set, click and hover
events are still fired.
hoverinfosrc
Sets the source reference on Chart Studio Cloud for
hoverinfo .
hoverlabel
:class:`plotly.graph_objects.pointcloud.Hoverlabel`
instance or dict with compatible properties
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
indices
A sequential value, 0..n, supply it to avoid creating
this array inside plotting. If specified, it must be a
typed `Int32Array` array. Its length must be equal to
or greater than the number of points. For the best
performance and memory use, create one large `indices`
typed array that is guaranteed to be at least as long
as the largest number of points during use, and reuse
it on each `Plotly.restyle()` call.
indicessrc
Sets the source reference on Chart Studio Cloud for
indices .
legendgroup
Sets the legend group for this trace. Traces part of
the same legend group hide/show at the same time when
toggling legend items.
marker
:class:`plotly.graph_objects.pointcloud.Marker`
instance or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
opacity
Sets the opacity of the trace.
showlegend
Determines whether or not an item corresponding to this
trace is shown in the legend.
stream
:class:`plotly.graph_objects.pointcloud.Stream`
instance or dict with compatible properties
text
Sets text elements associated with each (x,y) pair. If
a single string, the same string appears over all the
data points. If an array of string, the items are
mapped in order to the this trace's (x,y) coordinates.
If trace `hoverinfo` contains a "text" flag and
"hovertext" is not set, these elements will be seen in
the hover labels.
textsrc
Sets the source reference on Chart Studio Cloud for
text .
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
x
Sets the x coordinates.
xaxis
Sets a reference between this trace's x coordinates and
a 2D cartesian x axis. If "x" (the default value), the
x coordinates refer to `layout.xaxis`. If "x2", the x
coordinates refer to `layout.xaxis2`, and so on.
xbounds
Specify `xbounds` in the shape of `[xMin, xMax] to
avoid looping through the `xy` typed array. Use it in
conjunction with `xy` and `ybounds` for the performance
benefits.
xboundssrc
Sets the source reference on Chart Studio Cloud for
xbounds .
xsrc
Sets the source reference on Chart Studio Cloud for x
.
xy
Faster alternative to specifying `x` and `y`
separately. If supplied, it must be a typed
`Float32Array` array that represents points such that
`xy[i * 2] = x[i]` and `xy[i * 2 + 1] = y[i]`
xysrc
Sets the source reference on Chart Studio Cloud for xy
.
y
Sets the y coordinates.
yaxis
Sets a reference between this trace's y coordinates and
a 2D cartesian y axis. If "y" (the default value), the
y coordinates refer to `layout.yaxis`. If "y2", the y
coordinates refer to `layout.yaxis2`, and so on.
ybounds
Specify `ybounds` in the shape of `[yMin, yMax] to
avoid looping through the `xy` typed array. Use it in
conjunction with `xy` and `xbounds` for the performance
benefits.
yboundssrc
Sets the source reference on Chart Studio Cloud for
ybounds .
ysrc
Sets the source reference on Chart Studio Cloud for y
.
Returns
-------
Pointcloud
|
Construct a new Pointcloud object
The data visualized as a point cloud set in `x` and `y` using
the WebGl plotting engine. | def __init__(
self,
arg=None,
customdata=None,
customdatasrc=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
ids=None,
idssrc=None,
indices=None,
indicessrc=None,
legendgroup=None,
marker=None,
meta=None,
metasrc=None,
name=None,
opacity=None,
showlegend=None,
stream=None,
text=None,
textsrc=None,
uid=None,
uirevision=None,
visible=None,
x=None,
xaxis=None,
xbounds=None,
xboundssrc=None,
xsrc=None,
xy=None,
xysrc=None,
y=None,
yaxis=None,
ybounds=None,
yboundssrc=None,
ysrc=None,
**kwargs
):
"""
Construct a new Pointcloud object
The data visualized as a point cloud set in `x` and `y` using
the WebGl plotting engine.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Pointcloud`
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
hoverinfo
Determines which trace information appear on hover. If
`none` or `skip` are set, no information is displayed
upon hovering. But, if `none` is set, click and hover
events are still fired.
hoverinfosrc
Sets the source reference on Chart Studio Cloud for
hoverinfo .
hoverlabel
:class:`plotly.graph_objects.pointcloud.Hoverlabel`
instance or dict with compatible properties
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
indices
A sequential value, 0..n, supply it to avoid creating
this array inside plotting. If specified, it must be a
typed `Int32Array` array. Its length must be equal to
or greater than the number of points. For the best
performance and memory use, create one large `indices`
typed array that is guaranteed to be at least as long
as the largest number of points during use, and reuse
it on each `Plotly.restyle()` call.
indicessrc
Sets the source reference on Chart Studio Cloud for
indices .
legendgroup
Sets the legend group for this trace. Traces part of
the same legend group hide/show at the same time when
toggling legend items.
marker
:class:`plotly.graph_objects.pointcloud.Marker`
instance or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
opacity
Sets the opacity of the trace.
showlegend
Determines whether or not an item corresponding to this
trace is shown in the legend.
stream
:class:`plotly.graph_objects.pointcloud.Stream`
instance or dict with compatible properties
text
Sets text elements associated with each (x,y) pair. If
a single string, the same string appears over all the
data points. If an array of string, the items are
mapped in order to the this trace's (x,y) coordinates.
If trace `hoverinfo` contains a "text" flag and
"hovertext" is not set, these elements will be seen in
the hover labels.
textsrc
Sets the source reference on Chart Studio Cloud for
text .
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
x
Sets the x coordinates.
xaxis
Sets a reference between this trace's x coordinates and
a 2D cartesian x axis. If "x" (the default value), the
x coordinates refer to `layout.xaxis`. If "x2", the x
coordinates refer to `layout.xaxis2`, and so on.
xbounds
Specify `xbounds` in the shape of `[xMin, xMax] to
avoid looping through the `xy` typed array. Use it in
conjunction with `xy` and `ybounds` for the performance
benefits.
xboundssrc
Sets the source reference on Chart Studio Cloud for
xbounds .
xsrc
Sets the source reference on Chart Studio Cloud for x
.
xy
Faster alternative to specifying `x` and `y`
separately. If supplied, it must be a typed
`Float32Array` array that represents points such that
`xy[i * 2] = x[i]` and `xy[i * 2 + 1] = y[i]`
xysrc
Sets the source reference on Chart Studio Cloud for xy
.
y
Sets the y coordinates.
yaxis
Sets a reference between this trace's y coordinates and
a 2D cartesian y axis. If "y" (the default value), the
y coordinates refer to `layout.yaxis`. If "y2", the y
coordinates refer to `layout.yaxis2`, and so on.
ybounds
Specify `ybounds` in the shape of `[yMin, yMax] to
avoid looping through the `xy` typed array. Use it in
conjunction with `xy` and `xbounds` for the performance
benefits.
yboundssrc
Sets the source reference on Chart Studio Cloud for
ybounds .
ysrc
Sets the source reference on Chart Studio Cloud for y
.
Returns
-------
Pointcloud
"""
super(Pointcloud, self).__init__("pointcloud")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.Pointcloud
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Pointcloud`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("customdata", None)
_v = customdata if customdata is not None else _v
if _v is not None:
self["customdata"] = _v
_v = arg.pop("customdatasrc", None)
_v = customdatasrc if customdatasrc is not None else _v
if _v is not None:
self["customdatasrc"] = _v
_v = arg.pop("hoverinfo", None)
_v = hoverinfo if hoverinfo is not None else _v
if _v is not None:
self["hoverinfo"] = _v
_v = arg.pop("hoverinfosrc", None)
_v = hoverinfosrc if hoverinfosrc is not None else _v
if _v is not None:
self["hoverinfosrc"] = _v
_v = arg.pop("hoverlabel", None)
_v = hoverlabel if hoverlabel is not None else _v
if _v is not None:
self["hoverlabel"] = _v
_v = arg.pop("ids", None)
_v = ids if ids is not None else _v
if _v is not None:
self["ids"] = _v
_v = arg.pop("idssrc", None)
_v = idssrc if idssrc is not None else _v
if _v is not None:
self["idssrc"] = _v
_v = arg.pop("indices", None)
_v = indices if indices is not None else _v
if _v is not None:
self["indices"] = _v
_v = arg.pop("indicessrc", None)
_v = indicessrc if indicessrc is not None else _v
if _v is not None:
self["indicessrc"] = _v
_v = arg.pop("legendgroup", None)
_v = legendgroup if legendgroup is not None else _v
if _v is not None:
self["legendgroup"] = _v
_v = arg.pop("marker", None)
_v = marker if marker is not None else _v
if _v is not None:
self["marker"] = _v
_v = arg.pop("meta", None)
_v = meta if meta is not None else _v
if _v is not None:
self["meta"] = _v
_v = arg.pop("metasrc", None)
_v = metasrc if metasrc is not None else _v
if _v is not None:
self["metasrc"] = _v
_v = arg.pop("name", None)
_v = name if name is not None else _v
if _v is not None:
self["name"] = _v
_v = arg.pop("opacity", None)
_v = opacity if opacity is not None else _v
if _v is not None:
self["opacity"] = _v
_v = arg.pop("showlegend", None)
_v = showlegend if showlegend is not None else _v
if _v is not None:
self["showlegend"] = _v
_v = arg.pop("stream", None)
_v = stream if stream is not None else _v
if _v is not None:
self["stream"] = _v
_v = arg.pop("text", None)
_v = text if text is not None else _v
if _v is not None:
self["text"] = _v
_v = arg.pop("textsrc", None)
_v = textsrc if textsrc is not None else _v
if _v is not None:
self["textsrc"] = _v
_v = arg.pop("uid", None)
_v = uid if uid is not None else _v
if _v is not None:
self["uid"] = _v
_v = arg.pop("uirevision", None)
_v = uirevision if uirevision is not None else _v
if _v is not None:
self["uirevision"] = _v
_v = arg.pop("visible", None)
_v = visible if visible is not None else _v
if _v is not None:
self["visible"] = _v
_v = arg.pop("x", None)
_v = x if x is not None else _v
if _v is not None:
self["x"] = _v
_v = arg.pop("xaxis", None)
_v = xaxis if xaxis is not None else _v
if _v is not None:
self["xaxis"] = _v
_v = arg.pop("xbounds", None)
_v = xbounds if xbounds is not None else _v
if _v is not None:
self["xbounds"] = _v
_v = arg.pop("xboundssrc", None)
_v = xboundssrc if xboundssrc is not None else _v
if _v is not None:
self["xboundssrc"] = _v
_v = arg.pop("xsrc", None)
_v = xsrc if xsrc is not None else _v
if _v is not None:
self["xsrc"] = _v
_v = arg.pop("xy", None)
_v = xy if xy is not None else _v
if _v is not None:
self["xy"] = _v
_v = arg.pop("xysrc", None)
_v = xysrc if xysrc is not None else _v
if _v is not None:
self["xysrc"] = _v
_v = arg.pop("y", None)
_v = y if y is not None else _v
if _v is not None:
self["y"] = _v
_v = arg.pop("yaxis", None)
_v = yaxis if yaxis is not None else _v
if _v is not None:
self["yaxis"] = _v
_v = arg.pop("ybounds", None)
_v = ybounds if ybounds is not None else _v
if _v is not None:
self["ybounds"] = _v
_v = arg.pop("yboundssrc", None)
_v = yboundssrc if yboundssrc is not None else _v
if _v is not None:
self["yboundssrc"] = _v
_v = arg.pop("ysrc", None)
_v = ysrc if ysrc is not None else _v
if _v is not None:
self["ysrc"] = _v
# Read-only literals
# ------------------
self._props["type"] = "pointcloud"
arg.pop("type", None)
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"customdata",
"=",
"None",
",",
"customdatasrc",
"=",
"None",
",",
"hoverinfo",
"=",
"None",
",",
"hoverinfosrc",
"=",
"None",
",",
"hoverlabel",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"idssrc",
"=",
"None",
",",
"indices",
"=",
"None",
",",
"indicessrc",
"=",
"None",
",",
"legendgroup",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"metasrc",
"=",
"None",
",",
"name",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"showlegend",
"=",
"None",
",",
"stream",
"=",
"None",
",",
"text",
"=",
"None",
",",
"textsrc",
"=",
"None",
",",
"uid",
"=",
"None",
",",
"uirevision",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"x",
"=",
"None",
",",
"xaxis",
"=",
"None",
",",
"xbounds",
"=",
"None",
",",
"xboundssrc",
"=",
"None",
",",
"xsrc",
"=",
"None",
",",
"xy",
"=",
"None",
",",
"xysrc",
"=",
"None",
",",
"y",
"=",
"None",
",",
"yaxis",
"=",
"None",
",",
"ybounds",
"=",
"None",
",",
"yboundssrc",
"=",
"None",
",",
"ysrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Pointcloud",
",",
"self",
")",
".",
"__init__",
"(",
"\"pointcloud\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.Pointcloud \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.Pointcloud`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdata\"",
",",
"None",
")",
"_v",
"=",
"customdata",
"if",
"customdata",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdata\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdatasrc\"",
",",
"None",
")",
"_v",
"=",
"customdatasrc",
"if",
"customdatasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdatasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverinfo\"",
",",
"None",
")",
"_v",
"=",
"hoverinfo",
"if",
"hoverinfo",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverinfo\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverinfosrc\"",
",",
"None",
")",
"_v",
"=",
"hoverinfosrc",
"if",
"hoverinfosrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverinfosrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"hoverlabel\"",
",",
"None",
")",
"_v",
"=",
"hoverlabel",
"if",
"hoverlabel",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"hoverlabel\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ids\"",
",",
"None",
")",
"_v",
"=",
"ids",
"if",
"ids",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ids\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"idssrc\"",
",",
"None",
")",
"_v",
"=",
"idssrc",
"if",
"idssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"idssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"indices\"",
",",
"None",
")",
"_v",
"=",
"indices",
"if",
"indices",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"indices\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"indicessrc\"",
",",
"None",
")",
"_v",
"=",
"indicessrc",
"if",
"indicessrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"indicessrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"legendgroup\"",
",",
"None",
")",
"_v",
"=",
"legendgroup",
"if",
"legendgroup",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"legendgroup\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"marker\"",
",",
"None",
")",
"_v",
"=",
"marker",
"if",
"marker",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"marker\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"meta\"",
",",
"None",
")",
"_v",
"=",
"meta",
"if",
"meta",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"meta\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"metasrc\"",
",",
"None",
")",
"_v",
"=",
"metasrc",
"if",
"metasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"metasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"name\"",
",",
"None",
")",
"_v",
"=",
"name",
"if",
"name",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"name\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"opacity\"",
",",
"None",
")",
"_v",
"=",
"opacity",
"if",
"opacity",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"opacity\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showlegend\"",
",",
"None",
")",
"_v",
"=",
"showlegend",
"if",
"showlegend",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showlegend\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"stream\"",
",",
"None",
")",
"_v",
"=",
"stream",
"if",
"stream",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"stream\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"text\"",
",",
"None",
")",
"_v",
"=",
"text",
"if",
"text",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"text\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"textsrc\"",
",",
"None",
")",
"_v",
"=",
"textsrc",
"if",
"textsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"textsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uid\"",
",",
"None",
")",
"_v",
"=",
"uid",
"if",
"uid",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uid\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uirevision\"",
",",
"None",
")",
"_v",
"=",
"uirevision",
"if",
"uirevision",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uirevision\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"visible\"",
",",
"None",
")",
"_v",
"=",
"visible",
"if",
"visible",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"visible\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"x\"",
",",
"None",
")",
"_v",
"=",
"x",
"if",
"x",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"x\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xaxis\"",
",",
"None",
")",
"_v",
"=",
"xaxis",
"if",
"xaxis",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xaxis\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xbounds\"",
",",
"None",
")",
"_v",
"=",
"xbounds",
"if",
"xbounds",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xbounds\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xboundssrc\"",
",",
"None",
")",
"_v",
"=",
"xboundssrc",
"if",
"xboundssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xboundssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xsrc\"",
",",
"None",
")",
"_v",
"=",
"xsrc",
"if",
"xsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xy\"",
",",
"None",
")",
"_v",
"=",
"xy",
"if",
"xy",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xy\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xysrc\"",
",",
"None",
")",
"_v",
"=",
"xysrc",
"if",
"xysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xysrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"y\"",
",",
"None",
")",
"_v",
"=",
"y",
"if",
"y",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"y\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"yaxis\"",
",",
"None",
")",
"_v",
"=",
"yaxis",
"if",
"yaxis",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"yaxis\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ybounds\"",
",",
"None",
")",
"_v",
"=",
"ybounds",
"if",
"ybounds",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ybounds\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"yboundssrc\"",
",",
"None",
")",
"_v",
"=",
"yboundssrc",
"if",
"yboundssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"yboundssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ysrc\"",
",",
"None",
")",
"_v",
"=",
"ysrc",
"if",
"ysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ysrc\"",
"]",
"=",
"_v",
"# Read-only literals",
"# ------------------",
"self",
".",
"_props",
"[",
"\"type\"",
"]",
"=",
"\"pointcloud\"",
"arg",
".",
"pop",
"(",
"\"type\"",
",",
"None",
")",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
1057,
4
] | [
1444,
34
] | python | en | ['en', 'error', 'th'] | False |
TestDisplayData.test_output | (self) |
Does display_data reach the end of the loop?
|
Does display_data reach the end of the loop?
| def test_output(self):
"""
Does display_data reach the end of the loop?
"""
str_output, _, _ = testing_utils.display_data(
{'num_examples': 1, 'task': 'babi:task1k:1', 'verbose': True}
)
self.assertGreater(len(str_output), 0, "Output is empty")
self.assertIn("babi:task1k:1", str_output, "Babi task did not print")
self.assertIn("~~", str_output, "Example output did not complete") | [
"def",
"test_output",
"(",
"self",
")",
":",
"str_output",
",",
"_",
",",
"_",
"=",
"testing_utils",
".",
"display_data",
"(",
"{",
"'num_examples'",
":",
"1",
",",
"'task'",
":",
"'babi:task1k:1'",
",",
"'verbose'",
":",
"True",
"}",
")",
"self",
".",
"assertGreater",
"(",
"len",
"(",
"str_output",
")",
",",
"0",
",",
"\"Output is empty\"",
")",
"self",
".",
"assertIn",
"(",
"\"babi:task1k:1\"",
",",
"str_output",
",",
"\"Babi task did not print\"",
")",
"self",
".",
"assertIn",
"(",
"\"~~\"",
",",
"str_output",
",",
"\"Example output did not complete\"",
")"
] | [
14,
4
] | [
24,
74
] | python | en | ['en', 'error', 'th'] | False |
_cache_lockfuncs | () |
Updates the cache.
|
Updates the cache.
| def _cache_lockfuncs():
"""
Updates the cache.
"""
global _LOCKFUNCS
_LOCKFUNCS = {}
for modulepath in settings.LOCK_FUNC_MODULES:
_LOCKFUNCS.update(utils.callables_from_module(modulepath)) | [
"def",
"_cache_lockfuncs",
"(",
")",
":",
"global",
"_LOCKFUNCS",
"_LOCKFUNCS",
"=",
"{",
"}",
"for",
"modulepath",
"in",
"settings",
".",
"LOCK_FUNC_MODULES",
":",
"_LOCKFUNCS",
".",
"update",
"(",
"utils",
".",
"callables_from_module",
"(",
"modulepath",
")",
")"
] | [
140,
0
] | [
147,
66
] | python | en | ['en', 'error', 'th'] | False |
check_lockstring | (self, accessing_obj, lockstring, no_superuser_bypass=False,
default=False, access_type=None) |
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object.
Args:
accessing_obj (object or None): The object seeking access.
Importantly, this can be left unset if the lock functions
don't access it, no updating or storage of locks are made
against this object in this method.
lockstring (str): Lock string to check, on the form
`"access_type:lock_definition"` where the `access_type`
part can potentially be set to a dummy value to just check
a lock condition.
no_superuser_bypass (bool, optional): Force superusers to heed lock.
default (bool, optional): Fallback result to use if `access_type` is set
but no such `access_type` is found in the given `lockstring`.
access_type (str, bool): If set, only this access_type will be looked up
among the locks defined by `lockstring`.
Return:
access (bool): If check is passed or not.
|
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object. | def check_lockstring(self, accessing_obj, lockstring, no_superuser_bypass=False,
default=False, access_type=None):
"""
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object.
Args:
accessing_obj (object or None): The object seeking access.
Importantly, this can be left unset if the lock functions
don't access it, no updating or storage of locks are made
against this object in this method.
lockstring (str): Lock string to check, on the form
`"access_type:lock_definition"` where the `access_type`
part can potentially be set to a dummy value to just check
a lock condition.
no_superuser_bypass (bool, optional): Force superusers to heed lock.
default (bool, optional): Fallback result to use if `access_type` is set
but no such `access_type` is found in the given `lockstring`.
access_type (str, bool): If set, only this access_type will be looked up
among the locks defined by `lockstring`.
Return:
access (bool): If check is passed or not.
"""
global _LOCKHANDLER
if not _LOCKHANDLER:
_LOCKHANDLER = LockHandler(_ObjDummy())
return _LOCK_HANDLER.check_lockstring(
accessing_obj, lockstring, no_superuser_bypass=no_superuser_bypass,
default=default, access_type=access_type) | [
"def",
"check_lockstring",
"(",
"self",
",",
"accessing_obj",
",",
"lockstring",
",",
"no_superuser_bypass",
"=",
"False",
",",
"default",
"=",
"False",
",",
"access_type",
"=",
"None",
")",
":",
"global",
"_LOCKHANDLER",
"if",
"not",
"_LOCKHANDLER",
":",
"_LOCKHANDLER",
"=",
"LockHandler",
"(",
"_ObjDummy",
"(",
")",
")",
"return",
"_LOCK_HANDLER",
".",
"check_lockstring",
"(",
"accessing_obj",
",",
"lockstring",
",",
"no_superuser_bypass",
"=",
"no_superuser_bypass",
",",
"default",
"=",
"default",
",",
"access_type",
"=",
"access_type",
")"
] | [
620,
0
] | [
650,
49
] | python | en | ['en', 'error', 'th'] | False |
validate_lockstring | (lockstring) |
Validate so lockstring is on a valid form.
Args:
lockstring (str): Lockstring to validate.
Returns:
is_valid (bool): If the lockstring is valid or not.
error (str or None): A string describing the error, or None
if no error was found.
|
Validate so lockstring is on a valid form. | def validate_lockstring(lockstring):
"""
Validate so lockstring is on a valid form.
Args:
lockstring (str): Lockstring to validate.
Returns:
is_valid (bool): If the lockstring is valid or not.
error (str or None): A string describing the error, or None
if no error was found.
"""
global _LOCK_HANDLER
if not _LOCK_HANDLER:
_LOCK_HANDLER = LockHandler(_ObjDummy())
return _LOCK_HANDLER.validate(lockstring) | [
"def",
"validate_lockstring",
"(",
"lockstring",
")",
":",
"global",
"_LOCK_HANDLER",
"if",
"not",
"_LOCK_HANDLER",
":",
"_LOCK_HANDLER",
"=",
"LockHandler",
"(",
"_ObjDummy",
"(",
")",
")",
"return",
"_LOCK_HANDLER",
".",
"validate",
"(",
"lockstring",
")"
] | [
653,
0
] | [
669,
45
] | python | en | ['en', 'error', 'th'] | False |
get_all_lockfuncs | () |
Get a dict of available lock funcs.
Returns:
lockfuncs (dict): Mapping {lockfuncname:func}.
|
Get a dict of available lock funcs. | def get_all_lockfuncs():
"""
Get a dict of available lock funcs.
Returns:
lockfuncs (dict): Mapping {lockfuncname:func}.
"""
if not _LOCKFUNCS:
_cache_lockfuncs()
return _LOCKFUNCS | [
"def",
"get_all_lockfuncs",
"(",
")",
":",
"if",
"not",
"_LOCKFUNCS",
":",
"_cache_lockfuncs",
"(",
")",
"return",
"_LOCKFUNCS"
] | [
672,
0
] | [
682,
21
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.__init__ | (self, obj) |
Loads and pre-caches all relevant locks and their functions.
Args:
obj (object): The object on which the lockhandler is
defined.
|
Loads and pre-caches all relevant locks and their functions. | def __init__(self, obj):
"""
Loads and pre-caches all relevant locks and their functions.
Args:
obj (object): The object on which the lockhandler is
defined.
"""
if not _LOCKFUNCS:
_cache_lockfuncs()
self.obj = obj
self.locks = {}
try:
self.reset()
except LockException as err:
logger.log_trace(err) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
")",
":",
"if",
"not",
"_LOCKFUNCS",
":",
"_cache_lockfuncs",
"(",
")",
"self",
".",
"obj",
"=",
"obj",
"self",
".",
"locks",
"=",
"{",
"}",
"try",
":",
"self",
".",
"reset",
"(",
")",
"except",
"LockException",
"as",
"err",
":",
"logger",
".",
"log_trace",
"(",
"err",
")"
] | [
172,
4
] | [
188,
33
] | python | en | ['en', 'error', 'th'] | False |
LockHandler._log_error | (self, message) | Try to log errors back to object | Try to log errors back to object | def _log_error(self, message):
"Try to log errors back to object"
raise LockException(message) | [
"def",
"_log_error",
"(",
"self",
",",
"message",
")",
":",
"raise",
"LockException",
"(",
"message",
")"
] | [
193,
4
] | [
195,
36
] | python | en | ['en', 'en', 'en'] | True |
LockHandler._parse_lockstring | (self, storage_lockstring) |
Helper function. This is normally only called when the
lockstring is cached and does preliminary checking. locks are
stored as a string
atype:[NOT] lock()[[ AND|OR [NOT] lock()[...]];atype...
Args:
storage_locksring (str): The lockstring to parse.
|
Helper function. This is normally only called when the
lockstring is cached and does preliminary checking. locks are
stored as a string | def _parse_lockstring(self, storage_lockstring):
"""
Helper function. This is normally only called when the
lockstring is cached and does preliminary checking. locks are
stored as a string
atype:[NOT] lock()[[ AND|OR [NOT] lock()[...]];atype...
Args:
storage_locksring (str): The lockstring to parse.
"""
locks = {}
if not storage_lockstring:
return locks
duplicates = 0
elist = [] # errors
wlist = [] # warnings
for raw_lockstring in storage_lockstring.split(';'):
if not raw_lockstring:
continue
lock_funcs = []
try:
access_type, rhs = (part.strip() for part in raw_lockstring.split(':', 1))
except ValueError:
logger.log_trace()
return locks
# parse the lock functions and separators
funclist = _RE_FUNCS.findall(rhs)
evalstring = rhs
for pattern in ('AND', 'OR', 'NOT'):
evalstring = re.sub(r"\b%s\b" % pattern, pattern.lower(), evalstring)
nfuncs = len(funclist)
for funcstring in funclist:
funcname, rest = (part.strip().strip(')') for part in funcstring.split('(', 1))
func = _LOCKFUNCS.get(funcname, None)
if not callable(func):
elist.append(_("Lock: lock-function '%s' is not available.") % funcstring)
continue
args = list(arg.strip() for arg in rest.split(',') if arg and '=' not in arg)
kwargs = dict([arg.split('=', 1) for arg in rest.split(',') if arg and '=' in arg])
lock_funcs.append((func, args, kwargs))
evalstring = evalstring.replace(funcstring, '%s')
if len(lock_funcs) < nfuncs:
continue
try:
# purge the eval string of any superfluous items, then test it
evalstring = " ".join(_RE_OK.findall(evalstring))
eval(evalstring % tuple(True for func in funclist), {}, {})
except Exception:
elist.append(_("Lock: definition '%s' has syntax errors.") % raw_lockstring)
continue
if access_type in locks:
duplicates += 1
wlist.append(_("LockHandler on %(obj)s: access type '%(access_type)s' changed from '%(source)s' to '%(goal)s' " %
{"obj": self.obj, "access_type": access_type, "source": locks[access_type][2], "goal": raw_lockstring}))
locks[access_type] = (evalstring, tuple(lock_funcs), raw_lockstring)
if wlist and WARNING_LOG:
# a warning text was set, it's not an error, so only report
logger.log_file("\n".join(wlist), WARNING_LOG)
if elist:
# an error text was set, raise exception.
raise LockException("\n".join(elist))
# return the gathered locks in an easily executable form
return locks | [
"def",
"_parse_lockstring",
"(",
"self",
",",
"storage_lockstring",
")",
":",
"locks",
"=",
"{",
"}",
"if",
"not",
"storage_lockstring",
":",
"return",
"locks",
"duplicates",
"=",
"0",
"elist",
"=",
"[",
"]",
"# errors",
"wlist",
"=",
"[",
"]",
"# warnings",
"for",
"raw_lockstring",
"in",
"storage_lockstring",
".",
"split",
"(",
"';'",
")",
":",
"if",
"not",
"raw_lockstring",
":",
"continue",
"lock_funcs",
"=",
"[",
"]",
"try",
":",
"access_type",
",",
"rhs",
"=",
"(",
"part",
".",
"strip",
"(",
")",
"for",
"part",
"in",
"raw_lockstring",
".",
"split",
"(",
"':'",
",",
"1",
")",
")",
"except",
"ValueError",
":",
"logger",
".",
"log_trace",
"(",
")",
"return",
"locks",
"# parse the lock functions and separators",
"funclist",
"=",
"_RE_FUNCS",
".",
"findall",
"(",
"rhs",
")",
"evalstring",
"=",
"rhs",
"for",
"pattern",
"in",
"(",
"'AND'",
",",
"'OR'",
",",
"'NOT'",
")",
":",
"evalstring",
"=",
"re",
".",
"sub",
"(",
"r\"\\b%s\\b\"",
"%",
"pattern",
",",
"pattern",
".",
"lower",
"(",
")",
",",
"evalstring",
")",
"nfuncs",
"=",
"len",
"(",
"funclist",
")",
"for",
"funcstring",
"in",
"funclist",
":",
"funcname",
",",
"rest",
"=",
"(",
"part",
".",
"strip",
"(",
")",
".",
"strip",
"(",
"')'",
")",
"for",
"part",
"in",
"funcstring",
".",
"split",
"(",
"'('",
",",
"1",
")",
")",
"func",
"=",
"_LOCKFUNCS",
".",
"get",
"(",
"funcname",
",",
"None",
")",
"if",
"not",
"callable",
"(",
"func",
")",
":",
"elist",
".",
"append",
"(",
"_",
"(",
"\"Lock: lock-function '%s' is not available.\"",
")",
"%",
"funcstring",
")",
"continue",
"args",
"=",
"list",
"(",
"arg",
".",
"strip",
"(",
")",
"for",
"arg",
"in",
"rest",
".",
"split",
"(",
"','",
")",
"if",
"arg",
"and",
"'='",
"not",
"in",
"arg",
")",
"kwargs",
"=",
"dict",
"(",
"[",
"arg",
".",
"split",
"(",
"'='",
",",
"1",
")",
"for",
"arg",
"in",
"rest",
".",
"split",
"(",
"','",
")",
"if",
"arg",
"and",
"'='",
"in",
"arg",
"]",
")",
"lock_funcs",
".",
"append",
"(",
"(",
"func",
",",
"args",
",",
"kwargs",
")",
")",
"evalstring",
"=",
"evalstring",
".",
"replace",
"(",
"funcstring",
",",
"'%s'",
")",
"if",
"len",
"(",
"lock_funcs",
")",
"<",
"nfuncs",
":",
"continue",
"try",
":",
"# purge the eval string of any superfluous items, then test it",
"evalstring",
"=",
"\" \"",
".",
"join",
"(",
"_RE_OK",
".",
"findall",
"(",
"evalstring",
")",
")",
"eval",
"(",
"evalstring",
"%",
"tuple",
"(",
"True",
"for",
"func",
"in",
"funclist",
")",
",",
"{",
"}",
",",
"{",
"}",
")",
"except",
"Exception",
":",
"elist",
".",
"append",
"(",
"_",
"(",
"\"Lock: definition '%s' has syntax errors.\"",
")",
"%",
"raw_lockstring",
")",
"continue",
"if",
"access_type",
"in",
"locks",
":",
"duplicates",
"+=",
"1",
"wlist",
".",
"append",
"(",
"_",
"(",
"\"LockHandler on %(obj)s: access type '%(access_type)s' changed from '%(source)s' to '%(goal)s' \"",
"%",
"{",
"\"obj\"",
":",
"self",
".",
"obj",
",",
"\"access_type\"",
":",
"access_type",
",",
"\"source\"",
":",
"locks",
"[",
"access_type",
"]",
"[",
"2",
"]",
",",
"\"goal\"",
":",
"raw_lockstring",
"}",
")",
")",
"locks",
"[",
"access_type",
"]",
"=",
"(",
"evalstring",
",",
"tuple",
"(",
"lock_funcs",
")",
",",
"raw_lockstring",
")",
"if",
"wlist",
"and",
"WARNING_LOG",
":",
"# a warning text was set, it's not an error, so only report",
"logger",
".",
"log_file",
"(",
"\"\\n\"",
".",
"join",
"(",
"wlist",
")",
",",
"WARNING_LOG",
")",
"if",
"elist",
":",
"# an error text was set, raise exception.",
"raise",
"LockException",
"(",
"\"\\n\"",
".",
"join",
"(",
"elist",
")",
")",
"# return the gathered locks in an easily executable form",
"return",
"locks"
] | [
197,
4
] | [
262,
20
] | python | en | ['en', 'error', 'th'] | False |
LockHandler._cache_locks | (self, storage_lockstring) |
Store data
|
Store data
| def _cache_locks(self, storage_lockstring):
"""
Store data
"""
self.locks = self._parse_lockstring(storage_lockstring) | [
"def",
"_cache_locks",
"(",
"self",
",",
"storage_lockstring",
")",
":",
"self",
".",
"locks",
"=",
"self",
".",
"_parse_lockstring",
"(",
"storage_lockstring",
")"
] | [
264,
4
] | [
268,
63
] | python | en | ['en', 'error', 'th'] | False |
LockHandler._save_locks | (self) |
Store locks to obj
|
Store locks to obj
| def _save_locks(self):
"""
Store locks to obj
"""
self.obj.lock_storage = ";".join([tup[2] for tup in self.locks.values()]) | [
"def",
"_save_locks",
"(",
"self",
")",
":",
"self",
".",
"obj",
".",
"lock_storage",
"=",
"\";\"",
".",
"join",
"(",
"[",
"tup",
"[",
"2",
"]",
"for",
"tup",
"in",
"self",
".",
"locks",
".",
"values",
"(",
")",
"]",
")"
] | [
270,
4
] | [
274,
81
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.cache_lock_bypass | (self, obj) |
We cache superuser bypass checks here for efficiency. This
needs to be re-run when an account is assigned to a character.
We need to grant access to superusers. We need to check both
directly on the object (accounts), through obj.account and using
the get_account() method (this sits on serversessions, in some
rare cases where a check is done before the login process has
yet been fully finalized)
Args:
obj (object): This is checked for the `is_superuser` property.
|
We cache superuser bypass checks here for efficiency. This
needs to be re-run when an account is assigned to a character.
We need to grant access to superusers. We need to check both
directly on the object (accounts), through obj.account and using
the get_account() method (this sits on serversessions, in some
rare cases where a check is done before the login process has
yet been fully finalized) | def cache_lock_bypass(self, obj):
"""
We cache superuser bypass checks here for efficiency. This
needs to be re-run when an account is assigned to a character.
We need to grant access to superusers. We need to check both
directly on the object (accounts), through obj.account and using
the get_account() method (this sits on serversessions, in some
rare cases where a check is done before the login process has
yet been fully finalized)
Args:
obj (object): This is checked for the `is_superuser` property.
"""
self.lock_bypass = hasattr(obj, "is_superuser") and obj.is_superuser | [
"def",
"cache_lock_bypass",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"lock_bypass",
"=",
"hasattr",
"(",
"obj",
",",
"\"is_superuser\"",
")",
"and",
"obj",
".",
"is_superuser"
] | [
276,
4
] | [
290,
76
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.add | (self, lockstring, validate_only=False) |
Add a new lockstring to handler.
Args:
lockstring (str or list): A string on the form
`"<access_type>:<functions>"`. Multiple access types
should be separated by semicolon (`;`). Alternatively,
a list with lockstrings.
validate_only (bool, optional): If True, validate the lockstring but
don't actually store it.
Returns:
success (bool): The outcome of the addition, `False` on
error. If `validate_only` is True, this will be a tuple
(bool, error), for pass/fail and a string error.
|
Add a new lockstring to handler. | def add(self, lockstring, validate_only=False):
"""
Add a new lockstring to handler.
Args:
lockstring (str or list): A string on the form
`"<access_type>:<functions>"`. Multiple access types
should be separated by semicolon (`;`). Alternatively,
a list with lockstrings.
validate_only (bool, optional): If True, validate the lockstring but
don't actually store it.
Returns:
success (bool): The outcome of the addition, `False` on
error. If `validate_only` is True, this will be a tuple
(bool, error), for pass/fail and a string error.
"""
if isinstance(lockstring, basestring):
lockdefs = lockstring.split(";")
else:
lockdefs = [lockdef for locks in lockstring for lockdef in locks.split(";")]
lockstring = ";".join(lockdefs)
err = ""
# sanity checks
for lockdef in lockdefs:
if ':' not in lockdef:
err = _("Lock: '{lockdef}' contains no colon (:).").format(lockdef=lockdef)
if validate_only:
return False, err
else:
self._log_error(err)
return False
access_type, rhs = [part.strip() for part in lockdef.split(':', 1)]
if not access_type:
err = _("Lock: '{lockdef}' has no access_type "
"(left-side of colon is empty).").format(lockdef=lockdef)
if validate_only:
return False, err
else:
self._log_error(err)
return False
if rhs.count('(') != rhs.count(')'):
err = _("Lock: '{lockdef}' has mismatched parentheses.").format(lockdef=lockdef)
if validate_only:
return False, err
else:
self._log_error(err)
return False
if not _RE_FUNCS.findall(rhs):
err = _("Lock: '{lockdef}' has no valid lock functions.").format(lockdef=lockdef)
if validate_only:
return False, err
else:
self._log_error(err)
return False
if validate_only:
return True, None
# get the lock string
storage_lockstring = self.obj.lock_storage
if storage_lockstring:
storage_lockstring = storage_lockstring + ";" + lockstring
else:
storage_lockstring = lockstring
# cache the locks will get rid of eventual doublets
self._cache_locks(storage_lockstring)
self._save_locks()
return True | [
"def",
"add",
"(",
"self",
",",
"lockstring",
",",
"validate_only",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"lockstring",
",",
"basestring",
")",
":",
"lockdefs",
"=",
"lockstring",
".",
"split",
"(",
"\";\"",
")",
"else",
":",
"lockdefs",
"=",
"[",
"lockdef",
"for",
"locks",
"in",
"lockstring",
"for",
"lockdef",
"in",
"locks",
".",
"split",
"(",
"\";\"",
")",
"]",
"lockstring",
"=",
"\";\"",
".",
"join",
"(",
"lockdefs",
")",
"err",
"=",
"\"\"",
"# sanity checks",
"for",
"lockdef",
"in",
"lockdefs",
":",
"if",
"':'",
"not",
"in",
"lockdef",
":",
"err",
"=",
"_",
"(",
"\"Lock: '{lockdef}' contains no colon (:).\"",
")",
".",
"format",
"(",
"lockdef",
"=",
"lockdef",
")",
"if",
"validate_only",
":",
"return",
"False",
",",
"err",
"else",
":",
"self",
".",
"_log_error",
"(",
"err",
")",
"return",
"False",
"access_type",
",",
"rhs",
"=",
"[",
"part",
".",
"strip",
"(",
")",
"for",
"part",
"in",
"lockdef",
".",
"split",
"(",
"':'",
",",
"1",
")",
"]",
"if",
"not",
"access_type",
":",
"err",
"=",
"_",
"(",
"\"Lock: '{lockdef}' has no access_type \"",
"\"(left-side of colon is empty).\"",
")",
".",
"format",
"(",
"lockdef",
"=",
"lockdef",
")",
"if",
"validate_only",
":",
"return",
"False",
",",
"err",
"else",
":",
"self",
".",
"_log_error",
"(",
"err",
")",
"return",
"False",
"if",
"rhs",
".",
"count",
"(",
"'('",
")",
"!=",
"rhs",
".",
"count",
"(",
"')'",
")",
":",
"err",
"=",
"_",
"(",
"\"Lock: '{lockdef}' has mismatched parentheses.\"",
")",
".",
"format",
"(",
"lockdef",
"=",
"lockdef",
")",
"if",
"validate_only",
":",
"return",
"False",
",",
"err",
"else",
":",
"self",
".",
"_log_error",
"(",
"err",
")",
"return",
"False",
"if",
"not",
"_RE_FUNCS",
".",
"findall",
"(",
"rhs",
")",
":",
"err",
"=",
"_",
"(",
"\"Lock: '{lockdef}' has no valid lock functions.\"",
")",
".",
"format",
"(",
"lockdef",
"=",
"lockdef",
")",
"if",
"validate_only",
":",
"return",
"False",
",",
"err",
"else",
":",
"self",
".",
"_log_error",
"(",
"err",
")",
"return",
"False",
"if",
"validate_only",
":",
"return",
"True",
",",
"None",
"# get the lock string",
"storage_lockstring",
"=",
"self",
".",
"obj",
".",
"lock_storage",
"if",
"storage_lockstring",
":",
"storage_lockstring",
"=",
"storage_lockstring",
"+",
"\";\"",
"+",
"lockstring",
"else",
":",
"storage_lockstring",
"=",
"lockstring",
"# cache the locks will get rid of eventual doublets",
"self",
".",
"_cache_locks",
"(",
"storage_lockstring",
")",
"self",
".",
"_save_locks",
"(",
")",
"return",
"True"
] | [
292,
4
] | [
359,
19
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.validate | (self, lockstring) |
Validate lockstring syntactically, without saving it.
Args:
lockstring (str): Lockstring to validate.
Returns:
valid (bool): If validation passed or not.
|
Validate lockstring syntactically, without saving it. | def validate(self, lockstring):
"""
Validate lockstring syntactically, without saving it.
Args:
lockstring (str): Lockstring to validate.
Returns:
valid (bool): If validation passed or not.
"""
return self.add(lockstring, validate_only=True) | [
"def",
"validate",
"(",
"self",
",",
"lockstring",
")",
":",
"return",
"self",
".",
"add",
"(",
"lockstring",
",",
"validate_only",
"=",
"True",
")"
] | [
361,
4
] | [
371,
55
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.replace | (self, lockstring) |
Replaces the lockstring entirely.
Args:
lockstring (str): The new lock definition.
Return:
success (bool): False if an error occurred.
Raises:
LockException: If a critical error occurred.
If so, the old string is recovered.
|
Replaces the lockstring entirely. | def replace(self, lockstring):
"""
Replaces the lockstring entirely.
Args:
lockstring (str): The new lock definition.
Return:
success (bool): False if an error occurred.
Raises:
LockException: If a critical error occurred.
If so, the old string is recovered.
"""
old_lockstring = str(self)
self.clear()
try:
return self.add(lockstring)
except LockException:
self.add(old_lockstring)
raise | [
"def",
"replace",
"(",
"self",
",",
"lockstring",
")",
":",
"old_lockstring",
"=",
"str",
"(",
"self",
")",
"self",
".",
"clear",
"(",
")",
"try",
":",
"return",
"self",
".",
"add",
"(",
"lockstring",
")",
"except",
"LockException",
":",
"self",
".",
"add",
"(",
"old_lockstring",
")",
"raise"
] | [
373,
4
] | [
394,
17
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.get | (self, access_type=None) |
Get the full lockstring or the lockstring of a particular
access type.
Args:
access_type (str, optional):
Returns:
lockstring (str): The matched lockstring, or the full
lockstring if no access_type was given.
|
Get the full lockstring or the lockstring of a particular
access type. | def get(self, access_type=None):
"""
Get the full lockstring or the lockstring of a particular
access type.
Args:
access_type (str, optional):
Returns:
lockstring (str): The matched lockstring, or the full
lockstring if no access_type was given.
"""
if access_type:
return self.locks.get(access_type, ["", "", ""])[2]
return str(self) | [
"def",
"get",
"(",
"self",
",",
"access_type",
"=",
"None",
")",
":",
"if",
"access_type",
":",
"return",
"self",
".",
"locks",
".",
"get",
"(",
"access_type",
",",
"[",
"\"\"",
",",
"\"\"",
",",
"\"\"",
"]",
")",
"[",
"2",
"]",
"return",
"str",
"(",
"self",
")"
] | [
396,
4
] | [
411,
24
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.all | (self) |
Return all lockstrings
Returns:
lockstrings (list): All separate lockstrings
|
Return all lockstrings | def all(self):
"""
Return all lockstrings
Returns:
lockstrings (list): All separate lockstrings
"""
return str(self).split(';') | [
"def",
"all",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
")",
".",
"split",
"(",
"';'",
")"
] | [
413,
4
] | [
421,
35
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.remove | (self, access_type) |
Remove a particular lock from the handler
Args:
access_type (str): The type of lock to remove.
Returns:
success (bool): If the access_type was not found
in the lock, this returns `False`.
|
Remove a particular lock from the handler | def remove(self, access_type):
"""
Remove a particular lock from the handler
Args:
access_type (str): The type of lock to remove.
Returns:
success (bool): If the access_type was not found
in the lock, this returns `False`.
"""
if access_type in self.locks:
del self.locks[access_type]
self._save_locks()
return True
return False | [
"def",
"remove",
"(",
"self",
",",
"access_type",
")",
":",
"if",
"access_type",
"in",
"self",
".",
"locks",
":",
"del",
"self",
".",
"locks",
"[",
"access_type",
"]",
"self",
".",
"_save_locks",
"(",
")",
"return",
"True",
"return",
"False"
] | [
423,
4
] | [
439,
20
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.clear | (self) |
Remove all locks in the handler.
|
Remove all locks in the handler. | def clear(self):
"""
Remove all locks in the handler.
"""
self.locks = {}
self.lock_storage = ""
self._save_locks() | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"locks",
"=",
"{",
"}",
"self",
".",
"lock_storage",
"=",
"\"\"",
"self",
".",
"_save_locks",
"(",
")"
] | [
442,
4
] | [
449,
26
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.reset | (self) |
Set the reset flag, so the the lock will be re-cached at next
checking. This is usually called by @reload.
|
Set the reset flag, so the the lock will be re-cached at next
checking. This is usually called by @reload. | def reset(self):
"""
Set the reset flag, so the the lock will be re-cached at next
checking. This is usually called by @reload.
"""
self._cache_locks(self.obj.lock_storage)
self.cache_lock_bypass(self.obj) | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_cache_locks",
"(",
"self",
".",
"obj",
".",
"lock_storage",
")",
"self",
".",
"cache_lock_bypass",
"(",
"self",
".",
"obj",
")"
] | [
451,
4
] | [
458,
40
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.append | (self, access_type, lockstring, op='or') |
Append a lock definition to access_type if it doesn't already exist.
Args:
access_type (str): Access type.
lockstring (str): A valid lockstring, without the operator to
link it to an eventual existing lockstring.
op (str): An operator 'and', 'or', 'and not', 'or not' used
for appending the lockstring to an existing access-type.
Note:
The most common use of this method is for use in commands where
the user can specify their own lockstrings. This method allows
the system to auto-add things like Admin-override access.
|
Append a lock definition to access_type if it doesn't already exist. | def append(self, access_type, lockstring, op='or'):
"""
Append a lock definition to access_type if it doesn't already exist.
Args:
access_type (str): Access type.
lockstring (str): A valid lockstring, without the operator to
link it to an eventual existing lockstring.
op (str): An operator 'and', 'or', 'and not', 'or not' used
for appending the lockstring to an existing access-type.
Note:
The most common use of this method is for use in commands where
the user can specify their own lockstrings. This method allows
the system to auto-add things like Admin-override access.
"""
old_lockstring = self.get(access_type)
if not lockstring.strip().lower() in old_lockstring.lower():
lockstring = "{old} {op} {new}".format(
old=old_lockstring, op=op, new=lockstring.strip())
self.add(lockstring) | [
"def",
"append",
"(",
"self",
",",
"access_type",
",",
"lockstring",
",",
"op",
"=",
"'or'",
")",
":",
"old_lockstring",
"=",
"self",
".",
"get",
"(",
"access_type",
")",
"if",
"not",
"lockstring",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"in",
"old_lockstring",
".",
"lower",
"(",
")",
":",
"lockstring",
"=",
"\"{old} {op} {new}\"",
".",
"format",
"(",
"old",
"=",
"old_lockstring",
",",
"op",
"=",
"op",
",",
"new",
"=",
"lockstring",
".",
"strip",
"(",
")",
")",
"self",
".",
"add",
"(",
"lockstring",
")"
] | [
460,
4
] | [
480,
32
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.check | (self, accessing_obj, access_type, default=False, no_superuser_bypass=False) |
Checks a lock of the correct type by passing execution off to
the lock function(s).
Args:
accessing_obj (object): The object seeking access.
access_type (str): The type of access wanted.
default (bool, optional): If no suitable lock type is
found, default to this result.
no_superuser_bypass (bool): Don't use this unless you
really, really need to, it makes supersusers susceptible
to the lock check.
Notes:
A lock is executed in the follwoing way:
Parsing the lockstring, we (during cache) extract the valid
lock functions and store their function objects in the right
order along with their args/kwargs. These are now executed in
sequence, creating a list of True/False values. This is put
into the evalstring, which is a string of AND/OR/NOT entries
separated by placeholders where each function result should
go. We just put those results in and evaluate the string to
get a final, combined True/False value for the lockstring.
The important bit with this solution is that the full
lockstring is never blindly evaluated, and thus there (should
be) no way to sneak in malign code in it. Only "safe" lock
functions (as defined by your settings) are executed.
|
Checks a lock of the correct type by passing execution off to
the lock function(s). | def check(self, accessing_obj, access_type, default=False, no_superuser_bypass=False):
"""
Checks a lock of the correct type by passing execution off to
the lock function(s).
Args:
accessing_obj (object): The object seeking access.
access_type (str): The type of access wanted.
default (bool, optional): If no suitable lock type is
found, default to this result.
no_superuser_bypass (bool): Don't use this unless you
really, really need to, it makes supersusers susceptible
to the lock check.
Notes:
A lock is executed in the follwoing way:
Parsing the lockstring, we (during cache) extract the valid
lock functions and store their function objects in the right
order along with their args/kwargs. These are now executed in
sequence, creating a list of True/False values. This is put
into the evalstring, which is a string of AND/OR/NOT entries
separated by placeholders where each function result should
go. We just put those results in and evaluate the string to
get a final, combined True/False value for the lockstring.
The important bit with this solution is that the full
lockstring is never blindly evaluated, and thus there (should
be) no way to sneak in malign code in it. Only "safe" lock
functions (as defined by your settings) are executed.
"""
try:
# check if the lock should be bypassed (e.g. superuser status)
if accessing_obj.locks.lock_bypass and not no_superuser_bypass:
return True
except AttributeError:
# happens before session is initiated.
if not no_superuser_bypass and (
(hasattr(accessing_obj, 'is_superuser') and accessing_obj.is_superuser) or
(hasattr(accessing_obj, 'account') and
hasattr(accessing_obj.account, 'is_superuser') and
accessing_obj.account.is_superuser) or
(hasattr(accessing_obj, 'get_account') and
(not accessing_obj.get_account() or accessing_obj.get_account().is_superuser))):
return True
# no superuser or bypass -> normal lock operation
if access_type in self.locks:
# we have a lock, test it.
evalstring, func_tup, raw_string = self.locks[access_type]
# execute all lock funcs in the correct order, producing a tuple of True/False results.
true_false = tuple(bool(
tup[0](accessing_obj, self.obj, *tup[1], **tup[2])) for tup in func_tup)
# the True/False tuple goes into evalstring, which combines them
# with AND/OR/NOT in order to get the final result.
return eval(evalstring % true_false)
else:
return default | [
"def",
"check",
"(",
"self",
",",
"accessing_obj",
",",
"access_type",
",",
"default",
"=",
"False",
",",
"no_superuser_bypass",
"=",
"False",
")",
":",
"try",
":",
"# check if the lock should be bypassed (e.g. superuser status)",
"if",
"accessing_obj",
".",
"locks",
".",
"lock_bypass",
"and",
"not",
"no_superuser_bypass",
":",
"return",
"True",
"except",
"AttributeError",
":",
"# happens before session is initiated.",
"if",
"not",
"no_superuser_bypass",
"and",
"(",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'is_superuser'",
")",
"and",
"accessing_obj",
".",
"is_superuser",
")",
"or",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'account'",
")",
"and",
"hasattr",
"(",
"accessing_obj",
".",
"account",
",",
"'is_superuser'",
")",
"and",
"accessing_obj",
".",
"account",
".",
"is_superuser",
")",
"or",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'get_account'",
")",
"and",
"(",
"not",
"accessing_obj",
".",
"get_account",
"(",
")",
"or",
"accessing_obj",
".",
"get_account",
"(",
")",
".",
"is_superuser",
")",
")",
")",
":",
"return",
"True",
"# no superuser or bypass -> normal lock operation",
"if",
"access_type",
"in",
"self",
".",
"locks",
":",
"# we have a lock, test it.",
"evalstring",
",",
"func_tup",
",",
"raw_string",
"=",
"self",
".",
"locks",
"[",
"access_type",
"]",
"# execute all lock funcs in the correct order, producing a tuple of True/False results.",
"true_false",
"=",
"tuple",
"(",
"bool",
"(",
"tup",
"[",
"0",
"]",
"(",
"accessing_obj",
",",
"self",
".",
"obj",
",",
"*",
"tup",
"[",
"1",
"]",
",",
"*",
"*",
"tup",
"[",
"2",
"]",
")",
")",
"for",
"tup",
"in",
"func_tup",
")",
"# the True/False tuple goes into evalstring, which combines them",
"# with AND/OR/NOT in order to get the final result.",
"return",
"eval",
"(",
"evalstring",
"%",
"true_false",
")",
"else",
":",
"return",
"default"
] | [
482,
4
] | [
540,
26
] | python | en | ['en', 'error', 'th'] | False |
LockHandler._eval_access_type | (self, accessing_obj, locks, access_type) |
Helper method for evaluating the access type using eval().
Args:
accessing_obj (object): Object seeking access.
locks (dict): The pre-parsed representation of all access-types.
access_type (str): An access-type key to evaluate.
|
Helper method for evaluating the access type using eval(). | def _eval_access_type(self, accessing_obj, locks, access_type):
"""
Helper method for evaluating the access type using eval().
Args:
accessing_obj (object): Object seeking access.
locks (dict): The pre-parsed representation of all access-types.
access_type (str): An access-type key to evaluate.
"""
evalstring, func_tup, raw_string = locks[access_type]
true_false = tuple(tup[0](accessing_obj, self.obj, *tup[1], **tup[2])
for tup in func_tup)
return eval(evalstring % true_false) | [
"def",
"_eval_access_type",
"(",
"self",
",",
"accessing_obj",
",",
"locks",
",",
"access_type",
")",
":",
"evalstring",
",",
"func_tup",
",",
"raw_string",
"=",
"locks",
"[",
"access_type",
"]",
"true_false",
"=",
"tuple",
"(",
"tup",
"[",
"0",
"]",
"(",
"accessing_obj",
",",
"self",
".",
"obj",
",",
"*",
"tup",
"[",
"1",
"]",
",",
"*",
"*",
"tup",
"[",
"2",
"]",
")",
"for",
"tup",
"in",
"func_tup",
")",
"return",
"eval",
"(",
"evalstring",
"%",
"true_false",
")"
] | [
542,
4
] | [
555,
44
] | python | en | ['en', 'error', 'th'] | False |
LockHandler.check_lockstring | (self, accessing_obj, lockstring, no_superuser_bypass=False,
default=False, access_type=None) |
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object.
Args:
accessing_obj (object or None): The object seeking access.
Importantly, this can be left unset if the lock functions
don't access it, no updating or storage of locks are made
against this object in this method.
lockstring (str): Lock string to check, on the form
`"access_type:lock_definition"` where the `access_type`
part can potentially be set to a dummy value to just check
a lock condition.
no_superuser_bypass (bool, optional): Force superusers to heed lock.
default (bool, optional): Fallback result to use if `access_type` is set
but no such `access_type` is found in the given `lockstring`.
access_type (str, bool): If set, only this access_type will be looked up
among the locks defined by `lockstring`.
Return:
access (bool): If check is passed or not.
|
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object. | def check_lockstring(self, accessing_obj, lockstring, no_superuser_bypass=False,
default=False, access_type=None):
"""
Do a direct check against a lockstring ('atype:func()..'),
without any intermediary storage on the accessed object.
Args:
accessing_obj (object or None): The object seeking access.
Importantly, this can be left unset if the lock functions
don't access it, no updating or storage of locks are made
against this object in this method.
lockstring (str): Lock string to check, on the form
`"access_type:lock_definition"` where the `access_type`
part can potentially be set to a dummy value to just check
a lock condition.
no_superuser_bypass (bool, optional): Force superusers to heed lock.
default (bool, optional): Fallback result to use if `access_type` is set
but no such `access_type` is found in the given `lockstring`.
access_type (str, bool): If set, only this access_type will be looked up
among the locks defined by `lockstring`.
Return:
access (bool): If check is passed or not.
"""
try:
if accessing_obj.locks.lock_bypass and not no_superuser_bypass:
return True
except AttributeError:
if no_superuser_bypass and (
(hasattr(accessing_obj, 'is_superuser') and accessing_obj.is_superuser) or
(hasattr(accessing_obj, 'account') and
hasattr(accessing_obj.account, 'is_superuser') and
accessing_obj.account.is_superuser) or
(hasattr(accessing_obj, 'get_account') and
(not accessing_obj.get_account() or accessing_obj.get_account().is_superuser))):
return True
if ":" not in lockstring:
lockstring = "%s:%s" % ("_dummy", lockstring)
locks = self._parse_lockstring(lockstring)
if access_type:
if access_type not in locks:
return default
else:
return self._eval_access_type(
accessing_obj, locks, access_type)
else:
# if no access types was given and multiple locks were
# embedded in the lockstring we assume all must be true
return all(self._eval_access_type(
accessing_obj, locks, access_type) for access_type in locks) | [
"def",
"check_lockstring",
"(",
"self",
",",
"accessing_obj",
",",
"lockstring",
",",
"no_superuser_bypass",
"=",
"False",
",",
"default",
"=",
"False",
",",
"access_type",
"=",
"None",
")",
":",
"try",
":",
"if",
"accessing_obj",
".",
"locks",
".",
"lock_bypass",
"and",
"not",
"no_superuser_bypass",
":",
"return",
"True",
"except",
"AttributeError",
":",
"if",
"no_superuser_bypass",
"and",
"(",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'is_superuser'",
")",
"and",
"accessing_obj",
".",
"is_superuser",
")",
"or",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'account'",
")",
"and",
"hasattr",
"(",
"accessing_obj",
".",
"account",
",",
"'is_superuser'",
")",
"and",
"accessing_obj",
".",
"account",
".",
"is_superuser",
")",
"or",
"(",
"hasattr",
"(",
"accessing_obj",
",",
"'get_account'",
")",
"and",
"(",
"not",
"accessing_obj",
".",
"get_account",
"(",
")",
"or",
"accessing_obj",
".",
"get_account",
"(",
")",
".",
"is_superuser",
")",
")",
")",
":",
"return",
"True",
"if",
"\":\"",
"not",
"in",
"lockstring",
":",
"lockstring",
"=",
"\"%s:%s\"",
"%",
"(",
"\"_dummy\"",
",",
"lockstring",
")",
"locks",
"=",
"self",
".",
"_parse_lockstring",
"(",
"lockstring",
")",
"if",
"access_type",
":",
"if",
"access_type",
"not",
"in",
"locks",
":",
"return",
"default",
"else",
":",
"return",
"self",
".",
"_eval_access_type",
"(",
"accessing_obj",
",",
"locks",
",",
"access_type",
")",
"else",
":",
"# if no access types was given and multiple locks were",
"# embedded in the lockstring we assume all must be true",
"return",
"all",
"(",
"self",
".",
"_eval_access_type",
"(",
"accessing_obj",
",",
"locks",
",",
"access_type",
")",
"for",
"access_type",
"in",
"locks",
")"
] | [
557,
4
] | [
609,
76
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.