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
list | start_point
list | end_point
list | language
stringclasses 1
value | docstring_language
stringlengths 2
7
| docstring_language_predictions
stringlengths 18
23
| is_langid_reliable
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|
ColorBar.yanchor | (self) |
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'middle', 'bottom']
Returns
-------
Any
|
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'middle', 'bottom'] | def yanchor(self):
"""
Sets this color bar's vertical position anchor This anchor
binds the `y` position to the "top", "middle" or "bottom" of
the color bar.
The 'yanchor' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top', 'middle', 'bottom']
Returns
-------
Any
"""
return self["yanchor"] | [
"def",
"yanchor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"yanchor\"",
"]"
] | [
1240,
4
] | [
1254,
30
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.ypad | (self) |
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def ypad(self):
"""
Sets the amount of padding (in px) along the y direction.
The 'ypad' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["ypad"] | [
"def",
"ypad",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ypad\"",
"]"
] | [
1263,
4
] | [
1274,
27
] | python | en | ['en', 'error', 'th'] | False |
ColorBar.__init__ | (
self,
arg=None,
bgcolor=None,
bordercolor=None,
borderwidth=None,
dtick=None,
exponentformat=None,
len=None,
lenmode=None,
nticks=None,
outlinecolor=None,
outlinewidth=None,
separatethousands=None,
showexponent=None,
showticklabels=None,
showtickprefix=None,
showticksuffix=None,
thickness=None,
thicknessmode=None,
tick0=None,
tickangle=None,
tickcolor=None,
tickfont=None,
tickformat=None,
tickformatstops=None,
tickformatstopdefaults=None,
ticklen=None,
tickmode=None,
tickprefix=None,
ticks=None,
ticksuffix=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
tickwidth=None,
title=None,
titlefont=None,
titleside=None,
x=None,
xanchor=None,
xpad=None,
y=None,
yanchor=None,
ypad=None,
**kwargs
) |
Construct a new ColorBar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram2d.ColorBar`
bgcolor
Sets the color of padded area.
bordercolor
Sets the axis line color.
borderwidth
Sets the width (in px) or the border enclosing this
color bar.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
len
Sets the length of the color bar This measure excludes
the padding of both ends. That is, the color bar length
is this length minus the padding on both ends.
lenmode
Determines whether this color bar's length (i.e. the
measure in the color variation direction) is set in
units of plot "fraction" or in *pixels. Use `len` to
set the value.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
outlinecolor
Sets the axis line color.
outlinewidth
Sets the width (in px) of the axis line.
separatethousands
If "true", even 4-digit integers are separated
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
thickness
Sets the thickness of the color bar This measure
excludes the size of the padding, ticks and labels.
thicknessmode
Determines whether this color bar's thickness (i.e. the
measure in the constant color direction) is set in
units of plot "fraction" or in "pixels". Use
`thickness` to set the value.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the color bar's tick label font
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.histogram2d.col
orbar.Tickformatstop` instances or dicts with
compatible properties
tickformatstopdefaults
When used in a template (as layout.template.data.histog
ram2d.colorbar.tickformatstopdefaults), sets the
default property values to use for elements of
histogram2d.colorbar.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.histogram2d.colorbar.Title
` instance or dict with compatible properties
titlefont
Deprecated: Please use histogram2d.colorbar.title.font
instead. Sets this color bar's title font. Note that
the title's font used to be set by the now deprecated
`titlefont` attribute.
titleside
Deprecated: Please use histogram2d.colorbar.title.side
instead. Determines the location of color bar's title
with respect to the color bar. Note that the title's
location used to be set by the now deprecated
`titleside` attribute.
x
Sets the x position of the color bar (in plot
fraction).
xanchor
Sets this color bar's horizontal position anchor. This
anchor binds the `x` position to the "left", "center"
or "right" of the color bar.
xpad
Sets the amount of padding (in px) along the x
direction.
y
Sets the y position of the color bar (in plot
fraction).
yanchor
Sets this color bar's vertical position anchor This
anchor binds the `y` position to the "top", "middle" or
"bottom" of the color bar.
ypad
Sets the amount of padding (in px) along the y
direction.
Returns
-------
ColorBar
|
Construct a new ColorBar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram2d.ColorBar`
bgcolor
Sets the color of padded area.
bordercolor
Sets the axis line color.
borderwidth
Sets the width (in px) or the border enclosing this
color bar.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
len
Sets the length of the color bar This measure excludes
the padding of both ends. That is, the color bar length
is this length minus the padding on both ends.
lenmode
Determines whether this color bar's length (i.e. the
measure in the color variation direction) is set in
units of plot "fraction" or in *pixels. Use `len` to
set the value.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
outlinecolor
Sets the axis line color.
outlinewidth
Sets the width (in px) of the axis line.
separatethousands
If "true", even 4-digit integers are separated
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
thickness
Sets the thickness of the color bar This measure
excludes the size of the padding, ticks and labels.
thicknessmode
Determines whether this color bar's thickness (i.e. the
measure in the constant color direction) is set in
units of plot "fraction" or in "pixels". Use
`thickness` to set the value.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the color bar's tick label font
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.histogram2d.col
orbar.Tickformatstop` instances or dicts with
compatible properties
tickformatstopdefaults
When used in a template (as layout.template.data.histog
ram2d.colorbar.tickformatstopdefaults), sets the
default property values to use for elements of
histogram2d.colorbar.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.histogram2d.colorbar.Title
` instance or dict with compatible properties
titlefont
Deprecated: Please use histogram2d.colorbar.title.font
instead. Sets this color bar's title font. Note that
the title's font used to be set by the now deprecated
`titlefont` attribute.
titleside
Deprecated: Please use histogram2d.colorbar.title.side
instead. Determines the location of color bar's title
with respect to the color bar. Note that the title's
location used to be set by the now deprecated
`titleside` attribute.
x
Sets the x position of the color bar (in plot
fraction).
xanchor
Sets this color bar's horizontal position anchor. This
anchor binds the `x` position to the "left", "center"
or "right" of the color bar.
xpad
Sets the amount of padding (in px) along the x
direction.
y
Sets the y position of the color bar (in plot
fraction).
yanchor
Sets this color bar's vertical position anchor This
anchor binds the `y` position to the "top", "middle" or
"bottom" of the color bar.
ypad
Sets the amount of padding (in px) along the y
direction. | def __init__(
self,
arg=None,
bgcolor=None,
bordercolor=None,
borderwidth=None,
dtick=None,
exponentformat=None,
len=None,
lenmode=None,
nticks=None,
outlinecolor=None,
outlinewidth=None,
separatethousands=None,
showexponent=None,
showticklabels=None,
showtickprefix=None,
showticksuffix=None,
thickness=None,
thicknessmode=None,
tick0=None,
tickangle=None,
tickcolor=None,
tickfont=None,
tickformat=None,
tickformatstops=None,
tickformatstopdefaults=None,
ticklen=None,
tickmode=None,
tickprefix=None,
ticks=None,
ticksuffix=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
tickwidth=None,
title=None,
titlefont=None,
titleside=None,
x=None,
xanchor=None,
xpad=None,
y=None,
yanchor=None,
ypad=None,
**kwargs
):
"""
Construct a new ColorBar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram2d.ColorBar`
bgcolor
Sets the color of padded area.
bordercolor
Sets the axis line color.
borderwidth
Sets the width (in px) or the border enclosing this
color bar.
dtick
Sets the step in-between ticks on this axis. Use with
`tick0`. Must be a positive number, or special strings
available to "log" and "date" axes. If the axis `type`
is "log", then ticks are set every 10^(n*dtick) where n
is the tick number. For example, to set a tick mark at
1, 10, 100, 1000, ... set dtick to 1. To set tick marks
at 1, 100, 10000, ... set dtick to 2. To set tick marks
at 1, 5, 25, 125, 625, 3125, ... set dtick to
log_10(5), or 0.69897000433. "log" has several special
values; "L<f>", where `f` is a positive number, gives
ticks linearly spaced in value (but not position). For
example `tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus
small digits between, use "D1" (all digits) or "D2"
(only 2 and 5). `tick0` is ignored for "D1" and "D2".
If the axis `type` is "date", then you must convert the
time to milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to 86400000.0.
"date" also has special values "M<n>" gives ticks
spaced by a number of months. `n` must be a positive
integer. To set ticks on the 15th of every third month,
set `tick0` to "2000-01-15" and `dtick` to "M3". To set
ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick exponents.
For example, consider the number 1,000,000,000. If
"none", it appears as 1,000,000,000. If "e", 1e+9. If
"E", 1E+9. If "power", 1x10^9 (with 9 in a super
script). If "SI", 1G. If "B", 1B.
len
Sets the length of the color bar This measure excludes
the padding of both ends. That is, the color bar length
is this length minus the padding on both ends.
lenmode
Determines whether this color bar's length (i.e. the
measure in the color variation direction) is set in
units of plot "fraction" or in *pixels. Use `len` to
set the value.
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks will be
chosen automatically to be less than or equal to
`nticks`. Has an effect only if `tickmode` is set to
"auto".
outlinecolor
Sets the axis line color.
outlinewidth
Sets the width (in px) of the axis line.
separatethousands
If "true", even 4-digit integers are separated
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of the
first tick is shown. If "last", only the exponent of
the last tick is shown. If "none", no exponents appear.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
If "all", all tick labels are displayed with a prefix.
If "first", only the first tick is displayed with a
prefix. If "last", only the last tick is displayed with
a suffix. If "none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
thickness
Sets the thickness of the color bar This measure
excludes the size of the padding, ticks and labels.
thicknessmode
Determines whether this color bar's thickness (i.e. the
measure in the constant color direction) is set in
units of plot "fraction" or in "pixels". Use
`thickness` to set the value.
tick0
Sets the placement of the first tick on this axis. Use
with `dtick`. If the axis `type` is "log", then you
must take the log of your starting tick (e.g. to set
the starting tick to 100, set the `tick0` to 2) except
when `dtick`=*L<f>* (see `dtick` for more info). If the
axis `type` is "date", it should be a date string, like
date data. If the axis `type` is "category", it should
be a number, using the scale where each category is
assigned a serial number from zero in the order it
appears.
tickangle
Sets the angle of the tick labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the color bar's tick label font
tickformat
Sets the tick label formatting rule using d3 formatting
mini-languages which are very similar to those in
Python. For numbers, see:
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format And for
dates see: https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format We add
one item to d3's date formatter: "%{n}f" for fractional
seconds with n digits. For example, *2016-10-13
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
display "09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.histogram2d.col
orbar.Tickformatstop` instances or dicts with
compatible properties
tickformatstopdefaults
When used in a template (as layout.template.data.histog
ram2d.colorbar.tickformatstopdefaults), sets the
default property values to use for elements of
histogram2d.colorbar.tickformatstops
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto", the number
of ticks is set via `nticks`. If "linear", the
placement of the ticks is determined by a starting
position `tick0` and a tick step `dtick` ("linear" is
the default value if `tick0` and `dtick` are provided).
If "array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`. ("array" is
the default value if `tickvals` is provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If "", this
axis' ticks are not drawn. If "outside" ("inside"),
this axis' are drawn outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position via
`tickvals`. Only has an effect if `tickmode` is set to
"array". Used with `tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud for
ticktext .
tickvals
Sets the values at which ticks on this axis appear.
Only has an effect if `tickmode` is set to "array".
Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud for
tickvals .
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.histogram2d.colorbar.Title
` instance or dict with compatible properties
titlefont
Deprecated: Please use histogram2d.colorbar.title.font
instead. Sets this color bar's title font. Note that
the title's font used to be set by the now deprecated
`titlefont` attribute.
titleside
Deprecated: Please use histogram2d.colorbar.title.side
instead. Determines the location of color bar's title
with respect to the color bar. Note that the title's
location used to be set by the now deprecated
`titleside` attribute.
x
Sets the x position of the color bar (in plot
fraction).
xanchor
Sets this color bar's horizontal position anchor. This
anchor binds the `x` position to the "left", "center"
or "right" of the color bar.
xpad
Sets the amount of padding (in px) along the x
direction.
y
Sets the y position of the color bar (in plot
fraction).
yanchor
Sets this color bar's vertical position anchor This
anchor binds the `y` position to the "top", "middle" or
"bottom" of the color bar.
ypad
Sets the amount of padding (in px) along the y
direction.
Returns
-------
ColorBar
"""
super(ColorBar, self).__init__("colorbar")
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.histogram2d.ColorBar
constructor must be a dict or
an instance of :class:`plotly.graph_objs.histogram2d.ColorBar`"""
)
# 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("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _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("borderwidth", None)
_v = borderwidth if borderwidth is not None else _v
if _v is not None:
self["borderwidth"] = _v
_v = arg.pop("dtick", None)
_v = dtick if dtick is not None else _v
if _v is not None:
self["dtick"] = _v
_v = arg.pop("exponentformat", None)
_v = exponentformat if exponentformat is not None else _v
if _v is not None:
self["exponentformat"] = _v
_v = arg.pop("len", None)
_v = len if len is not None else _v
if _v is not None:
self["len"] = _v
_v = arg.pop("lenmode", None)
_v = lenmode if lenmode is not None else _v
if _v is not None:
self["lenmode"] = _v
_v = arg.pop("nticks", None)
_v = nticks if nticks is not None else _v
if _v is not None:
self["nticks"] = _v
_v = arg.pop("outlinecolor", None)
_v = outlinecolor if outlinecolor is not None else _v
if _v is not None:
self["outlinecolor"] = _v
_v = arg.pop("outlinewidth", None)
_v = outlinewidth if outlinewidth is not None else _v
if _v is not None:
self["outlinewidth"] = _v
_v = arg.pop("separatethousands", None)
_v = separatethousands if separatethousands is not None else _v
if _v is not None:
self["separatethousands"] = _v
_v = arg.pop("showexponent", None)
_v = showexponent if showexponent is not None else _v
if _v is not None:
self["showexponent"] = _v
_v = arg.pop("showticklabels", None)
_v = showticklabels if showticklabels is not None else _v
if _v is not None:
self["showticklabels"] = _v
_v = arg.pop("showtickprefix", None)
_v = showtickprefix if showtickprefix is not None else _v
if _v is not None:
self["showtickprefix"] = _v
_v = arg.pop("showticksuffix", None)
_v = showticksuffix if showticksuffix is not None else _v
if _v is not None:
self["showticksuffix"] = _v
_v = arg.pop("thickness", None)
_v = thickness if thickness is not None else _v
if _v is not None:
self["thickness"] = _v
_v = arg.pop("thicknessmode", None)
_v = thicknessmode if thicknessmode is not None else _v
if _v is not None:
self["thicknessmode"] = _v
_v = arg.pop("tick0", None)
_v = tick0 if tick0 is not None else _v
if _v is not None:
self["tick0"] = _v
_v = arg.pop("tickangle", None)
_v = tickangle if tickangle is not None else _v
if _v is not None:
self["tickangle"] = _v
_v = arg.pop("tickcolor", None)
_v = tickcolor if tickcolor is not None else _v
if _v is not None:
self["tickcolor"] = _v
_v = arg.pop("tickfont", None)
_v = tickfont if tickfont is not None else _v
if _v is not None:
self["tickfont"] = _v
_v = arg.pop("tickformat", None)
_v = tickformat if tickformat is not None else _v
if _v is not None:
self["tickformat"] = _v
_v = arg.pop("tickformatstops", None)
_v = tickformatstops if tickformatstops is not None else _v
if _v is not None:
self["tickformatstops"] = _v
_v = arg.pop("tickformatstopdefaults", None)
_v = tickformatstopdefaults if tickformatstopdefaults is not None else _v
if _v is not None:
self["tickformatstopdefaults"] = _v
_v = arg.pop("ticklen", None)
_v = ticklen if ticklen is not None else _v
if _v is not None:
self["ticklen"] = _v
_v = arg.pop("tickmode", None)
_v = tickmode if tickmode is not None else _v
if _v is not None:
self["tickmode"] = _v
_v = arg.pop("tickprefix", None)
_v = tickprefix if tickprefix is not None else _v
if _v is not None:
self["tickprefix"] = _v
_v = arg.pop("ticks", None)
_v = ticks if ticks is not None else _v
if _v is not None:
self["ticks"] = _v
_v = arg.pop("ticksuffix", None)
_v = ticksuffix if ticksuffix is not None else _v
if _v is not None:
self["ticksuffix"] = _v
_v = arg.pop("ticktext", None)
_v = ticktext if ticktext is not None else _v
if _v is not None:
self["ticktext"] = _v
_v = arg.pop("ticktextsrc", None)
_v = ticktextsrc if ticktextsrc is not None else _v
if _v is not None:
self["ticktextsrc"] = _v
_v = arg.pop("tickvals", None)
_v = tickvals if tickvals is not None else _v
if _v is not None:
self["tickvals"] = _v
_v = arg.pop("tickvalssrc", None)
_v = tickvalssrc if tickvalssrc is not None else _v
if _v is not None:
self["tickvalssrc"] = _v
_v = arg.pop("tickwidth", None)
_v = tickwidth if tickwidth is not None else _v
if _v is not None:
self["tickwidth"] = _v
_v = arg.pop("title", None)
_v = title if title is not None else _v
if _v is not None:
self["title"] = _v
_v = arg.pop("titlefont", None)
_v = titlefont if titlefont is not None else _v
if _v is not None:
self["titlefont"] = _v
_v = arg.pop("titleside", None)
_v = titleside if titleside is not None else _v
if _v is not None:
self["titleside"] = _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("xanchor", None)
_v = xanchor if xanchor is not None else _v
if _v is not None:
self["xanchor"] = _v
_v = arg.pop("xpad", None)
_v = xpad if xpad is not None else _v
if _v is not None:
self["xpad"] = _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("yanchor", None)
_v = yanchor if yanchor is not None else _v
if _v is not None:
self["yanchor"] = _v
_v = arg.pop("ypad", None)
_v = ypad if ypad is not None else _v
if _v is not None:
self["ypad"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"borderwidth",
"=",
"None",
",",
"dtick",
"=",
"None",
",",
"exponentformat",
"=",
"None",
",",
"len",
"=",
"None",
",",
"lenmode",
"=",
"None",
",",
"nticks",
"=",
"None",
",",
"outlinecolor",
"=",
"None",
",",
"outlinewidth",
"=",
"None",
",",
"separatethousands",
"=",
"None",
",",
"showexponent",
"=",
"None",
",",
"showticklabels",
"=",
"None",
",",
"showtickprefix",
"=",
"None",
",",
"showticksuffix",
"=",
"None",
",",
"thickness",
"=",
"None",
",",
"thicknessmode",
"=",
"None",
",",
"tick0",
"=",
"None",
",",
"tickangle",
"=",
"None",
",",
"tickcolor",
"=",
"None",
",",
"tickfont",
"=",
"None",
",",
"tickformat",
"=",
"None",
",",
"tickformatstops",
"=",
"None",
",",
"tickformatstopdefaults",
"=",
"None",
",",
"ticklen",
"=",
"None",
",",
"tickmode",
"=",
"None",
",",
"tickprefix",
"=",
"None",
",",
"ticks",
"=",
"None",
",",
"ticksuffix",
"=",
"None",
",",
"ticktext",
"=",
"None",
",",
"ticktextsrc",
"=",
"None",
",",
"tickvals",
"=",
"None",
",",
"tickvalssrc",
"=",
"None",
",",
"tickwidth",
"=",
"None",
",",
"title",
"=",
"None",
",",
"titlefont",
"=",
"None",
",",
"titleside",
"=",
"None",
",",
"x",
"=",
"None",
",",
"xanchor",
"=",
"None",
",",
"xpad",
"=",
"None",
",",
"y",
"=",
"None",
",",
"yanchor",
"=",
"None",
",",
"ypad",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"ColorBar",
",",
"self",
")",
".",
"__init__",
"(",
"\"colorbar\"",
")",
"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.histogram2d.ColorBar \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.histogram2d.ColorBar`\"\"\"",
")",
"# 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",
"(",
"\"bgcolor\"",
",",
"None",
")",
"_v",
"=",
"bgcolor",
"if",
"bgcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolor\"",
"]",
"=",
"_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",
"(",
"\"borderwidth\"",
",",
"None",
")",
"_v",
"=",
"borderwidth",
"if",
"borderwidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"borderwidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"dtick\"",
",",
"None",
")",
"_v",
"=",
"dtick",
"if",
"dtick",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"dtick\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"exponentformat\"",
",",
"None",
")",
"_v",
"=",
"exponentformat",
"if",
"exponentformat",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"exponentformat\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"len\"",
",",
"None",
")",
"_v",
"=",
"len",
"if",
"len",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"len\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"lenmode\"",
",",
"None",
")",
"_v",
"=",
"lenmode",
"if",
"lenmode",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"lenmode\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"nticks\"",
",",
"None",
")",
"_v",
"=",
"nticks",
"if",
"nticks",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"nticks\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"outlinecolor\"",
",",
"None",
")",
"_v",
"=",
"outlinecolor",
"if",
"outlinecolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"outlinecolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"outlinewidth\"",
",",
"None",
")",
"_v",
"=",
"outlinewidth",
"if",
"outlinewidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"outlinewidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"separatethousands\"",
",",
"None",
")",
"_v",
"=",
"separatethousands",
"if",
"separatethousands",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"separatethousands\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showexponent\"",
",",
"None",
")",
"_v",
"=",
"showexponent",
"if",
"showexponent",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showexponent\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showticklabels\"",
",",
"None",
")",
"_v",
"=",
"showticklabels",
"if",
"showticklabels",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showticklabels\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showtickprefix\"",
",",
"None",
")",
"_v",
"=",
"showtickprefix",
"if",
"showtickprefix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showtickprefix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"showticksuffix\"",
",",
"None",
")",
"_v",
"=",
"showticksuffix",
"if",
"showticksuffix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"showticksuffix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"thickness\"",
",",
"None",
")",
"_v",
"=",
"thickness",
"if",
"thickness",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"thickness\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"thicknessmode\"",
",",
"None",
")",
"_v",
"=",
"thicknessmode",
"if",
"thicknessmode",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"thicknessmode\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tick0\"",
",",
"None",
")",
"_v",
"=",
"tick0",
"if",
"tick0",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tick0\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickangle\"",
",",
"None",
")",
"_v",
"=",
"tickangle",
"if",
"tickangle",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickangle\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickcolor\"",
",",
"None",
")",
"_v",
"=",
"tickcolor",
"if",
"tickcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickfont\"",
",",
"None",
")",
"_v",
"=",
"tickfont",
"if",
"tickfont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickfont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformat\"",
",",
"None",
")",
"_v",
"=",
"tickformat",
"if",
"tickformat",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformat\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformatstops\"",
",",
"None",
")",
"_v",
"=",
"tickformatstops",
"if",
"tickformatstops",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformatstops\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickformatstopdefaults\"",
",",
"None",
")",
"_v",
"=",
"tickformatstopdefaults",
"if",
"tickformatstopdefaults",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickformatstopdefaults\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticklen\"",
",",
"None",
")",
"_v",
"=",
"ticklen",
"if",
"ticklen",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticklen\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickmode\"",
",",
"None",
")",
"_v",
"=",
"tickmode",
"if",
"tickmode",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickmode\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickprefix\"",
",",
"None",
")",
"_v",
"=",
"tickprefix",
"if",
"tickprefix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickprefix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticks\"",
",",
"None",
")",
"_v",
"=",
"ticks",
"if",
"ticks",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticks\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticksuffix\"",
",",
"None",
")",
"_v",
"=",
"ticksuffix",
"if",
"ticksuffix",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticksuffix\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticktext\"",
",",
"None",
")",
"_v",
"=",
"ticktext",
"if",
"ticktext",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticktext\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ticktextsrc\"",
",",
"None",
")",
"_v",
"=",
"ticktextsrc",
"if",
"ticktextsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ticktextsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickvals\"",
",",
"None",
")",
"_v",
"=",
"tickvals",
"if",
"tickvals",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickvals\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickvalssrc\"",
",",
"None",
")",
"_v",
"=",
"tickvalssrc",
"if",
"tickvalssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickvalssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickwidth\"",
",",
"None",
")",
"_v",
"=",
"tickwidth",
"if",
"tickwidth",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickwidth\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"title\"",
",",
"None",
")",
"_v",
"=",
"title",
"if",
"title",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"title\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"titlefont\"",
",",
"None",
")",
"_v",
"=",
"titlefont",
"if",
"titlefont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"titlefont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"titleside\"",
",",
"None",
")",
"_v",
"=",
"titleside",
"if",
"titleside",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"titleside\"",
"]",
"=",
"_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",
"(",
"\"xanchor\"",
",",
"None",
")",
"_v",
"=",
"xanchor",
"if",
"xanchor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xanchor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"xpad\"",
",",
"None",
")",
"_v",
"=",
"xpad",
"if",
"xpad",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"xpad\"",
"]",
"=",
"_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",
"(",
"\"yanchor\"",
",",
"None",
")",
"_v",
"=",
"yanchor",
"if",
"yanchor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"yanchor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ypad\"",
",",
"None",
")",
"_v",
"=",
"ypad",
"if",
"ypad",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ypad\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
1481,
4
] | [
1940,
34
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' 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
|
The 'color' 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 color(self):
"""
The 'color' 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["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
64,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' 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 color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
73,
4
] | [
84,
31
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
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".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
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".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above | def family(self):
"""
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".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
93,
4
] | [
116,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.familysrc | (self) |
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' 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 family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def familysrc(self):
"""
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["familysrc"] | [
"def",
"familysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"familysrc\"",
"]"
] | [
125,
4
] | [
136,
32
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
145,
4
] | [
155,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.sizesrc | (self) |
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' 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 size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def sizesrc(self):
"""
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["sizesrc"] | [
"def",
"sizesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizesrc\"",
"]"
] | [
164,
4
] | [
175,
30
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
) |
Construct a new Font object
Sets the font used in hover labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolar.hoverlabel.Font`
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
-------
Font
|
Construct a new Font object
Sets the font used in hover labels. | def __init__(
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
):
"""
Construct a new Font object
Sets the font used in hover labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolar.hoverlabel.Font`
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
-------
Font
"""
super(Font, self).__init__("font")
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.scatterpolar.hoverlabel.Font
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scatterpolar.hoverlabel.Font`"""
)
# 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("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("colorsrc", None)
_v = colorsrc if colorsrc is not None else _v
if _v is not None:
self["colorsrc"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("familysrc", None)
_v = familysrc if familysrc is not None else _v
if _v is not None:
self["familysrc"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
_v = arg.pop("sizesrc", None)
_v = sizesrc if sizesrc is not None else _v
if _v is not None:
self["sizesrc"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"family",
"=",
"None",
",",
"familysrc",
"=",
"None",
",",
"size",
"=",
"None",
",",
"sizesrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",
")",
"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.scatterpolar.hoverlabel.Font \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.scatterpolar.hoverlabel.Font`\"\"\"",
")",
"# 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",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"colorsrc\"",
",",
"None",
")",
"_v",
"=",
"colorsrc",
"if",
"colorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"colorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"familysrc\"",
",",
"None",
")",
"_v",
"=",
"familysrc",
"if",
"familysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"familysrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"sizesrc\"",
",",
"None",
")",
"_v",
"=",
"sizesrc",
"if",
"sizesrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"sizesrc\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
215,
4
] | [
329,
34
] | python | en | ['en', 'error', 'th'] | False |
TagForm.__init__ | (self, *args, **kwargs) |
If we have a tag, then we'll prepopulate our instance with the fields we'd expect it
to have based on the tag. tag_key, tag_category, tag_type, and tag_data all refer to
the corresponding tag fields. The initial data of the form fields will similarly be
populated.
|
If we have a tag, then we'll prepopulate our instance with the fields we'd expect it
to have based on the tag. tag_key, tag_category, tag_type, and tag_data all refer to
the corresponding tag fields. The initial data of the form fields will similarly be
populated.
| def __init__(self, *args, **kwargs):
"""
If we have a tag, then we'll prepopulate our instance with the fields we'd expect it
to have based on the tag. tag_key, tag_category, tag_type, and tag_data all refer to
the corresponding tag fields. The initial data of the form fields will similarly be
populated.
"""
super(TagForm, self).__init__(*args, **kwargs)
tagkey = None
tagcategory = None
tagtype = None
tagdata = None
if hasattr(self.instance, 'tag'):
tagkey = self.instance.tag.db_key
tagcategory = self.instance.tag.db_category
tagtype = self.instance.tag.db_tagtype
tagdata = self.instance.tag.db_data
self.fields['tag_key'].initial = tagkey
self.fields['tag_category'].initial = tagcategory
self.fields['tag_type'].initial = tagtype
self.fields['tag_data'].initial = tagdata
self.instance.tag_key = tagkey
self.instance.tag_category = tagcategory
self.instance.tag_type = tagtype
self.instance.tag_data = tagdata | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"TagForm",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"tagkey",
"=",
"None",
"tagcategory",
"=",
"None",
"tagtype",
"=",
"None",
"tagdata",
"=",
"None",
"if",
"hasattr",
"(",
"self",
".",
"instance",
",",
"'tag'",
")",
":",
"tagkey",
"=",
"self",
".",
"instance",
".",
"tag",
".",
"db_key",
"tagcategory",
"=",
"self",
".",
"instance",
".",
"tag",
".",
"db_category",
"tagtype",
"=",
"self",
".",
"instance",
".",
"tag",
".",
"db_tagtype",
"tagdata",
"=",
"self",
".",
"instance",
".",
"tag",
".",
"db_data",
"self",
".",
"fields",
"[",
"'tag_key'",
"]",
".",
"initial",
"=",
"tagkey",
"self",
".",
"fields",
"[",
"'tag_category'",
"]",
".",
"initial",
"=",
"tagcategory",
"self",
".",
"fields",
"[",
"'tag_type'",
"]",
".",
"initial",
"=",
"tagtype",
"self",
".",
"fields",
"[",
"'tag_data'",
"]",
".",
"initial",
"=",
"tagdata",
"self",
".",
"instance",
".",
"tag_key",
"=",
"tagkey",
"self",
".",
"instance",
".",
"tag_category",
"=",
"tagcategory",
"self",
".",
"instance",
".",
"tag_type",
"=",
"tagtype",
"self",
".",
"instance",
".",
"tag_data",
"=",
"tagdata"
] | [
43,
4
] | [
67,
40
] | python | en | ['en', 'error', 'th'] | False |
TagForm.save | (self, commit=True) |
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
|
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
| def save(self, commit=True):
"""
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
"""
# we are spoofing a tag for the Handler that will be called
# instance = super(TagForm, self).save(commit=False)
instance = self.instance
instance.tag_key = self.cleaned_data['tag_key']
instance.tag_category = self.cleaned_data['tag_category'] or None
instance.tag_type = self.cleaned_data['tag_type'] or None
instance.tag_data = self.cleaned_data['tag_data'] or None
return instance | [
"def",
"save",
"(",
"self",
",",
"commit",
"=",
"True",
")",
":",
"# we are spoofing a tag for the Handler that will be called",
"# instance = super(TagForm, self).save(commit=False)",
"instance",
"=",
"self",
".",
"instance",
"instance",
".",
"tag_key",
"=",
"self",
".",
"cleaned_data",
"[",
"'tag_key'",
"]",
"instance",
".",
"tag_category",
"=",
"self",
".",
"cleaned_data",
"[",
"'tag_category'",
"]",
"or",
"None",
"instance",
".",
"tag_type",
"=",
"self",
".",
"cleaned_data",
"[",
"'tag_type'",
"]",
"or",
"None",
"instance",
".",
"tag_data",
"=",
"self",
".",
"cleaned_data",
"[",
"'tag_data'",
"]",
"or",
"None",
"return",
"instance"
] | [
69,
4
] | [
83,
23
] | python | en | ['en', 'error', 'th'] | False |
TagInline.get_formset | (self, request, obj=None, **kwargs) |
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
|
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
| def get_formset(self, request, obj=None, **kwargs):
"""
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
"""
formset = super(TagInline, self).get_formset(request, obj, **kwargs)
class ProxyFormset(formset):
pass
ProxyFormset.related_field = self.related_field
return ProxyFormset | [
"def",
"get_formset",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"formset",
"=",
"super",
"(",
"TagInline",
",",
"self",
")",
".",
"get_formset",
"(",
"request",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
"class",
"ProxyFormset",
"(",
"formset",
")",
":",
"pass",
"ProxyFormset",
".",
"related_field",
"=",
"self",
".",
"related_field",
"return",
"ProxyFormset"
] | [
138,
4
] | [
150,
27
] | python | en | ['en', 'error', 'th'] | False |
AttributeForm.__init__ | (self, *args, **kwargs) |
If we have an Attribute, then we'll prepopulate our instance with the fields we'd expect it
to have based on the Attribute. attr_key, attr_category, attr_value, attr_strvalue, attr_type,
and attr_lockstring all refer to the corresponding Attribute fields. The initial data of the form fields will
similarly be populated.
|
If we have an Attribute, then we'll prepopulate our instance with the fields we'd expect it
to have based on the Attribute. attr_key, attr_category, attr_value, attr_strvalue, attr_type,
and attr_lockstring all refer to the corresponding Attribute fields. The initial data of the form fields will
similarly be populated. | def __init__(self, *args, **kwargs):
"""
If we have an Attribute, then we'll prepopulate our instance with the fields we'd expect it
to have based on the Attribute. attr_key, attr_category, attr_value, attr_strvalue, attr_type,
and attr_lockstring all refer to the corresponding Attribute fields. The initial data of the form fields will
similarly be populated.
"""
super(AttributeForm, self).__init__(*args, **kwargs)
attr_key = None
attr_category = None
attr_value = None
attr_strvalue = None
attr_type = None
attr_lockstring = None
if hasattr(self.instance, 'attribute'):
attr_key = self.instance.attribute.db_key
attr_category = self.instance.attribute.db_category
attr_value = self.instance.attribute.db_value
attr_strvalue = self.instance.attribute.db_strvalue
attr_type = self.instance.attribute.db_attrtype
attr_lockstring = self.instance.attribute.db_lock_storage
self.fields['attr_key'].initial = attr_key
self.fields['attr_category'].initial = attr_category
self.fields['attr_type'].initial = attr_type
self.fields['attr_value'].initial = attr_value
self.fields['attr_strvalue'].initial = attr_strvalue
self.fields['attr_lockstring'].initial = attr_lockstring
self.instance.attr_key = attr_key
self.instance.attr_category = attr_category
self.instance.attr_value = attr_value
# prevent set from being transformed to unicode
if isinstance(attr_value, set) or isinstance(attr_value, _SaverSet):
self.fields['attr_value'].disabled = True
self.instance.deserialized_value = from_pickle(attr_value)
self.instance.attr_strvalue = attr_strvalue
self.instance.attr_type = attr_type
self.instance.attr_lockstring = attr_lockstring | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"AttributeForm",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"attr_key",
"=",
"None",
"attr_category",
"=",
"None",
"attr_value",
"=",
"None",
"attr_strvalue",
"=",
"None",
"attr_type",
"=",
"None",
"attr_lockstring",
"=",
"None",
"if",
"hasattr",
"(",
"self",
".",
"instance",
",",
"'attribute'",
")",
":",
"attr_key",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_key",
"attr_category",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_category",
"attr_value",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_value",
"attr_strvalue",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_strvalue",
"attr_type",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_attrtype",
"attr_lockstring",
"=",
"self",
".",
"instance",
".",
"attribute",
".",
"db_lock_storage",
"self",
".",
"fields",
"[",
"'attr_key'",
"]",
".",
"initial",
"=",
"attr_key",
"self",
".",
"fields",
"[",
"'attr_category'",
"]",
".",
"initial",
"=",
"attr_category",
"self",
".",
"fields",
"[",
"'attr_type'",
"]",
".",
"initial",
"=",
"attr_type",
"self",
".",
"fields",
"[",
"'attr_value'",
"]",
".",
"initial",
"=",
"attr_value",
"self",
".",
"fields",
"[",
"'attr_strvalue'",
"]",
".",
"initial",
"=",
"attr_strvalue",
"self",
".",
"fields",
"[",
"'attr_lockstring'",
"]",
".",
"initial",
"=",
"attr_lockstring",
"self",
".",
"instance",
".",
"attr_key",
"=",
"attr_key",
"self",
".",
"instance",
".",
"attr_category",
"=",
"attr_category",
"self",
".",
"instance",
".",
"attr_value",
"=",
"attr_value",
"# prevent set from being transformed to unicode",
"if",
"isinstance",
"(",
"attr_value",
",",
"set",
")",
"or",
"isinstance",
"(",
"attr_value",
",",
"_SaverSet",
")",
":",
"self",
".",
"fields",
"[",
"'attr_value'",
"]",
".",
"disabled",
"=",
"True",
"self",
".",
"instance",
".",
"deserialized_value",
"=",
"from_pickle",
"(",
"attr_value",
")",
"self",
".",
"instance",
".",
"attr_strvalue",
"=",
"attr_strvalue",
"self",
".",
"instance",
".",
"attr_type",
"=",
"attr_type",
"self",
".",
"instance",
".",
"attr_lockstring",
"=",
"attr_lockstring"
] | [
184,
4
] | [
221,
55
] | python | en | ['en', 'error', 'th'] | False |
AttributeForm.save | (self, commit=True) |
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
|
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
| def save(self, commit=True):
"""
One thing we want to do here is the or None checks, because forms are saved with an empty
string rather than null from forms, usually, and the Handlers may handle empty strings
differently than None objects. So for consistency with how things are handled in game,
we'll try to make sure that empty form fields will be None, rather than ''.
"""
# we are spoofing an Attribute for the Handler that will be called
instance = self.instance
instance.attr_key = self.cleaned_data['attr_key'] or "no_name_entered_for_attribute"
instance.attr_category = self.cleaned_data['attr_category'] or None
instance.attr_value = self.cleaned_data['attr_value'] or None
# convert the serialized string value into an object, if necessary, for AttributeHandler
instance.attr_value = from_pickle(instance.attr_value)
instance.attr_strvalue = self.cleaned_data['attr_strvalue'] or None
instance.attr_type = self.cleaned_data['attr_type'] or None
instance.attr_lockstring = self.cleaned_data['attr_lockstring']
return instance | [
"def",
"save",
"(",
"self",
",",
"commit",
"=",
"True",
")",
":",
"# we are spoofing an Attribute for the Handler that will be called",
"instance",
"=",
"self",
".",
"instance",
"instance",
".",
"attr_key",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_key'",
"]",
"or",
"\"no_name_entered_for_attribute\"",
"instance",
".",
"attr_category",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_category'",
"]",
"or",
"None",
"instance",
".",
"attr_value",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_value'",
"]",
"or",
"None",
"# convert the serialized string value into an object, if necessary, for AttributeHandler",
"instance",
".",
"attr_value",
"=",
"from_pickle",
"(",
"instance",
".",
"attr_value",
")",
"instance",
".",
"attr_strvalue",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_strvalue'",
"]",
"or",
"None",
"instance",
".",
"attr_type",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_type'",
"]",
"or",
"None",
"instance",
".",
"attr_lockstring",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_lockstring'",
"]",
"return",
"instance"
] | [
223,
4
] | [
240,
23
] | python | en | ['en', 'error', 'th'] | False |
AttributeForm.clean_attr_value | (self) |
Prevent Sets from being cleaned due to literal_eval failing on them. Otherwise they will be turned into
unicode.
|
Prevent Sets from being cleaned due to literal_eval failing on them. Otherwise they will be turned into
unicode.
| def clean_attr_value(self):
"""
Prevent Sets from being cleaned due to literal_eval failing on them. Otherwise they will be turned into
unicode.
"""
data = self.cleaned_data['attr_value']
initial = self.instance.attr_value
if isinstance(initial, set) or isinstance(initial, _SaverSet):
return initial
return data | [
"def",
"clean_attr_value",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"cleaned_data",
"[",
"'attr_value'",
"]",
"initial",
"=",
"self",
".",
"instance",
".",
"attr_value",
"if",
"isinstance",
"(",
"initial",
",",
"set",
")",
"or",
"isinstance",
"(",
"initial",
",",
"_SaverSet",
")",
":",
"return",
"initial",
"return",
"data"
] | [
242,
4
] | [
251,
19
] | python | en | ['en', 'error', 'th'] | False |
AttributeInline.get_formset | (self, request, obj=None, **kwargs) |
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
|
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
| def get_formset(self, request, obj=None, **kwargs):
"""
get_formset has to return a class, but we need to make the class that we return
know about the related_field that we'll use. Returning the class itself rather than
a proxy isn't threadsafe, since it'd be the base class and would change if multiple
people used the admin at the same time
"""
formset = super(AttributeInline, self).get_formset(request, obj, **kwargs)
class ProxyFormset(formset):
pass
ProxyFormset.related_field = self.related_field
return ProxyFormset | [
"def",
"get_formset",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"formset",
"=",
"super",
"(",
"AttributeInline",
",",
"self",
")",
".",
"get_formset",
"(",
"request",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
"class",
"ProxyFormset",
"(",
"formset",
")",
":",
"pass",
"ProxyFormset",
".",
"related_field",
"=",
"self",
".",
"related_field",
"return",
"ProxyFormset"
] | [
306,
4
] | [
319,
27
] | python | en | ['en', 'error', 'th'] | False |
allreduce_grads | (params, coalesce=True, bucket_size_mb=-1) | Allreduce gradients.
Args:
params (list[torch.Parameters]): List of parameters of a model
coalesce (bool, optional): Whether allreduce parameters as a whole.
Defaults to True.
bucket_size_mb (int, optional): Size of bucket, the unit is MB.
Defaults to -1.
| Allreduce gradients. | def allreduce_grads(params, coalesce=True, bucket_size_mb=-1):
"""Allreduce gradients.
Args:
params (list[torch.Parameters]): List of parameters of a model
coalesce (bool, optional): Whether allreduce parameters as a whole.
Defaults to True.
bucket_size_mb (int, optional): Size of bucket, the unit is MB.
Defaults to -1.
"""
grads = [
param.grad.data for param in params
if param.requires_grad and param.grad is not None
]
world_size = dist.get_world_size()
if coalesce:
_allreduce_coalesced(grads, world_size, bucket_size_mb)
else:
for tensor in grads:
dist.all_reduce(tensor.div_(world_size)) | [
"def",
"allreduce_grads",
"(",
"params",
",",
"coalesce",
"=",
"True",
",",
"bucket_size_mb",
"=",
"-",
"1",
")",
":",
"grads",
"=",
"[",
"param",
".",
"grad",
".",
"data",
"for",
"param",
"in",
"params",
"if",
"param",
".",
"requires_grad",
"and",
"param",
".",
"grad",
"is",
"not",
"None",
"]",
"world_size",
"=",
"dist",
".",
"get_world_size",
"(",
")",
"if",
"coalesce",
":",
"_allreduce_coalesced",
"(",
"grads",
",",
"world_size",
",",
"bucket_size_mb",
")",
"else",
":",
"for",
"tensor",
"in",
"grads",
":",
"dist",
".",
"all_reduce",
"(",
"tensor",
".",
"div_",
"(",
"world_size",
")",
")"
] | [
31,
0
] | [
50,
52
] | python | de | ['de', 'la', 'en'] | False |
_py_code | (caller, buf) |
Execute the buffer.
|
Execute the buffer.
| def _py_code(caller, buf):
"""
Execute the buffer.
"""
measure_time = caller.db._py_measure_time
string = "Executing code%s ..." % (
" (measure timing)" if measure_time else "")
caller.msg(string)
_run_code_snippet(caller, buf, mode="exec",
measure_time=measure_time,
show_input=False)
return True | [
"def",
"_py_code",
"(",
"caller",
",",
"buf",
")",
":",
"measure_time",
"=",
"caller",
".",
"db",
".",
"_py_measure_time",
"string",
"=",
"\"Executing code%s ...\"",
"%",
"(",
"\" (measure timing)\"",
"if",
"measure_time",
"else",
"\"\"",
")",
"caller",
".",
"msg",
"(",
"string",
")",
"_run_code_snippet",
"(",
"caller",
",",
"buf",
",",
"mode",
"=",
"\"exec\"",
",",
"measure_time",
"=",
"measure_time",
",",
"show_input",
"=",
"False",
")",
"return",
"True"
] | [
128,
0
] | [
139,
15
] | python | en | ['en', 'error', 'th'] | False |
_run_code_snippet | (caller, pycode, mode="eval", measure_time=False,
show_input=True) |
Run code and try to display information to the caller.
Args:
caller (Object): the caller.
pycode (str): the Python code to run.
m_time (bool, optional): should we measure the time of execution?
show_input (bookl, optional): should we display the input?
|
Run code and try to display information to the caller. | def _run_code_snippet(caller, pycode, mode="eval", measure_time=False,
show_input=True):
"""
Run code and try to display information to the caller.
Args:
caller (Object): the caller.
pycode (str): the Python code to run.
m_time (bool, optional): should we measure the time of execution?
show_input (bookl, optional): should we display the input?
"""
# Try to retrieve the session
session = caller
if hasattr(caller, "sessions"):
sessions = caller.sessions.all()
# import useful variables
import evennia
available_vars = {
'self': caller,
'me': caller,
'here': getattr(caller, "location", None),
'evennia': evennia,
'ev': evennia,
'inherits_from': utils.inherits_from,
}
if show_input:
for session in sessions:
try:
caller.msg(">>> %s" % pycode, session=session,
options={"raw": True})
except TypeError:
caller.msg(">>> %s" % pycode, options={"raw": True})
try:
try:
pycode_compiled = compile(pycode, "", mode)
except Exception:
mode = "exec"
pycode_compiled = compile(pycode, "", mode)
duration = ""
if measure_time:
t0 = time.time()
ret = eval(pycode_compiled, {}, available_vars)
t1 = time.time()
duration = " (runtime ~ %.4f ms)" % ((t1 - t0) * 1000)
else:
ret = eval(pycode_compiled, {}, available_vars)
if mode == "eval":
ret = "%s%s" % (str(ret), duration)
else:
ret = " Done (use self.msg() if you want to catch output)%s" % duration
except Exception:
errlist = traceback.format_exc().split('\n')
if len(errlist) > 4:
errlist = errlist[4:]
ret = "\n".join("%s" % line for line in errlist if line)
for session in sessions:
try:
caller.msg(ret, session=session, options={"raw": True})
except TypeError:
caller.msg(ret, options={"raw": True}) | [
"def",
"_run_code_snippet",
"(",
"caller",
",",
"pycode",
",",
"mode",
"=",
"\"eval\"",
",",
"measure_time",
"=",
"False",
",",
"show_input",
"=",
"True",
")",
":",
"# Try to retrieve the session",
"session",
"=",
"caller",
"if",
"hasattr",
"(",
"caller",
",",
"\"sessions\"",
")",
":",
"sessions",
"=",
"caller",
".",
"sessions",
".",
"all",
"(",
")",
"# import useful variables",
"import",
"evennia",
"available_vars",
"=",
"{",
"'self'",
":",
"caller",
",",
"'me'",
":",
"caller",
",",
"'here'",
":",
"getattr",
"(",
"caller",
",",
"\"location\"",
",",
"None",
")",
",",
"'evennia'",
":",
"evennia",
",",
"'ev'",
":",
"evennia",
",",
"'inherits_from'",
":",
"utils",
".",
"inherits_from",
",",
"}",
"if",
"show_input",
":",
"for",
"session",
"in",
"sessions",
":",
"try",
":",
"caller",
".",
"msg",
"(",
"\">>> %s\"",
"%",
"pycode",
",",
"session",
"=",
"session",
",",
"options",
"=",
"{",
"\"raw\"",
":",
"True",
"}",
")",
"except",
"TypeError",
":",
"caller",
".",
"msg",
"(",
"\">>> %s\"",
"%",
"pycode",
",",
"options",
"=",
"{",
"\"raw\"",
":",
"True",
"}",
")",
"try",
":",
"try",
":",
"pycode_compiled",
"=",
"compile",
"(",
"pycode",
",",
"\"\"",
",",
"mode",
")",
"except",
"Exception",
":",
"mode",
"=",
"\"exec\"",
"pycode_compiled",
"=",
"compile",
"(",
"pycode",
",",
"\"\"",
",",
"mode",
")",
"duration",
"=",
"\"\"",
"if",
"measure_time",
":",
"t0",
"=",
"time",
".",
"time",
"(",
")",
"ret",
"=",
"eval",
"(",
"pycode_compiled",
",",
"{",
"}",
",",
"available_vars",
")",
"t1",
"=",
"time",
".",
"time",
"(",
")",
"duration",
"=",
"\" (runtime ~ %.4f ms)\"",
"%",
"(",
"(",
"t1",
"-",
"t0",
")",
"*",
"1000",
")",
"else",
":",
"ret",
"=",
"eval",
"(",
"pycode_compiled",
",",
"{",
"}",
",",
"available_vars",
")",
"if",
"mode",
"==",
"\"eval\"",
":",
"ret",
"=",
"\"%s%s\"",
"%",
"(",
"str",
"(",
"ret",
")",
",",
"duration",
")",
"else",
":",
"ret",
"=",
"\" Done (use self.msg() if you want to catch output)%s\"",
"%",
"duration",
"except",
"Exception",
":",
"errlist",
"=",
"traceback",
".",
"format_exc",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
"if",
"len",
"(",
"errlist",
")",
">",
"4",
":",
"errlist",
"=",
"errlist",
"[",
"4",
":",
"]",
"ret",
"=",
"\"\\n\"",
".",
"join",
"(",
"\"%s\"",
"%",
"line",
"for",
"line",
"in",
"errlist",
"if",
"line",
")",
"for",
"session",
"in",
"sessions",
":",
"try",
":",
"caller",
".",
"msg",
"(",
"ret",
",",
"session",
"=",
"session",
",",
"options",
"=",
"{",
"\"raw\"",
":",
"True",
"}",
")",
"except",
"TypeError",
":",
"caller",
".",
"msg",
"(",
"ret",
",",
"options",
"=",
"{",
"\"raw\"",
":",
"True",
"}",
")"
] | [
147,
0
] | [
212,
50
] | python | en | ['en', 'error', 'th'] | False |
format_script_list | (scripts) | Takes a list of scripts and formats the output. | Takes a list of scripts and formats the output. | def format_script_list(scripts):
"""Takes a list of scripts and formats the output."""
if not scripts:
return "<No scripts>"
table = EvTable("|wdbref|n", "|wobj|n", "|wkey|n", "|wintval|n", "|wnext|n",
"|wrept|n", "|wdb", "|wtypeclass|n", "|wdesc|n",
align='r', border="tablecols")
for script in scripts:
nextrep = script.time_until_next_repeat()
if nextrep is None:
nextrep = "PAUS" if script.db._paused_time else "--"
else:
nextrep = "%ss" % nextrep
maxrepeat = script.repeats
if maxrepeat:
rept = "%i/%i" % (maxrepeat - script.remaining_repeats(), maxrepeat)
else:
rept = "-/-"
table.add_row(script.id,
script.obj.key if (hasattr(script, 'obj') and script.obj) else "<Global>",
script.key,
script.interval if script.interval > 0 else "--",
nextrep,
rept,
"*" if script.persistent else "-",
script.typeclass_path.rsplit('.', 1)[-1],
crop(script.desc, width=20))
return "%s" % table | [
"def",
"format_script_list",
"(",
"scripts",
")",
":",
"if",
"not",
"scripts",
":",
"return",
"\"<No scripts>\"",
"table",
"=",
"EvTable",
"(",
"\"|wdbref|n\"",
",",
"\"|wobj|n\"",
",",
"\"|wkey|n\"",
",",
"\"|wintval|n\"",
",",
"\"|wnext|n\"",
",",
"\"|wrept|n\"",
",",
"\"|wdb\"",
",",
"\"|wtypeclass|n\"",
",",
"\"|wdesc|n\"",
",",
"align",
"=",
"'r'",
",",
"border",
"=",
"\"tablecols\"",
")",
"for",
"script",
"in",
"scripts",
":",
"nextrep",
"=",
"script",
".",
"time_until_next_repeat",
"(",
")",
"if",
"nextrep",
"is",
"None",
":",
"nextrep",
"=",
"\"PAUS\"",
"if",
"script",
".",
"db",
".",
"_paused_time",
"else",
"\"--\"",
"else",
":",
"nextrep",
"=",
"\"%ss\"",
"%",
"nextrep",
"maxrepeat",
"=",
"script",
".",
"repeats",
"if",
"maxrepeat",
":",
"rept",
"=",
"\"%i/%i\"",
"%",
"(",
"maxrepeat",
"-",
"script",
".",
"remaining_repeats",
"(",
")",
",",
"maxrepeat",
")",
"else",
":",
"rept",
"=",
"\"-/-\"",
"table",
".",
"add_row",
"(",
"script",
".",
"id",
",",
"script",
".",
"obj",
".",
"key",
"if",
"(",
"hasattr",
"(",
"script",
",",
"'obj'",
")",
"and",
"script",
".",
"obj",
")",
"else",
"\"<Global>\"",
",",
"script",
".",
"key",
",",
"script",
".",
"interval",
"if",
"script",
".",
"interval",
">",
"0",
"else",
"\"--\"",
",",
"nextrep",
",",
"rept",
",",
"\"*\"",
"if",
"script",
".",
"persistent",
"else",
"\"-\"",
",",
"script",
".",
"typeclass_path",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"[",
"-",
"1",
"]",
",",
"crop",
"(",
"script",
".",
"desc",
",",
"width",
"=",
"20",
")",
")",
"return",
"\"%s\"",
"%",
"table"
] | [
275,
0
] | [
305,
23
] | python | en | ['en', 'en', 'en'] | True |
CmdReload.func | (self) |
Reload the system.
|
Reload the system.
| def func(self):
"""
Reload the system.
"""
reason = ""
if self.args:
reason = "(Reason: %s) " % self.args.rstrip(".")
SESSIONS.announce_all(" Server restart initiated %s..." % reason)
SESSIONS.portal_restart_server() | [
"def",
"func",
"(",
"self",
")",
":",
"reason",
"=",
"\"\"",
"if",
"self",
".",
"args",
":",
"reason",
"=",
"\"(Reason: %s) \"",
"%",
"self",
".",
"args",
".",
"rstrip",
"(",
"\".\"",
")",
"SESSIONS",
".",
"announce_all",
"(",
"\" Server restart initiated %s...\"",
"%",
"reason",
")",
"SESSIONS",
".",
"portal_restart_server",
"(",
")"
] | [
52,
4
] | [
60,
40
] | python | en | ['en', 'error', 'th'] | False |
CmdReset.func | (self) |
Reload the system.
|
Reload the system.
| def func(self):
"""
Reload the system.
"""
SESSIONS.announce_all(" Server resetting/restarting ...")
SESSIONS.portal_reset_server() | [
"def",
"func",
"(",
"self",
")",
":",
"SESSIONS",
".",
"announce_all",
"(",
"\" Server resetting/restarting ...\"",
")",
"SESSIONS",
".",
"portal_reset_server",
"(",
")"
] | [
88,
4
] | [
93,
38
] | python | en | ['en', 'error', 'th'] | False |
CmdShutdown.func | (self) | Define function | Define function | def func(self):
"""Define function"""
# Only allow shutdown if caller has session
if not self.caller.sessions.get():
return
self.msg('Shutting down server ...')
announcement = "\nServer is being SHUT DOWN!\n"
if self.args:
announcement += "%s\n" % self.args
logger.log_info('Server shutdown by %s.' % self.caller.name)
SESSIONS.announce_all(announcement)
SESSIONS.portal_shutdown() | [
"def",
"func",
"(",
"self",
")",
":",
"# Only allow shutdown if caller has session",
"if",
"not",
"self",
".",
"caller",
".",
"sessions",
".",
"get",
"(",
")",
":",
"return",
"self",
".",
"msg",
"(",
"'Shutting down server ...'",
")",
"announcement",
"=",
"\"\\nServer is being SHUT DOWN!\\n\"",
"if",
"self",
".",
"args",
":",
"announcement",
"+=",
"\"%s\\n\"",
"%",
"self",
".",
"args",
"logger",
".",
"log_info",
"(",
"'Server shutdown by %s.'",
"%",
"self",
".",
"caller",
".",
"name",
")",
"SESSIONS",
".",
"announce_all",
"(",
"announcement",
")",
"SESSIONS",
".",
"portal_shutdown",
"(",
")"
] | [
110,
4
] | [
121,
34
] | python | da | ['da', 'de', 'en'] | False |
CmdPy.func | (self) | hook function | hook function | def func(self):
"""hook function"""
caller = self.caller
pycode = self.args
if "edit" in self.switches:
caller.db._py_measure_time = "time" in self.switches
EvEditor(self.caller, loadfunc=_py_load, savefunc=_py_code,
quitfunc=_py_quit, key="Python exec: :w or :!", persistent=True,
codefunc=_py_code)
return
if not pycode:
string = "Usage: @py <code>"
self.msg(string)
return
_run_code_snippet(caller, self.args, measure_time="time" in self.switches) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"pycode",
"=",
"self",
".",
"args",
"if",
"\"edit\"",
"in",
"self",
".",
"switches",
":",
"caller",
".",
"db",
".",
"_py_measure_time",
"=",
"\"time\"",
"in",
"self",
".",
"switches",
"EvEditor",
"(",
"self",
".",
"caller",
",",
"loadfunc",
"=",
"_py_load",
",",
"savefunc",
"=",
"_py_code",
",",
"quitfunc",
"=",
"_py_quit",
",",
"key",
"=",
"\"Python exec: :w or :!\"",
",",
"persistent",
"=",
"True",
",",
"codefunc",
"=",
"_py_code",
")",
"return",
"if",
"not",
"pycode",
":",
"string",
"=",
"\"Usage: @py <code>\"",
"self",
".",
"msg",
"(",
"string",
")",
"return",
"_run_code_snippet",
"(",
"caller",
",",
"self",
".",
"args",
",",
"measure_time",
"=",
"\"time\"",
"in",
"self",
".",
"switches",
")"
] | [
251,
4
] | [
269,
82
] | python | en | ['en', 'af', 'en'] | False |
CmdScripts.func | (self) | implement method | implement method | def func(self):
"""implement method"""
caller = self.caller
args = self.args
if args:
if "start" in self.switches:
# global script-start mode
new_script = create.create_script(args)
if new_script:
caller.msg("Global script %s was started successfully." % args)
else:
caller.msg("Global script %s could not start correctly. See logs." % args)
return
# test first if this is a script match
scripts = ScriptDB.objects.get_all_scripts(key=args)
if not scripts:
# try to find an object instead.
objects = ObjectDB.objects.object_search(args)
if objects:
scripts = []
for obj in objects:
# get all scripts on the object(s)
scripts.extend(ScriptDB.objects.get_all_scripts_on_obj(obj))
else:
# we want all scripts.
scripts = ScriptDB.objects.get_all_scripts()
if not scripts:
caller.msg("No scripts are running.")
return
if not scripts:
string = "No scripts found with a key '%s', or on an object named '%s'." % (args, args)
caller.msg(string)
return
if self.switches and self.switches[0] in ('stop', 'del', 'delete', 'kill'):
# we want to delete something
if len(scripts) == 1:
# we have a unique match!
if 'kill' in self.switches:
string = "Killing script '%s'" % scripts[0].key
scripts[0].stop(kill=True)
else:
string = "Stopping script '%s'." % scripts[0].key
scripts[0].stop()
# import pdb # DEBUG
# pdb.set_trace() # DEBUG
ScriptDB.objects.validate() # just to be sure all is synced
else:
# multiple matches.
string = "Multiple script matches. Please refine your search:\n"
string += format_script_list(scripts)
elif self.switches and self.switches[0] in ("validate", "valid", "val"):
# run validation on all found scripts
nr_started, nr_stopped = ScriptDB.objects.validate(scripts=scripts)
string = "Validated %s scripts. " % ScriptDB.objects.all().count()
string += "Started %s and stopped %s scripts." % (nr_started, nr_stopped)
else:
# No stopping or validation. We just want to view things.
string = format_script_list(scripts)
caller.msg(string) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"args",
"=",
"self",
".",
"args",
"if",
"args",
":",
"if",
"\"start\"",
"in",
"self",
".",
"switches",
":",
"# global script-start mode",
"new_script",
"=",
"create",
".",
"create_script",
"(",
"args",
")",
"if",
"new_script",
":",
"caller",
".",
"msg",
"(",
"\"Global script %s was started successfully.\"",
"%",
"args",
")",
"else",
":",
"caller",
".",
"msg",
"(",
"\"Global script %s could not start correctly. See logs.\"",
"%",
"args",
")",
"return",
"# test first if this is a script match",
"scripts",
"=",
"ScriptDB",
".",
"objects",
".",
"get_all_scripts",
"(",
"key",
"=",
"args",
")",
"if",
"not",
"scripts",
":",
"# try to find an object instead.",
"objects",
"=",
"ObjectDB",
".",
"objects",
".",
"object_search",
"(",
"args",
")",
"if",
"objects",
":",
"scripts",
"=",
"[",
"]",
"for",
"obj",
"in",
"objects",
":",
"# get all scripts on the object(s)",
"scripts",
".",
"extend",
"(",
"ScriptDB",
".",
"objects",
".",
"get_all_scripts_on_obj",
"(",
"obj",
")",
")",
"else",
":",
"# we want all scripts.",
"scripts",
"=",
"ScriptDB",
".",
"objects",
".",
"get_all_scripts",
"(",
")",
"if",
"not",
"scripts",
":",
"caller",
".",
"msg",
"(",
"\"No scripts are running.\"",
")",
"return",
"if",
"not",
"scripts",
":",
"string",
"=",
"\"No scripts found with a key '%s', or on an object named '%s'.\"",
"%",
"(",
"args",
",",
"args",
")",
"caller",
".",
"msg",
"(",
"string",
")",
"return",
"if",
"self",
".",
"switches",
"and",
"self",
".",
"switches",
"[",
"0",
"]",
"in",
"(",
"'stop'",
",",
"'del'",
",",
"'delete'",
",",
"'kill'",
")",
":",
"# we want to delete something",
"if",
"len",
"(",
"scripts",
")",
"==",
"1",
":",
"# we have a unique match!",
"if",
"'kill'",
"in",
"self",
".",
"switches",
":",
"string",
"=",
"\"Killing script '%s'\"",
"%",
"scripts",
"[",
"0",
"]",
".",
"key",
"scripts",
"[",
"0",
"]",
".",
"stop",
"(",
"kill",
"=",
"True",
")",
"else",
":",
"string",
"=",
"\"Stopping script '%s'.\"",
"%",
"scripts",
"[",
"0",
"]",
".",
"key",
"scripts",
"[",
"0",
"]",
".",
"stop",
"(",
")",
"# import pdb # DEBUG",
"# pdb.set_trace() # DEBUG",
"ScriptDB",
".",
"objects",
".",
"validate",
"(",
")",
"# just to be sure all is synced",
"else",
":",
"# multiple matches.",
"string",
"=",
"\"Multiple script matches. Please refine your search:\\n\"",
"string",
"+=",
"format_script_list",
"(",
"scripts",
")",
"elif",
"self",
".",
"switches",
"and",
"self",
".",
"switches",
"[",
"0",
"]",
"in",
"(",
"\"validate\"",
",",
"\"valid\"",
",",
"\"val\"",
")",
":",
"# run validation on all found scripts",
"nr_started",
",",
"nr_stopped",
"=",
"ScriptDB",
".",
"objects",
".",
"validate",
"(",
"scripts",
"=",
"scripts",
")",
"string",
"=",
"\"Validated %s scripts. \"",
"%",
"ScriptDB",
".",
"objects",
".",
"all",
"(",
")",
".",
"count",
"(",
")",
"string",
"+=",
"\"Started %s and stopped %s scripts.\"",
"%",
"(",
"nr_started",
",",
"nr_stopped",
")",
"else",
":",
"# No stopping or validation. We just want to view things.",
"string",
"=",
"format_script_list",
"(",
"scripts",
")",
"caller",
".",
"msg",
"(",
"string",
")"
] | [
335,
4
] | [
398,
26
] | python | en | ['en', 'sr', 'en'] | False |
CmdObjects.func | (self) | Implement the command | Implement the command | def func(self):
"""Implement the command"""
caller = self.caller
nlim = int(self.args) if self.args and self.args.isdigit() else 10
nobjs = ObjectDB.objects.count()
base_char_typeclass = settings.BASE_CHARACTER_TYPECLASS
nchars = ObjectDB.objects.filter(db_typeclass_path=base_char_typeclass).count()
nrooms = ObjectDB.objects.filter(db_location__isnull=True).exclude(
db_typeclass_path=base_char_typeclass).count()
nexits = ObjectDB.objects.filter(db_location__isnull=False, db_destination__isnull=False).count()
nother = nobjs - nchars - nrooms - nexits
nobjs = nobjs or 1 # fix zero-div error with empty database
# total object sum table
totaltable = EvTable("|wtype|n", "|wcomment|n", "|wcount|n", "|w%%|n", border="table", align="l")
totaltable.align = 'l'
totaltable.add_row("Characters", "(BASE_CHARACTER_TYPECLASS)", nchars, "%.2f" % ((float(nchars) / nobjs) * 100))
totaltable.add_row("Rooms", "(location=None)", nrooms, "%.2f" % ((float(nrooms) / nobjs) * 100))
totaltable.add_row("Exits", "(destination!=None)", nexits, "%.2f" % ((float(nexits) / nobjs) * 100))
totaltable.add_row("Other", "", nother, "%.2f" % ((float(nother) / nobjs) * 100))
# typeclass table
typetable = EvTable("|wtypeclass|n", "|wcount|n", "|w%%|n", border="table", align="l")
typetable.align = 'l'
dbtotals = ObjectDB.objects.object_totals()
for path, count in dbtotals.items():
typetable.add_row(path, count, "%.2f" % ((float(count) / nobjs) * 100))
# last N table
objs = ObjectDB.objects.all().order_by("db_date_created")[max(0, nobjs - nlim):]
latesttable = EvTable("|wcreated|n", "|wdbref|n", "|wname|n", "|wtypeclass|n", align="l", border="table")
latesttable.align = 'l'
for obj in objs:
latesttable.add_row(utils.datetime_format(obj.date_created),
obj.dbref, obj.key, obj.path)
string = "\n|wObject subtype totals (out of %i Objects):|n\n%s" % (nobjs, totaltable)
string += "\n|wObject typeclass distribution:|n\n%s" % typetable
string += "\n|wLast %s Objects created:|n\n%s" % (min(nobjs, nlim), latesttable)
caller.msg(string) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"nlim",
"=",
"int",
"(",
"self",
".",
"args",
")",
"if",
"self",
".",
"args",
"and",
"self",
".",
"args",
".",
"isdigit",
"(",
")",
"else",
"10",
"nobjs",
"=",
"ObjectDB",
".",
"objects",
".",
"count",
"(",
")",
"base_char_typeclass",
"=",
"settings",
".",
"BASE_CHARACTER_TYPECLASS",
"nchars",
"=",
"ObjectDB",
".",
"objects",
".",
"filter",
"(",
"db_typeclass_path",
"=",
"base_char_typeclass",
")",
".",
"count",
"(",
")",
"nrooms",
"=",
"ObjectDB",
".",
"objects",
".",
"filter",
"(",
"db_location__isnull",
"=",
"True",
")",
".",
"exclude",
"(",
"db_typeclass_path",
"=",
"base_char_typeclass",
")",
".",
"count",
"(",
")",
"nexits",
"=",
"ObjectDB",
".",
"objects",
".",
"filter",
"(",
"db_location__isnull",
"=",
"False",
",",
"db_destination__isnull",
"=",
"False",
")",
".",
"count",
"(",
")",
"nother",
"=",
"nobjs",
"-",
"nchars",
"-",
"nrooms",
"-",
"nexits",
"nobjs",
"=",
"nobjs",
"or",
"1",
"# fix zero-div error with empty database",
"# total object sum table",
"totaltable",
"=",
"EvTable",
"(",
"\"|wtype|n\"",
",",
"\"|wcomment|n\"",
",",
"\"|wcount|n\"",
",",
"\"|w%%|n\"",
",",
"border",
"=",
"\"table\"",
",",
"align",
"=",
"\"l\"",
")",
"totaltable",
".",
"align",
"=",
"'l'",
"totaltable",
".",
"add_row",
"(",
"\"Characters\"",
",",
"\"(BASE_CHARACTER_TYPECLASS)\"",
",",
"nchars",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"nchars",
")",
"/",
"nobjs",
")",
"*",
"100",
")",
")",
"totaltable",
".",
"add_row",
"(",
"\"Rooms\"",
",",
"\"(location=None)\"",
",",
"nrooms",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"nrooms",
")",
"/",
"nobjs",
")",
"*",
"100",
")",
")",
"totaltable",
".",
"add_row",
"(",
"\"Exits\"",
",",
"\"(destination!=None)\"",
",",
"nexits",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"nexits",
")",
"/",
"nobjs",
")",
"*",
"100",
")",
")",
"totaltable",
".",
"add_row",
"(",
"\"Other\"",
",",
"\"\"",
",",
"nother",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"nother",
")",
"/",
"nobjs",
")",
"*",
"100",
")",
")",
"# typeclass table",
"typetable",
"=",
"EvTable",
"(",
"\"|wtypeclass|n\"",
",",
"\"|wcount|n\"",
",",
"\"|w%%|n\"",
",",
"border",
"=",
"\"table\"",
",",
"align",
"=",
"\"l\"",
")",
"typetable",
".",
"align",
"=",
"'l'",
"dbtotals",
"=",
"ObjectDB",
".",
"objects",
".",
"object_totals",
"(",
")",
"for",
"path",
",",
"count",
"in",
"dbtotals",
".",
"items",
"(",
")",
":",
"typetable",
".",
"add_row",
"(",
"path",
",",
"count",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"count",
")",
"/",
"nobjs",
")",
"*",
"100",
")",
")",
"# last N table",
"objs",
"=",
"ObjectDB",
".",
"objects",
".",
"all",
"(",
")",
".",
"order_by",
"(",
"\"db_date_created\"",
")",
"[",
"max",
"(",
"0",
",",
"nobjs",
"-",
"nlim",
")",
":",
"]",
"latesttable",
"=",
"EvTable",
"(",
"\"|wcreated|n\"",
",",
"\"|wdbref|n\"",
",",
"\"|wname|n\"",
",",
"\"|wtypeclass|n\"",
",",
"align",
"=",
"\"l\"",
",",
"border",
"=",
"\"table\"",
")",
"latesttable",
".",
"align",
"=",
"'l'",
"for",
"obj",
"in",
"objs",
":",
"latesttable",
".",
"add_row",
"(",
"utils",
".",
"datetime_format",
"(",
"obj",
".",
"date_created",
")",
",",
"obj",
".",
"dbref",
",",
"obj",
".",
"key",
",",
"obj",
".",
"path",
")",
"string",
"=",
"\"\\n|wObject subtype totals (out of %i Objects):|n\\n%s\"",
"%",
"(",
"nobjs",
",",
"totaltable",
")",
"string",
"+=",
"\"\\n|wObject typeclass distribution:|n\\n%s\"",
"%",
"typetable",
"string",
"+=",
"\"\\n|wLast %s Objects created:|n\\n%s\"",
"%",
"(",
"min",
"(",
"nobjs",
",",
"nlim",
")",
",",
"latesttable",
")",
"caller",
".",
"msg",
"(",
"string",
")"
] | [
417,
4
] | [
457,
26
] | python | en | ['en', 'en', 'en'] | True |
CmdAccounts.func | (self) | List the accounts | List the accounts | def func(self):
"""List the accounts"""
caller = self.caller
if self.args and self.args.isdigit():
nlim = int(self.args)
else:
nlim = 10
naccounts = AccountDB.objects.count()
# typeclass table
dbtotals = AccountDB.objects.object_totals()
typetable = EvTable("|wtypeclass|n", "|wcount|n", "|w%%|n", border="cells", align="l")
for path, count in dbtotals.items():
typetable.add_row(path, count, "%.2f" % ((float(count) / naccounts) * 100))
# last N table
plyrs = AccountDB.objects.all().order_by("db_date_created")[max(0, naccounts - nlim):]
latesttable = EvTable("|wcreated|n", "|wdbref|n", "|wname|n", "|wtypeclass|n", border="cells", align="l")
for ply in plyrs:
latesttable.add_row(utils.datetime_format(ply.date_created), ply.dbref, ply.key, ply.path)
string = "\n|wAccount typeclass distribution:|n\n%s" % typetable
string += "\n|wLast %s Accounts created:|n\n%s" % (min(naccounts, nlim), latesttable)
caller.msg(string) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"if",
"self",
".",
"args",
"and",
"self",
".",
"args",
".",
"isdigit",
"(",
")",
":",
"nlim",
"=",
"int",
"(",
"self",
".",
"args",
")",
"else",
":",
"nlim",
"=",
"10",
"naccounts",
"=",
"AccountDB",
".",
"objects",
".",
"count",
"(",
")",
"# typeclass table",
"dbtotals",
"=",
"AccountDB",
".",
"objects",
".",
"object_totals",
"(",
")",
"typetable",
"=",
"EvTable",
"(",
"\"|wtypeclass|n\"",
",",
"\"|wcount|n\"",
",",
"\"|w%%|n\"",
",",
"border",
"=",
"\"cells\"",
",",
"align",
"=",
"\"l\"",
")",
"for",
"path",
",",
"count",
"in",
"dbtotals",
".",
"items",
"(",
")",
":",
"typetable",
".",
"add_row",
"(",
"path",
",",
"count",
",",
"\"%.2f\"",
"%",
"(",
"(",
"float",
"(",
"count",
")",
"/",
"naccounts",
")",
"*",
"100",
")",
")",
"# last N table",
"plyrs",
"=",
"AccountDB",
".",
"objects",
".",
"all",
"(",
")",
".",
"order_by",
"(",
"\"db_date_created\"",
")",
"[",
"max",
"(",
"0",
",",
"naccounts",
"-",
"nlim",
")",
":",
"]",
"latesttable",
"=",
"EvTable",
"(",
"\"|wcreated|n\"",
",",
"\"|wdbref|n\"",
",",
"\"|wname|n\"",
",",
"\"|wtypeclass|n\"",
",",
"border",
"=",
"\"cells\"",
",",
"align",
"=",
"\"l\"",
")",
"for",
"ply",
"in",
"plyrs",
":",
"latesttable",
".",
"add_row",
"(",
"utils",
".",
"datetime_format",
"(",
"ply",
".",
"date_created",
")",
",",
"ply",
".",
"dbref",
",",
"ply",
".",
"key",
",",
"ply",
".",
"path",
")",
"string",
"=",
"\"\\n|wAccount typeclass distribution:|n\\n%s\"",
"%",
"typetable",
"string",
"+=",
"\"\\n|wLast %s Accounts created:|n\\n%s\"",
"%",
"(",
"min",
"(",
"naccounts",
",",
"nlim",
")",
",",
"latesttable",
")",
"caller",
".",
"msg",
"(",
"string",
")"
] | [
476,
4
] | [
500,
26
] | python | en | ['en', 'ga', 'en'] | True |
CmdService.func | (self) | Implement command | Implement command | def func(self):
"""Implement command"""
caller = self.caller
switches = self.switches
if switches and switches[0] not in ("list", "start", "stop", "delete"):
caller.msg("Usage: @service/<list|start|stop|delete> [servicename]")
return
# get all services
service_collection = SESSIONS.server.services
if not switches or switches[0] == "list":
# Just display the list of installed services and their
# status, then exit.
table = EvTable("|wService|n (use @services/start|stop|delete)", "|wstatus", align="l")
for service in service_collection.services:
table.add_row(service.name, service.running and "|gRunning" or "|rNot Running")
caller.msg(unicode(table))
return
# Get the service to start / stop
try:
service = service_collection.getServiceNamed(self.args)
except Exception:
string = 'Invalid service name. This command is case-sensitive. '
string += 'See @service/list for valid service name (enter the full name exactly).'
caller.msg(string)
return
if switches[0] in ("stop", "delete"):
# Stopping/killing a service gracefully closes it and disconnects
# any connections (if applicable).
delmode = switches[0] == "delete"
if not service.running:
caller.msg('That service is not currently running.')
return
if service.name[:7] == 'Evennia':
if delmode:
caller.msg("You cannot remove a core Evennia service (named 'Evennia***').")
return
string = "You seem to be shutting down a core Evennia service (named 'Evennia***'). Note that"
string += "stopping some TCP port services will *not* disconnect users *already*"
string += "connected on those ports, but *may* instead cause spurious errors for them. To "
string += "safely and permanently remove ports, change settings file and restart the server."
caller.msg(string)
if delmode:
service.stopService()
service_collection.removeService(service)
caller.msg("Stopped and removed service '%s'." % self.args)
else:
service.stopService()
caller.msg("Stopped service '%s'." % self.args)
return
if switches[0] == "start":
# Attempt to start a service.
if service.running:
caller.msg('That service is already running.')
return
caller.msg("Starting service '%s'." % self.args)
service.startService() | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"switches",
"=",
"self",
".",
"switches",
"if",
"switches",
"and",
"switches",
"[",
"0",
"]",
"not",
"in",
"(",
"\"list\"",
",",
"\"start\"",
",",
"\"stop\"",
",",
"\"delete\"",
")",
":",
"caller",
".",
"msg",
"(",
"\"Usage: @service/<list|start|stop|delete> [servicename]\"",
")",
"return",
"# get all services",
"service_collection",
"=",
"SESSIONS",
".",
"server",
".",
"services",
"if",
"not",
"switches",
"or",
"switches",
"[",
"0",
"]",
"==",
"\"list\"",
":",
"# Just display the list of installed services and their",
"# status, then exit.",
"table",
"=",
"EvTable",
"(",
"\"|wService|n (use @services/start|stop|delete)\"",
",",
"\"|wstatus\"",
",",
"align",
"=",
"\"l\"",
")",
"for",
"service",
"in",
"service_collection",
".",
"services",
":",
"table",
".",
"add_row",
"(",
"service",
".",
"name",
",",
"service",
".",
"running",
"and",
"\"|gRunning\"",
"or",
"\"|rNot Running\"",
")",
"caller",
".",
"msg",
"(",
"unicode",
"(",
"table",
")",
")",
"return",
"# Get the service to start / stop",
"try",
":",
"service",
"=",
"service_collection",
".",
"getServiceNamed",
"(",
"self",
".",
"args",
")",
"except",
"Exception",
":",
"string",
"=",
"'Invalid service name. This command is case-sensitive. '",
"string",
"+=",
"'See @service/list for valid service name (enter the full name exactly).'",
"caller",
".",
"msg",
"(",
"string",
")",
"return",
"if",
"switches",
"[",
"0",
"]",
"in",
"(",
"\"stop\"",
",",
"\"delete\"",
")",
":",
"# Stopping/killing a service gracefully closes it and disconnects",
"# any connections (if applicable).",
"delmode",
"=",
"switches",
"[",
"0",
"]",
"==",
"\"delete\"",
"if",
"not",
"service",
".",
"running",
":",
"caller",
".",
"msg",
"(",
"'That service is not currently running.'",
")",
"return",
"if",
"service",
".",
"name",
"[",
":",
"7",
"]",
"==",
"'Evennia'",
":",
"if",
"delmode",
":",
"caller",
".",
"msg",
"(",
"\"You cannot remove a core Evennia service (named 'Evennia***').\"",
")",
"return",
"string",
"=",
"\"You seem to be shutting down a core Evennia service (named 'Evennia***'). Note that\"",
"string",
"+=",
"\"stopping some TCP port services will *not* disconnect users *already*\"",
"string",
"+=",
"\"connected on those ports, but *may* instead cause spurious errors for them. To \"",
"string",
"+=",
"\"safely and permanently remove ports, change settings file and restart the server.\"",
"caller",
".",
"msg",
"(",
"string",
")",
"if",
"delmode",
":",
"service",
".",
"stopService",
"(",
")",
"service_collection",
".",
"removeService",
"(",
"service",
")",
"caller",
".",
"msg",
"(",
"\"Stopped and removed service '%s'.\"",
"%",
"self",
".",
"args",
")",
"else",
":",
"service",
".",
"stopService",
"(",
")",
"caller",
".",
"msg",
"(",
"\"Stopped service '%s'.\"",
"%",
"self",
".",
"args",
")",
"return",
"if",
"switches",
"[",
"0",
"]",
"==",
"\"start\"",
":",
"# Attempt to start a service.",
"if",
"service",
".",
"running",
":",
"caller",
".",
"msg",
"(",
"'That service is already running.'",
")",
"return",
"caller",
".",
"msg",
"(",
"\"Starting service '%s'.\"",
"%",
"self",
".",
"args",
")",
"service",
".",
"startService",
"(",
")"
] | [
529,
4
] | [
594,
34
] | python | en | ['en', 'en', 'en'] | False |
CmdAbout.func | (self) | Display information about server or target | Display information about server or target | def func(self):
"""Display information about server or target"""
string = """
|cEvennia|n {version}|n
MU* development system
|wLicence|n https://opensource.org/licenses/BSD-3-Clause
|wWeb|n http://www.evennia.com
|wIrc|n #evennia on irc.freenode.net:6667
|wForum|n http://www.evennia.com/discussions
|wMaintainer|n (2010-) Griatch (griatch AT gmail DOT com)
|wMaintainer|n (2006-10) Greg Taylor
|wOS|n {os}
|wPython|n {python}
|wTwisted|n {twisted}
|wDjango|n {django}
""".format(version=utils.get_evennia_version(),
os=os.name,
python=sys.version.split()[0],
twisted=twisted.version.short(),
django=django.get_version())
self.caller.msg(string) | [
"def",
"func",
"(",
"self",
")",
":",
"string",
"=",
"\"\"\"\n |cEvennia|n {version}|n\n MU* development system\n\n |wLicence|n https://opensource.org/licenses/BSD-3-Clause\n |wWeb|n http://www.evennia.com\n |wIrc|n #evennia on irc.freenode.net:6667\n |wForum|n http://www.evennia.com/discussions\n |wMaintainer|n (2010-) Griatch (griatch AT gmail DOT com)\n |wMaintainer|n (2006-10) Greg Taylor\n\n |wOS|n {os}\n |wPython|n {python}\n |wTwisted|n {twisted}\n |wDjango|n {django}\n \"\"\"",
".",
"format",
"(",
"version",
"=",
"utils",
".",
"get_evennia_version",
"(",
")",
",",
"os",
"=",
"os",
".",
"name",
",",
"python",
"=",
"sys",
".",
"version",
".",
"split",
"(",
")",
"[",
"0",
"]",
",",
"twisted",
"=",
"twisted",
".",
"version",
".",
"short",
"(",
")",
",",
"django",
"=",
"django",
".",
"get_version",
"(",
")",
")",
"self",
".",
"caller",
".",
"msg",
"(",
"string",
")"
] | [
612,
4
] | [
635,
31
] | python | en | ['en', 'en', 'en'] | True |
CmdTime.func | (self) | Show server time data in a table. | Show server time data in a table. | def func(self):
"""Show server time data in a table."""
table1 = EvTable("|wServer time", "", align="l", width=78)
table1.add_row("Current uptime", utils.time_format(gametime.uptime(), 3))
table1.add_row("Total runtime", utils.time_format(gametime.runtime(), 2))
table1.add_row("First start", datetime.datetime.fromtimestamp(gametime.server_epoch()))
table1.add_row("Current time", datetime.datetime.now())
table1.reformat_column(0, width=30)
table2 = EvTable("|wIn-Game time", "|wReal time x %g" % gametime.TIMEFACTOR, align="l", width=77, border_top=0)
epochtxt = "Epoch (%s)" % ("from settings" if settings.TIME_GAME_EPOCH else "server start")
table2.add_row(epochtxt, datetime.datetime.fromtimestamp(gametime.game_epoch()))
table2.add_row("Total time passed:", utils.time_format(gametime.gametime(), 2))
table2.add_row("Current time ", datetime.datetime.fromtimestamp(gametime.gametime(absolute=True)))
table2.reformat_column(0, width=30)
self.caller.msg(unicode(table1) + "\n" + unicode(table2)) | [
"def",
"func",
"(",
"self",
")",
":",
"table1",
"=",
"EvTable",
"(",
"\"|wServer time\"",
",",
"\"\"",
",",
"align",
"=",
"\"l\"",
",",
"width",
"=",
"78",
")",
"table1",
".",
"add_row",
"(",
"\"Current uptime\"",
",",
"utils",
".",
"time_format",
"(",
"gametime",
".",
"uptime",
"(",
")",
",",
"3",
")",
")",
"table1",
".",
"add_row",
"(",
"\"Total runtime\"",
",",
"utils",
".",
"time_format",
"(",
"gametime",
".",
"runtime",
"(",
")",
",",
"2",
")",
")",
"table1",
".",
"add_row",
"(",
"\"First start\"",
",",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"gametime",
".",
"server_epoch",
"(",
")",
")",
")",
"table1",
".",
"add_row",
"(",
"\"Current time\"",
",",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
")",
"table1",
".",
"reformat_column",
"(",
"0",
",",
"width",
"=",
"30",
")",
"table2",
"=",
"EvTable",
"(",
"\"|wIn-Game time\"",
",",
"\"|wReal time x %g\"",
"%",
"gametime",
".",
"TIMEFACTOR",
",",
"align",
"=",
"\"l\"",
",",
"width",
"=",
"77",
",",
"border_top",
"=",
"0",
")",
"epochtxt",
"=",
"\"Epoch (%s)\"",
"%",
"(",
"\"from settings\"",
"if",
"settings",
".",
"TIME_GAME_EPOCH",
"else",
"\"server start\"",
")",
"table2",
".",
"add_row",
"(",
"epochtxt",
",",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"gametime",
".",
"game_epoch",
"(",
")",
")",
")",
"table2",
".",
"add_row",
"(",
"\"Total time passed:\"",
",",
"utils",
".",
"time_format",
"(",
"gametime",
".",
"gametime",
"(",
")",
",",
"2",
")",
")",
"table2",
".",
"add_row",
"(",
"\"Current time \"",
",",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"gametime",
".",
"gametime",
"(",
"absolute",
"=",
"True",
")",
")",
")",
"table2",
".",
"reformat_column",
"(",
"0",
",",
"width",
"=",
"30",
")",
"self",
".",
"caller",
".",
"msg",
"(",
"unicode",
"(",
"table1",
")",
"+",
"\"\\n\"",
"+",
"unicode",
"(",
"table2",
")",
")"
] | [
653,
4
] | [
667,
65
] | python | en | ['en', 'en', 'en'] | True |
Font.color | (self) |
The 'color' 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
Returns
-------
str
|
The 'color' 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 | def color(self):
"""
The 'color' 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
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
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".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets the font of the slider step labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.slider.Font`
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".
size
Returns
-------
Font
|
Construct a new Font object
Sets the font of the slider step labels. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets the font of the slider step labels.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.slider.Font`
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".
size
Returns
-------
Font
"""
super(Font, self).__init__("font")
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.layout.slider.Font
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.slider.Font`"""
)
# 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("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",
")",
"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.layout.slider.Font \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.layout.slider.Font`\"\"\"",
")",
"# 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",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' 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
Returns
-------
str
|
The 'color' 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 | def color(self):
"""
The 'color' 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
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
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".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.parcats.line.c
olorbar.title.Font`
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".
size
Returns
-------
Font
|
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.parcats.line.c
olorbar.title.Font`
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".
size
Returns
-------
Font
"""
super(Font, self).__init__("font")
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.parcats.line.colorbar.title.Font
constructor must be a dict or
an instance of :class:`plotly.graph_objs.parcats.line.colorbar.title.Font`"""
)
# 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("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",
")",
"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.parcats.line.colorbar.title.Font \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.parcats.line.colorbar.title.Font`\"\"\"",
")",
"# 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",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
bbox_overlaps | (bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-6) | Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes1 and bboxes2.
Args:
bboxes1 (Tensor): shape (m, 4) in <x1, y1, x2, y2> format or empty.
bboxes2 (Tensor): shape (n, 4) in <x1, y1, x2, y2> format or empty.
If is_aligned is ``True``, then m and n must be equal.
mode (str): "iou" (intersection over union) or iof (intersection over
foreground).
Returns:
ious(Tensor): shape (m, n) if is_aligned == False else shape (m, 1)
Example:
>>> bboxes1 = torch.FloatTensor([
>>> [0, 0, 10, 10],
>>> [10, 10, 20, 20],
>>> [32, 32, 38, 42],
>>> ])
>>> bboxes2 = torch.FloatTensor([
>>> [0, 0, 10, 20],
>>> [0, 10, 10, 19],
>>> [10, 10, 20, 20],
>>> ])
>>> bbox_overlaps(bboxes1, bboxes2)
tensor([[0.5000, 0.0000, 0.0000],
[0.0000, 0.0000, 1.0000],
[0.0000, 0.0000, 0.0000]])
Example:
>>> empty = torch.FloatTensor([])
>>> nonempty = torch.FloatTensor([
>>> [0, 0, 10, 9],
>>> ])
>>> assert tuple(bbox_overlaps(empty, nonempty).shape) == (0, 1)
>>> assert tuple(bbox_overlaps(nonempty, empty).shape) == (1, 0)
>>> assert tuple(bbox_overlaps(empty, empty).shape) == (0, 0)
| Calculate overlap between two set of bboxes. | def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-6):
"""Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes1 and bboxes2.
Args:
bboxes1 (Tensor): shape (m, 4) in <x1, y1, x2, y2> format or empty.
bboxes2 (Tensor): shape (n, 4) in <x1, y1, x2, y2> format or empty.
If is_aligned is ``True``, then m and n must be equal.
mode (str): "iou" (intersection over union) or iof (intersection over
foreground).
Returns:
ious(Tensor): shape (m, n) if is_aligned == False else shape (m, 1)
Example:
>>> bboxes1 = torch.FloatTensor([
>>> [0, 0, 10, 10],
>>> [10, 10, 20, 20],
>>> [32, 32, 38, 42],
>>> ])
>>> bboxes2 = torch.FloatTensor([
>>> [0, 0, 10, 20],
>>> [0, 10, 10, 19],
>>> [10, 10, 20, 20],
>>> ])
>>> bbox_overlaps(bboxes1, bboxes2)
tensor([[0.5000, 0.0000, 0.0000],
[0.0000, 0.0000, 1.0000],
[0.0000, 0.0000, 0.0000]])
Example:
>>> empty = torch.FloatTensor([])
>>> nonempty = torch.FloatTensor([
>>> [0, 0, 10, 9],
>>> ])
>>> assert tuple(bbox_overlaps(empty, nonempty).shape) == (0, 1)
>>> assert tuple(bbox_overlaps(nonempty, empty).shape) == (1, 0)
>>> assert tuple(bbox_overlaps(empty, empty).shape) == (0, 0)
"""
assert mode in ['iou', 'iof']
# Either the boxes are empty or the length of boxes's last dimenstion is 4
assert (bboxes1.size(-1) == 4 or bboxes1.size(0) == 0)
assert (bboxes2.size(-1) == 4 or bboxes2.size(0) == 0)
rows = bboxes1.size(0)
cols = bboxes2.size(0)
if is_aligned:
assert rows == cols
if rows * cols == 0:
return bboxes1.new(rows, 1) if is_aligned else bboxes1.new(rows, cols)
if is_aligned:
lt = torch.max(bboxes1[:, :2], bboxes2[:, :2]) # [rows, 2]
rb = torch.min(bboxes1[:, 2:], bboxes2[:, 2:]) # [rows, 2]
wh = (rb - lt).clamp(min=0) # [rows, 2]
overlap = wh[:, 0] * wh[:, 1]
area1 = (bboxes1[:, 2] - bboxes1[:, 0]) * (
bboxes1[:, 3] - bboxes1[:, 1])
if mode == 'iou':
area2 = (bboxes2[:, 2] - bboxes2[:, 0]) * (
bboxes2[:, 3] - bboxes2[:, 1])
union = area1 + area2 - overlap
else:
union = area1
else:
lt = torch.max(bboxes1[:, None, :2], bboxes2[:, :2]) # [rows, cols, 2]
rb = torch.min(bboxes1[:, None, 2:], bboxes2[:, 2:]) # [rows, cols, 2]
wh = (rb - lt).clamp(min=0) # [rows, cols, 2]
overlap = wh[:, :, 0] * wh[:, :, 1]
area1 = (bboxes1[:, 2] - bboxes1[:, 0]) * (
bboxes1[:, 3] - bboxes1[:, 1])
if mode == 'iou':
area2 = (bboxes2[:, 2] - bboxes2[:, 0]) * (
bboxes2[:, 3] - bboxes2[:, 1])
union = area1[:, None] + area2 - overlap
else:
union = area1[:, None]
eps = union.new_tensor([eps])
union = torch.max(union, eps)
ious = overlap / union
return ious | [
"def",
"bbox_overlaps",
"(",
"bboxes1",
",",
"bboxes2",
",",
"mode",
"=",
"'iou'",
",",
"is_aligned",
"=",
"False",
",",
"eps",
"=",
"1e-6",
")",
":",
"assert",
"mode",
"in",
"[",
"'iou'",
",",
"'iof'",
"]",
"# Either the boxes are empty or the length of boxes's last dimenstion is 4",
"assert",
"(",
"bboxes1",
".",
"size",
"(",
"-",
"1",
")",
"==",
"4",
"or",
"bboxes1",
".",
"size",
"(",
"0",
")",
"==",
"0",
")",
"assert",
"(",
"bboxes2",
".",
"size",
"(",
"-",
"1",
")",
"==",
"4",
"or",
"bboxes2",
".",
"size",
"(",
"0",
")",
"==",
"0",
")",
"rows",
"=",
"bboxes1",
".",
"size",
"(",
"0",
")",
"cols",
"=",
"bboxes2",
".",
"size",
"(",
"0",
")",
"if",
"is_aligned",
":",
"assert",
"rows",
"==",
"cols",
"if",
"rows",
"*",
"cols",
"==",
"0",
":",
"return",
"bboxes1",
".",
"new",
"(",
"rows",
",",
"1",
")",
"if",
"is_aligned",
"else",
"bboxes1",
".",
"new",
"(",
"rows",
",",
"cols",
")",
"if",
"is_aligned",
":",
"lt",
"=",
"torch",
".",
"max",
"(",
"bboxes1",
"[",
":",
",",
":",
"2",
"]",
",",
"bboxes2",
"[",
":",
",",
":",
"2",
"]",
")",
"# [rows, 2]",
"rb",
"=",
"torch",
".",
"min",
"(",
"bboxes1",
"[",
":",
",",
"2",
":",
"]",
",",
"bboxes2",
"[",
":",
",",
"2",
":",
"]",
")",
"# [rows, 2]",
"wh",
"=",
"(",
"rb",
"-",
"lt",
")",
".",
"clamp",
"(",
"min",
"=",
"0",
")",
"# [rows, 2]",
"overlap",
"=",
"wh",
"[",
":",
",",
"0",
"]",
"*",
"wh",
"[",
":",
",",
"1",
"]",
"area1",
"=",
"(",
"bboxes1",
"[",
":",
",",
"2",
"]",
"-",
"bboxes1",
"[",
":",
",",
"0",
"]",
")",
"*",
"(",
"bboxes1",
"[",
":",
",",
"3",
"]",
"-",
"bboxes1",
"[",
":",
",",
"1",
"]",
")",
"if",
"mode",
"==",
"'iou'",
":",
"area2",
"=",
"(",
"bboxes2",
"[",
":",
",",
"2",
"]",
"-",
"bboxes2",
"[",
":",
",",
"0",
"]",
")",
"*",
"(",
"bboxes2",
"[",
":",
",",
"3",
"]",
"-",
"bboxes2",
"[",
":",
",",
"1",
"]",
")",
"union",
"=",
"area1",
"+",
"area2",
"-",
"overlap",
"else",
":",
"union",
"=",
"area1",
"else",
":",
"lt",
"=",
"torch",
".",
"max",
"(",
"bboxes1",
"[",
":",
",",
"None",
",",
":",
"2",
"]",
",",
"bboxes2",
"[",
":",
",",
":",
"2",
"]",
")",
"# [rows, cols, 2]",
"rb",
"=",
"torch",
".",
"min",
"(",
"bboxes1",
"[",
":",
",",
"None",
",",
"2",
":",
"]",
",",
"bboxes2",
"[",
":",
",",
"2",
":",
"]",
")",
"# [rows, cols, 2]",
"wh",
"=",
"(",
"rb",
"-",
"lt",
")",
".",
"clamp",
"(",
"min",
"=",
"0",
")",
"# [rows, cols, 2]",
"overlap",
"=",
"wh",
"[",
":",
",",
":",
",",
"0",
"]",
"*",
"wh",
"[",
":",
",",
":",
",",
"1",
"]",
"area1",
"=",
"(",
"bboxes1",
"[",
":",
",",
"2",
"]",
"-",
"bboxes1",
"[",
":",
",",
"0",
"]",
")",
"*",
"(",
"bboxes1",
"[",
":",
",",
"3",
"]",
"-",
"bboxes1",
"[",
":",
",",
"1",
"]",
")",
"if",
"mode",
"==",
"'iou'",
":",
"area2",
"=",
"(",
"bboxes2",
"[",
":",
",",
"2",
"]",
"-",
"bboxes2",
"[",
":",
",",
"0",
"]",
")",
"*",
"(",
"bboxes2",
"[",
":",
",",
"3",
"]",
"-",
"bboxes2",
"[",
":",
",",
"1",
"]",
")",
"union",
"=",
"area1",
"[",
":",
",",
"None",
"]",
"+",
"area2",
"-",
"overlap",
"else",
":",
"union",
"=",
"area1",
"[",
":",
",",
"None",
"]",
"eps",
"=",
"union",
".",
"new_tensor",
"(",
"[",
"eps",
"]",
")",
"union",
"=",
"torch",
".",
"max",
"(",
"union",
",",
"eps",
")",
"ious",
"=",
"overlap",
"/",
"union",
"return",
"ious"
] | [
38,
0
] | [
129,
15
] | python | en | ['en', 'en', 'en'] | True |
parse_args | () |
Wrapper to parse CLI arguments.
:return: args
|
Wrapper to parse CLI arguments. | def parse_args():
"""
Wrapper to parse CLI arguments.
:return: args
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"-dp", "--datapath", default="/tmp", help="Path where to save data."
)
args = parser.parse_args()
# opts is dic in parlai
args = vars(args)
return args | [
"def",
"parse_args",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"-dp\"",
",",
"\"--datapath\"",
",",
"default",
"=",
"\"/tmp\"",
",",
"help",
"=",
"\"Path where to save data.\"",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"# opts is dic in parlai",
"args",
"=",
"vars",
"(",
"args",
")",
"return",
"args"
] | [
9,
0
] | [
24,
15
] | 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.histogram2dcontour.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.histogram2dcontour.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.histogram2dcontour.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.histogram2dcontour.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.histogram2dcontour.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.histogram2dcon
tour.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.histogram2dcon
tour.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.histogram2dcon
tour.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.histogram2dcontour.Hoverlabel
constructor must be a dict or
an instance of :class:`plotly.graph_objs.histogram2dcontour.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.histogram2dcontour.Hoverlabel \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.histogram2dcontour.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 |
Tickformatstop.dtickrange | (self) |
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'dtickrange[0]' property accepts values of any type
(1) The 'dtickrange[1]' property accepts values of any type
Returns
-------
list
|
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'dtickrange[0]' property accepts values of any type
(1) The 'dtickrange[1]' property accepts values of any type | def dtickrange(self):
"""
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'dtickrange[0]' property accepts values of any type
(1) The 'dtickrange[1]' property accepts values of any type
Returns
-------
list
"""
return self["dtickrange"] | [
"def",
"dtickrange",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dtickrange\"",
"]"
] | [
15,
4
] | [
31,
33
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.enabled | (self) |
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False) | def enabled(self):
"""
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["enabled"] | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"enabled\"",
"]"
] | [
40,
4
] | [
52,
30
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.name | (self) |
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications (including `visible: false`
or `enabled: false` to hide it). Has no effect outside of a
template.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications (including `visible: false`
or `enabled: false` to hide it). Has no effect outside of a
template.
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):
"""
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications (including `visible: false`
or `enabled: false` to hide it). Has no effect outside of a
template.
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\"",
"]"
] | [
61,
4
] | [
79,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.templateitemname | (self) |
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (including `visible: false` or
`enabled: false` to hide it). If there is no template or no
matching item, this item will be hidden unless you explicitly
show it with `visible: true`.
The 'templateitemname' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (including `visible: false` or
`enabled: false` to hide it). If there is no template or no
matching item, this item will be hidden unless you explicitly
show it with `visible: true`.
The 'templateitemname' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def templateitemname(self):
"""
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (including `visible: false` or
`enabled: false` to hide it). If there is no template or no
matching item, this item will be hidden unless you explicitly
show it with `visible: true`.
The 'templateitemname' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["templateitemname"] | [
"def",
"templateitemname",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"templateitemname\"",
"]"
] | [
88,
4
] | [
107,
39
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.value | (self) |
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def value(self):
"""
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["value"] | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
116,
4
] | [
129,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.__init__ | (
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
) |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.volume.colorba
r.Tickformatstop`
dtickrange
range [*min*, *max*], where "min", "max" - dtick values
which describe some zoom level, it is possible to omit
"min" or "max" value by passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are created in the
output figure in addition to any items the figure
already has in this array. You can modify these items
in the output figure by making your own item with
`templateitemname` matching this `name` alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). Has no effect outside of a
template.
templateitemname
Used to refer to a named item in this array in the
template. Named items from the template will be created
even without a matching item in the input figure, but
you can modify one by making an item with
`templateitemname` matching its `name`, alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). If there is no template or no
matching item, this item will be hidden unless you
explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level, the same
as "tickformat"
Returns
-------
Tickformatstop
|
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.volume.colorba
r.Tickformatstop`
dtickrange
range [*min*, *max*], where "min", "max" - dtick values
which describe some zoom level, it is possible to omit
"min" or "max" value by passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are created in the
output figure in addition to any items the figure
already has in this array. You can modify these items
in the output figure by making your own item with
`templateitemname` matching this `name` alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). Has no effect outside of a
template.
templateitemname
Used to refer to a named item in this array in the
template. Named items from the template will be created
even without a matching item in the input figure, but
you can modify one by making an item with
`templateitemname` matching its `name`, alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). If there is no template or no
matching item, this item will be hidden unless you
explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level, the same
as "tickformat" | def __init__(
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
):
"""
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.volume.colorba
r.Tickformatstop`
dtickrange
range [*min*, *max*], where "min", "max" - dtick values
which describe some zoom level, it is possible to omit
"min" or "max" value by passing "null"
enabled
Determines whether or not this stop is used. If
`false`, this stop is ignored even within its
`dtickrange`.
name
When used in a template, named items are created in the
output figure in addition to any items the figure
already has in this array. You can modify these items
in the output figure by making your own item with
`templateitemname` matching this `name` alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). Has no effect outside of a
template.
templateitemname
Used to refer to a named item in this array in the
template. Named items from the template will be created
even without a matching item in the input figure, but
you can modify one by making an item with
`templateitemname` matching its `name`, alongside your
modifications (including `visible: false` or `enabled:
false` to hide it). If there is no template or no
matching item, this item will be hidden unless you
explicitly show it with `visible: true`.
value
string - dtickformat for described zoom level, the same
as "tickformat"
Returns
-------
Tickformatstop
"""
super(Tickformatstop, self).__init__("tickformatstops")
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.colorbar.Tickformatstop
constructor must be a dict or
an instance of :class:`plotly.graph_objs.volume.colorbar.Tickformatstop`"""
)
# 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("dtickrange", None)
_v = dtickrange if dtickrange is not None else _v
if _v is not None:
self["dtickrange"] = _v
_v = arg.pop("enabled", None)
_v = enabled if enabled is not None else _v
if _v is not None:
self["enabled"] = _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("templateitemname", None)
_v = templateitemname if templateitemname is not None else _v
if _v is not None:
self["templateitemname"] = _v
_v = arg.pop("value", None)
_v = value if value is not None else _v
if _v is not None:
self["value"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"dtickrange",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"name",
"=",
"None",
",",
"templateitemname",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickformatstop",
",",
"self",
")",
".",
"__init__",
"(",
"\"tickformatstops\"",
")",
"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.colorbar.Tickformatstop \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.volume.colorbar.Tickformatstop`\"\"\"",
")",
"# 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",
"(",
"\"dtickrange\"",
",",
"None",
")",
"_v",
"=",
"dtickrange",
"if",
"dtickrange",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"dtickrange\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"enabled\"",
",",
"None",
")",
"_v",
"=",
"enabled",
"if",
"enabled",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"enabled\"",
"]",
"=",
"_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",
"(",
"\"templateitemname\"",
",",
"None",
")",
"_v",
"=",
"templateitemname",
"if",
"templateitemname",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"templateitemname\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"value\"",
",",
"None",
")",
"_v",
"=",
"value",
"if",
"value",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"value\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
172,
4
] | [
282,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
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
Returns
-------
str
|
Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
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 | def bgcolor(self):
"""
Sets the background color of the hover label. By default uses
the annotation's `bgcolor` made opaque, or white if it was
transparent.
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
Returns
-------
str
"""
return self["bgcolor"] | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
15,
4
] | [
67,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover label. By default uses
either dark grey or white, for maximum contrast with
`hoverlabel.bgcolor`.
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
Returns
-------
str
|
Sets the border color of the hover label. By default uses
either dark grey or white, for maximum contrast with
`hoverlabel.bgcolor`.
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 | def bordercolor(self):
"""
Sets the border color of the hover label. By default uses
either dark grey or white, for maximum contrast with
`hoverlabel.bgcolor`.
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
Returns
-------
str
"""
return self["bordercolor"] | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
76,
4
] | [
128,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.font | (self) |
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.annotation.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
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".
size
Returns
-------
plotly.graph_objs.layout.scene.annotation.hoverlabel.Font
|
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.annotation.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
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".
size | def font(self):
"""
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.scene.annotation.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
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".
size
Returns
-------
plotly.graph_objs.layout.scene.annotation.hoverlabel.Font
"""
return self["font"] | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
137,
4
] | [
175,
27
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.__init__ | (self, arg=None, bgcolor=None, bordercolor=None, font=None, **kwargs) |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.a
nnotation.Hoverlabel`
bgcolor
Sets the background color of the hover label. By
default uses the annotation's `bgcolor` made opaque, or
white if it was transparent.
bordercolor
Sets the border color of the hover label. By default
uses either dark grey or white, for maximum contrast
with `hoverlabel.bgcolor`.
font
Sets the hover label text font. By default uses the
global hover font and size, with color from
`hoverlabel.bordercolor`.
Returns
-------
Hoverlabel
|
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.a
nnotation.Hoverlabel`
bgcolor
Sets the background color of the hover label. By
default uses the annotation's `bgcolor` made opaque, or
white if it was transparent.
bordercolor
Sets the border color of the hover label. By default
uses either dark grey or white, for maximum contrast
with `hoverlabel.bgcolor`.
font
Sets the hover label text font. By default uses the
global hover font and size, with color from
`hoverlabel.bordercolor`. | def __init__(self, arg=None, bgcolor=None, bordercolor=None, font=None, **kwargs):
"""
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.a
nnotation.Hoverlabel`
bgcolor
Sets the background color of the hover label. By
default uses the annotation's `bgcolor` made opaque, or
white if it was transparent.
bordercolor
Sets the border color of the hover label. By default
uses either dark grey or white, for maximum contrast
with `hoverlabel.bgcolor`.
font
Sets the hover label text font. By default uses the
global hover font and size, with color from
`hoverlabel.bordercolor`.
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.layout.scene.annotation.Hoverlabel
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.scene.annotation.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("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _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("font", None)
_v = font if font is not None else _v
if _v is not None:
self["font"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"font",
"=",
"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.layout.scene.annotation.Hoverlabel \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.layout.scene.annotation.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",
"(",
"\"bgcolor\"",
",",
"None",
")",
"_v",
"=",
"bgcolor",
"if",
"bgcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolor\"",
"]",
"=",
"_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",
"(",
"\"font\"",
",",
"None",
")",
"_v",
"=",
"font",
"if",
"font",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"font\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
200,
4
] | [
275,
34
] | python | en | ['en', 'error', 'th'] | False |
_fix_missing_period | (line) |
Adds a period to a line that is missing a period.
|
Adds a period to a line that is missing a period.
| def _fix_missing_period(line):
"""
Adds a period to a line that is missing a period.
"""
dm_single_close_quote = u'\u2019'
dm_double_close_quote = u'\u201d'
END_TOKENS = [
'.',
'!',
'?',
'...',
"'",
"`",
'"',
dm_single_close_quote,
dm_double_close_quote,
")",
] # acceptable ways to end a sentence
if "@highlight" in line or line == "" or line[-1] in END_TOKENS:
return line
return line + "." | [
"def",
"_fix_missing_period",
"(",
"line",
")",
":",
"dm_single_close_quote",
"=",
"u'\\u2019'",
"dm_double_close_quote",
"=",
"u'\\u201d'",
"END_TOKENS",
"=",
"[",
"'.'",
",",
"'!'",
",",
"'?'",
",",
"'...'",
",",
"\"'\"",
",",
"\"`\"",
",",
"'\"'",
",",
"dm_single_close_quote",
",",
"dm_double_close_quote",
",",
"\")\"",
",",
"]",
"# acceptable ways to end a sentence",
"if",
"\"@highlight\"",
"in",
"line",
"or",
"line",
"==",
"\"\"",
"or",
"line",
"[",
"-",
"1",
"]",
"in",
"END_TOKENS",
":",
"return",
"line",
"return",
"line",
"+",
"\".\""
] | [
16,
0
] | [
36,
21
] | python | en | ['en', 'error', 'th'] | False |
credential_definitions_send_credential_definition | (request: web.BaseRequest) |
Request handler for sending a credential definition to the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition identifier
|
Request handler for sending a credential definition to the ledger. | async def credential_definitions_send_credential_definition(request: web.BaseRequest):
"""
Request handler for sending a credential definition to the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition identifier
"""
context = request.app["request_context"]
body = await request.json()
schema_id = body.get("schema_id")
tag = body.get("tag")
ledger: BaseLedger = await context.inject(BaseLedger)
async with ledger:
credential_definition_id = await shield(
ledger.send_credential_definition(schema_id, tag)
)
return web.json_response({"credential_definition_id": credential_definition_id}) | [
"async",
"def",
"credential_definitions_send_credential_definition",
"(",
"request",
":",
"web",
".",
"BaseRequest",
")",
":",
"context",
"=",
"request",
".",
"app",
"[",
"\"request_context\"",
"]",
"body",
"=",
"await",
"request",
".",
"json",
"(",
")",
"schema_id",
"=",
"body",
".",
"get",
"(",
"\"schema_id\"",
")",
"tag",
"=",
"body",
".",
"get",
"(",
"\"tag\"",
")",
"ledger",
":",
"BaseLedger",
"=",
"await",
"context",
".",
"inject",
"(",
"BaseLedger",
")",
"async",
"with",
"ledger",
":",
"credential_definition_id",
"=",
"await",
"shield",
"(",
"ledger",
".",
"send_credential_definition",
"(",
"schema_id",
",",
"tag",
")",
")",
"return",
"web",
".",
"json_response",
"(",
"{",
"\"credential_definition_id\"",
":",
"credential_definition_id",
"}",
")"
] | [
93,
0
] | [
117,
84
] | python | en | ['en', 'error', 'th'] | False |
credential_definitions_created | (request: web.BaseRequest) |
Request handler for retrieving credential definitions that current agent created.
Args:
request: aiohttp request object
Returns:
The identifiers of matching credential definitions.
|
Request handler for retrieving credential definitions that current agent created. | async def credential_definitions_created(request: web.BaseRequest):
"""
Request handler for retrieving credential definitions that current agent created.
Args:
request: aiohttp request object
Returns:
The identifiers of matching credential definitions.
"""
context = request.app["request_context"]
storage = await context.inject(BaseStorage)
found = await storage.search_records(
type_filter=CRED_DEF_SENT_RECORD_TYPE,
tag_query={
p: request.query[p] for p in CRED_DEF_TAGS if p in request.query
}
).fetch_all()
return web.json_response(
{"credential_definition_ids": [record.value for record in found]}
) | [
"async",
"def",
"credential_definitions_created",
"(",
"request",
":",
"web",
".",
"BaseRequest",
")",
":",
"context",
"=",
"request",
".",
"app",
"[",
"\"request_context\"",
"]",
"storage",
"=",
"await",
"context",
".",
"inject",
"(",
"BaseStorage",
")",
"found",
"=",
"await",
"storage",
".",
"search_records",
"(",
"type_filter",
"=",
"CRED_DEF_SENT_RECORD_TYPE",
",",
"tag_query",
"=",
"{",
"p",
":",
"request",
".",
"query",
"[",
"p",
"]",
"for",
"p",
"in",
"CRED_DEF_TAGS",
"if",
"p",
"in",
"request",
".",
"query",
"}",
")",
".",
"fetch_all",
"(",
")",
"return",
"web",
".",
"json_response",
"(",
"{",
"\"credential_definition_ids\"",
":",
"[",
"record",
".",
"value",
"for",
"record",
"in",
"found",
"]",
"}",
")"
] | [
133,
0
] | [
156,
5
] | python | en | ['en', 'error', 'th'] | False |
credential_definitions_get_credential_definition | (request: web.BaseRequest) |
Request handler for getting a credential definition from the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition details.
|
Request handler for getting a credential definition from the ledger. | async def credential_definitions_get_credential_definition(request: web.BaseRequest):
"""
Request handler for getting a credential definition from the ledger.
Args:
request: aiohttp request object
Returns:
The credential definition details.
"""
context = request.app["request_context"]
credential_definition_id = request.match_info["id"]
ledger: BaseLedger = await context.inject(BaseLedger)
async with ledger:
credential_definition = await ledger.get_credential_definition(
credential_definition_id
)
return web.json_response({"credential_definition": credential_definition}) | [
"async",
"def",
"credential_definitions_get_credential_definition",
"(",
"request",
":",
"web",
".",
"BaseRequest",
")",
":",
"context",
"=",
"request",
".",
"app",
"[",
"\"request_context\"",
"]",
"credential_definition_id",
"=",
"request",
".",
"match_info",
"[",
"\"id\"",
"]",
"ledger",
":",
"BaseLedger",
"=",
"await",
"context",
".",
"inject",
"(",
"BaseLedger",
")",
"async",
"with",
"ledger",
":",
"credential_definition",
"=",
"await",
"ledger",
".",
"get_credential_definition",
"(",
"credential_definition_id",
")",
"return",
"web",
".",
"json_response",
"(",
"{",
"\"credential_definition\"",
":",
"credential_definition",
"}",
")"
] | [
164,
0
] | [
185,
78
] | python | en | ['en', 'error', 'th'] | False |
register | (app: web.Application) | Register routes. | Register routes. | async def register(app: web.Application):
"""Register routes."""
app.add_routes(
[
web.post(
"/credential-definitions",
credential_definitions_send_credential_definition,
)
]
)
app.add_routes(
[
web.get(
"/credential-definitions/created",
credential_definitions_created,
)
]
)
app.add_routes(
[
web.get(
"/credential-definitions/{id}",
credential_definitions_get_credential_definition,
)
]
) | [
"async",
"def",
"register",
"(",
"app",
":",
"web",
".",
"Application",
")",
":",
"app",
".",
"add_routes",
"(",
"[",
"web",
".",
"post",
"(",
"\"/credential-definitions\"",
",",
"credential_definitions_send_credential_definition",
",",
")",
"]",
")",
"app",
".",
"add_routes",
"(",
"[",
"web",
".",
"get",
"(",
"\"/credential-definitions/created\"",
",",
"credential_definitions_created",
",",
")",
"]",
")",
"app",
".",
"add_routes",
"(",
"[",
"web",
".",
"get",
"(",
"\"/credential-definitions/{id}\"",
",",
"credential_definitions_get_credential_definition",
",",
")",
"]",
")"
] | [
188,
0
] | [
213,
5
] | python | en | ['en', 'fr', 'en'] | False |
Frame.baseframe | (self) |
The name of the frame into which this frame's properties are
merged before applying. This is used to unify properties and
avoid needing to specify the same values for the same
properties in multiple frames.
The 'baseframe' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
The name of the frame into which this frame's properties are
merged before applying. This is used to unify properties and
avoid needing to specify the same values for the same
properties in multiple frames.
The 'baseframe' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def baseframe(self):
"""
The name of the frame into which this frame's properties are
merged before applying. This is used to unify properties and
avoid needing to specify the same values for the same
properties in multiple frames.
The 'baseframe' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["baseframe"] | [
"def",
"baseframe",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"baseframe\"",
"]"
] | [
15,
4
] | [
30,
32
] | python | en | ['en', 'error', 'th'] | False |
Frame.data | (self) |
A list of traces this frame modifies. The format is identical
to the normal trace definition.
Returns
-------
Any
|
A list of traces this frame modifies. The format is identical
to the normal trace definition. | def data(self):
"""
A list of traces this frame modifies. The format is identical
to the normal trace definition.
Returns
-------
Any
"""
return self["data"] | [
"def",
"data",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"data\"",
"]"
] | [
39,
4
] | [
48,
27
] | python | en | ['en', 'error', 'th'] | False |
Frame.group | (self) |
An identifier that specifies the group to which the frame
belongs, used by animate to select a subset of frames.
The 'group' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
An identifier that specifies the group to which the frame
belongs, used by animate to select a subset of frames.
The 'group' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def group(self):
"""
An identifier that specifies the group to which the frame
belongs, used by animate to select a subset of frames.
The 'group' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["group"] | [
"def",
"group",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"group\"",
"]"
] | [
57,
4
] | [
70,
28
] | python | en | ['en', 'error', 'th'] | False |
Frame.layout | (self) |
Layout properties which this frame modifies. The format is
identical to the normal layout definition.
Returns
-------
Any
|
Layout properties which this frame modifies. The format is
identical to the normal layout definition. | def layout(self):
"""
Layout properties which this frame modifies. The format is
identical to the normal layout definition.
Returns
-------
Any
"""
return self["layout"] | [
"def",
"layout",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"layout\"",
"]"
] | [
79,
4
] | [
88,
29
] | python | en | ['en', 'error', 'th'] | False |
Frame.name | (self) |
A label by which to identify the frame
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
A label by which to identify the frame
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):
"""
A label by which to identify the frame
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\"",
"]"
] | [
97,
4
] | [
109,
27
] | python | en | ['en', 'error', 'th'] | False |
Frame.traces | (self) |
A list of trace indices that identify the respective traces in
the data attribute
The 'traces' property accepts values of any type
Returns
-------
Any
|
A list of trace indices that identify the respective traces in
the data attribute
The 'traces' property accepts values of any type | def traces(self):
"""
A list of trace indices that identify the respective traces in
the data attribute
The 'traces' property accepts values of any type
Returns
-------
Any
"""
return self["traces"] | [
"def",
"traces",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"traces\"",
"]"
] | [
118,
4
] | [
129,
29
] | python | en | ['en', 'error', 'th'] | False |
Frame.__init__ | (
self,
arg=None,
baseframe=None,
data=None,
group=None,
layout=None,
name=None,
traces=None,
**kwargs
) |
Construct a new Frame object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Frame`
baseframe
The name of the frame into which this frame's
properties are merged before applying. This is used to
unify properties and avoid needing to specify the same
values for the same properties in multiple frames.
data
A list of traces this frame modifies. The format is
identical to the normal trace definition.
group
An identifier that specifies the group to which the
frame belongs, used by animate to select a subset of
frames.
layout
Layout properties which this frame modifies. The format
is identical to the normal layout definition.
name
A label by which to identify the frame
traces
A list of trace indices that identify the respective
traces in the data attribute
Returns
-------
Frame
|
Construct a new Frame object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Frame`
baseframe
The name of the frame into which this frame's
properties are merged before applying. This is used to
unify properties and avoid needing to specify the same
values for the same properties in multiple frames.
data
A list of traces this frame modifies. The format is
identical to the normal trace definition.
group
An identifier that specifies the group to which the
frame belongs, used by animate to select a subset of
frames.
layout
Layout properties which this frame modifies. The format
is identical to the normal layout definition.
name
A label by which to identify the frame
traces
A list of trace indices that identify the respective
traces in the data attribute | def __init__(
self,
arg=None,
baseframe=None,
data=None,
group=None,
layout=None,
name=None,
traces=None,
**kwargs
):
"""
Construct a new Frame object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Frame`
baseframe
The name of the frame into which this frame's
properties are merged before applying. This is used to
unify properties and avoid needing to specify the same
values for the same properties in multiple frames.
data
A list of traces this frame modifies. The format is
identical to the normal trace definition.
group
An identifier that specifies the group to which the
frame belongs, used by animate to select a subset of
frames.
layout
Layout properties which this frame modifies. The format
is identical to the normal layout definition.
name
A label by which to identify the frame
traces
A list of trace indices that identify the respective
traces in the data attribute
Returns
-------
Frame
"""
super(Frame, self).__init__("frames")
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.Frame
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Frame`"""
)
# 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("baseframe", None)
_v = baseframe if baseframe is not None else _v
if _v is not None:
self["baseframe"] = _v
_v = arg.pop("data", None)
_v = data if data is not None else _v
if _v is not None:
self["data"] = _v
_v = arg.pop("group", None)
_v = group if group is not None else _v
if _v is not None:
self["group"] = _v
_v = arg.pop("layout", None)
_v = layout if layout is not None else _v
if _v is not None:
self["layout"] = _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("traces", None)
_v = traces if traces is not None else _v
if _v is not None:
self["traces"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"baseframe",
"=",
"None",
",",
"data",
"=",
"None",
",",
"group",
"=",
"None",
",",
"layout",
"=",
"None",
",",
"name",
"=",
"None",
",",
"traces",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Frame",
",",
"self",
")",
".",
"__init__",
"(",
"\"frames\"",
")",
"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.Frame \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.Frame`\"\"\"",
")",
"# 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",
"(",
"\"baseframe\"",
",",
"None",
")",
"_v",
"=",
"baseframe",
"if",
"baseframe",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"baseframe\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"data\"",
",",
"None",
")",
"_v",
"=",
"data",
"if",
"data",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"data\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"group\"",
",",
"None",
")",
"_v",
"=",
"group",
"if",
"group",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"group\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"layout\"",
",",
"None",
")",
"_v",
"=",
"layout",
"if",
"layout",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"layout\"",
"]",
"=",
"_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",
"(",
"\"traces\"",
",",
"None",
")",
"_v",
"=",
"traces",
"if",
"traces",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"traces\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
162,
4
] | [
266,
34
] | python | en | ['en', 'error', 'th'] | False |
SessionCmdSet.at_cmdset_creation | (self) | Populate the cmdset | Populate the cmdset | def at_cmdset_creation(self):
"Populate the cmdset"
self.add(account.CmdSessions()) | [
"def",
"at_cmdset_creation",
"(",
"self",
")",
":",
"self",
".",
"add",
"(",
"account",
".",
"CmdSessions",
"(",
")",
")"
] | [
14,
4
] | [
16,
39
] | python | en | ['en', 'zh', 'en'] | True |
setup | (bot) |
Mandatory function to add the Cog to the bot.
|
Mandatory function to add the Cog to the bot.
| def setup(bot):
"""
Mandatory function to add the Cog to the bot.
"""
bot.add_cog(SteamCog(bot)) | [
"def",
"setup",
"(",
"bot",
")",
":",
"bot",
".",
"add_cog",
"(",
"SteamCog",
"(",
"bot",
")",
")"
] | [
331,
0
] | [
335,
30
] | python | en | ['en', 'error', 'th'] | False |
Font.color | (self) |
The 'color' 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
Returns
-------
str
|
The 'color' 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 | def color(self):
"""
The 'color' 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
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Font.family | (self) |
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
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".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
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".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Font.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Font.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Font object
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.a
nnotation.hoverlabel.Font`
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".
size
Returns
-------
Font
|
Construct a new Font object
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Font object
Sets the hover label text font. By default uses the global
hover font and size, with color from `hoverlabel.bordercolor`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.scene.a
nnotation.hoverlabel.Font`
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".
size
Returns
-------
Font
"""
super(Font, self).__init__("font")
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.layout.scene.annotation.hoverlabel.Font
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.scene.annotation.hoverlabel.Font`"""
)
# 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("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Font",
",",
"self",
")",
".",
"__init__",
"(",
"\"font\"",
")",
"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.layout.scene.annotation.hoverlabel.Font \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.layout.scene.annotation.hoverlabel.Font`\"\"\"",
")",
"# 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",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
227,
34
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.__init__ | (self, obj) |
Initialized on the object
|
Initialized on the object
| def __init__(self, obj):
"""
Initialized on the object
"""
self._store = {}
self.obj = weakref.proxy(obj) | [
"def",
"__init__",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"_store",
"=",
"{",
"}",
"self",
".",
"obj",
"=",
"weakref",
".",
"proxy",
"(",
"obj",
")"
] | [
66,
4
] | [
71,
37
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.has | (self, key) |
Check if object has this attribute or not.
Args:
key (str): The Nattribute key to check.
Returns:
has_nattribute (bool): If Nattribute is set or not.
|
Check if object has this attribute or not. | def has(self, key):
"""
Check if object has this attribute or not.
Args:
key (str): The Nattribute key to check.
Returns:
has_nattribute (bool): If Nattribute is set or not.
"""
return key in self._store | [
"def",
"has",
"(",
"self",
",",
"key",
")",
":",
"return",
"key",
"in",
"self",
".",
"_store"
] | [
73,
4
] | [
84,
33
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.get | (self, key, default=None) |
Get the named key value.
Args:
key (str): The Nattribute key to get.
Returns:
the value of the Nattribute.
|
Get the named key value. | def get(self, key, default=None):
"""
Get the named key value.
Args:
key (str): The Nattribute key to get.
Returns:
the value of the Nattribute.
"""
return self._store.get(key, default) | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"return",
"self",
".",
"_store",
".",
"get",
"(",
"key",
",",
"default",
")"
] | [
86,
4
] | [
97,
44
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.add | (self, key, value) |
Add new key and value.
Args:
key (str): The name of Nattribute to add.
value (any): The value to store.
|
Add new key and value. | def add(self, key, value):
"""
Add new key and value.
Args:
key (str): The name of Nattribute to add.
value (any): The value to store.
"""
self._store[key] = value | [
"def",
"add",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_store",
"[",
"key",
"]",
"=",
"value"
] | [
99,
4
] | [
108,
32
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.remove | (self, key) |
Remove Nattribute from storage.
Args:
key (str): The name of the Nattribute to remove.
|
Remove Nattribute from storage. | def remove(self, key):
"""
Remove Nattribute from storage.
Args:
key (str): The name of the Nattribute to remove.
"""
if key in self._store:
del self._store[key] | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"_store",
":",
"del",
"self",
".",
"_store",
"[",
"key",
"]"
] | [
110,
4
] | [
119,
32
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.clear | (self) |
Remove all NAttributes from handler.
|
Remove all NAttributes from handler. | def clear(self):
"""
Remove all NAttributes from handler.
"""
self._store = {} | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_store",
"=",
"{",
"}"
] | [
121,
4
] | [
126,
24
] | python | en | ['en', 'error', 'th'] | False |
NAttributeHandler.all | (self, return_tuples=False) |
List the contents of the handler.
Args:
return_tuples (bool, optional): Defines if the Nattributes
are returns as a list of keys or as a list of `(key, value)`.
Returns:
nattributes (list): A list of keys `[key, key, ...]` or a
list of tuples `[(key, value), ...]` depending on the
setting of `return_tuples`.
|
List the contents of the handler. | def all(self, return_tuples=False):
"""
List the contents of the handler.
Args:
return_tuples (bool, optional): Defines if the Nattributes
are returns as a list of keys or as a list of `(key, value)`.
Returns:
nattributes (list): A list of keys `[key, key, ...]` or a
list of tuples `[(key, value), ...]` depending on the
setting of `return_tuples`.
"""
if return_tuples:
return [(key, value) for (key, value) in self._store.items() if not key.startswith("_")]
return [key for key in self._store if not key.startswith("_")] | [
"def",
"all",
"(",
"self",
",",
"return_tuples",
"=",
"False",
")",
":",
"if",
"return_tuples",
":",
"return",
"[",
"(",
"key",
",",
"value",
")",
"for",
"(",
"key",
",",
"value",
")",
"in",
"self",
".",
"_store",
".",
"items",
"(",
")",
"if",
"not",
"key",
".",
"startswith",
"(",
"\"_\"",
")",
"]",
"return",
"[",
"key",
"for",
"key",
"in",
"self",
".",
"_store",
"if",
"not",
"key",
".",
"startswith",
"(",
"\"_\"",
")",
"]"
] | [
128,
4
] | [
144,
70
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.__init__ | (self) | Initiate to avoid AttributeErrors down the line | Initiate to avoid AttributeErrors down the line | def __init__(self):
"""Initiate to avoid AttributeErrors down the line"""
self.puppet = None
self.account = None
self.cmdset_storage_string = ""
self.cmdset = CmdSetHandler(self, True) | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"puppet",
"=",
"None",
"self",
".",
"account",
"=",
"None",
"self",
".",
"cmdset_storage_string",
"=",
"\"\"",
"self",
".",
"cmdset",
"=",
"CmdSetHandler",
"(",
"self",
",",
"True",
")"
] | [
162,
4
] | [
167,
47
] | python | en | ['en', 'en', 'en'] | True |
ServerSession.at_sync | (self) |
This is called whenever a session has been resynced with the
portal. At this point all relevant attributes have already
been set and self.account been assigned (if applicable).
Since this is often called after a server restart we need to
set up the session as it was.
|
This is called whenever a session has been resynced with the
portal. At this point all relevant attributes have already
been set and self.account been assigned (if applicable). | def at_sync(self):
"""
This is called whenever a session has been resynced with the
portal. At this point all relevant attributes have already
been set and self.account been assigned (if applicable).
Since this is often called after a server restart we need to
set up the session as it was.
"""
global _ObjectDB
if not _ObjectDB:
from evennia.objects.models import ObjectDB as _ObjectDB
super(ServerSession, self).at_sync()
if not self.logged_in:
# assign the unloggedin-command set.
self.cmdset_storage = settings.CMDSET_UNLOGGEDIN
self.cmdset.update(init_mode=True)
if self.puid:
# reconnect puppet (puid is only set if we are coming
# back from a server reload). This does all the steps
# done in the default @ic command but without any
# hooks, echoes or access checks.
obj = _ObjectDB.objects.get(id=self.puid)
obj.sessions.add(self)
obj.account = self.account
self.puid = obj.id
self.puppet = obj
# obj.scripts.validate()
obj.locks.cache_lock_bypass(obj) | [
"def",
"at_sync",
"(",
"self",
")",
":",
"global",
"_ObjectDB",
"if",
"not",
"_ObjectDB",
":",
"from",
"evennia",
".",
"objects",
".",
"models",
"import",
"ObjectDB",
"as",
"_ObjectDB",
"super",
"(",
"ServerSession",
",",
"self",
")",
".",
"at_sync",
"(",
")",
"if",
"not",
"self",
".",
"logged_in",
":",
"# assign the unloggedin-command set.",
"self",
".",
"cmdset_storage",
"=",
"settings",
".",
"CMDSET_UNLOGGEDIN",
"self",
".",
"cmdset",
".",
"update",
"(",
"init_mode",
"=",
"True",
")",
"if",
"self",
".",
"puid",
":",
"# reconnect puppet (puid is only set if we are coming",
"# back from a server reload). This does all the steps",
"# done in the default @ic command but without any",
"# hooks, echoes or access checks.",
"obj",
"=",
"_ObjectDB",
".",
"objects",
".",
"get",
"(",
"id",
"=",
"self",
".",
"puid",
")",
"obj",
".",
"sessions",
".",
"add",
"(",
"self",
")",
"obj",
".",
"account",
"=",
"self",
".",
"account",
"self",
".",
"puid",
"=",
"obj",
".",
"id",
"self",
".",
"puppet",
"=",
"obj",
"# obj.scripts.validate()",
"obj",
".",
"locks",
".",
"cache_lock_bypass",
"(",
"obj",
")"
] | [
176,
4
] | [
208,
44
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.at_login | (self, account) |
Hook called by sessionhandler when the session becomes authenticated.
Args:
account (Account): The account associated with the session.
|
Hook called by sessionhandler when the session becomes authenticated. | def at_login(self, account):
"""
Hook called by sessionhandler when the session becomes authenticated.
Args:
account (Account): The account associated with the session.
"""
self.account = account
self.uid = self.account.id
self.uname = self.account.username
self.logged_in = True
self.conn_time = time.time()
self.puid = None
self.puppet = None
self.cmdset_storage = settings.CMDSET_SESSION
# Update account's last login time.
self.account.last_login = timezone.now()
self.account.save()
# add the session-level cmdset
self.cmdset = CmdSetHandler(self, True) | [
"def",
"at_login",
"(",
"self",
",",
"account",
")",
":",
"self",
".",
"account",
"=",
"account",
"self",
".",
"uid",
"=",
"self",
".",
"account",
".",
"id",
"self",
".",
"uname",
"=",
"self",
".",
"account",
".",
"username",
"self",
".",
"logged_in",
"=",
"True",
"self",
".",
"conn_time",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"puid",
"=",
"None",
"self",
".",
"puppet",
"=",
"None",
"self",
".",
"cmdset_storage",
"=",
"settings",
".",
"CMDSET_SESSION",
"# Update account's last login time.",
"self",
".",
"account",
".",
"last_login",
"=",
"timezone",
".",
"now",
"(",
")",
"self",
".",
"account",
".",
"save",
"(",
")",
"# add the session-level cmdset",
"self",
".",
"cmdset",
"=",
"CmdSetHandler",
"(",
"self",
",",
"True",
")"
] | [
210,
4
] | [
232,
47
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.at_disconnect | (self, reason=None) |
Hook called by sessionhandler when disconnecting this session.
|
Hook called by sessionhandler when disconnecting this session. | def at_disconnect(self, reason=None):
"""
Hook called by sessionhandler when disconnecting this session.
"""
if self.logged_in:
account = self.account
if self.puppet:
account.unpuppet_object(self)
uaccount = account
uaccount.last_login = timezone.now()
uaccount.save()
# calling account hook
account.at_disconnect(reason)
self.logged_in = False
if not self.sessionhandler.sessions_from_account(account):
# no more sessions connected to this account
account.is_connected = False
# this may be used to e.g. delete account after disconnection etc
account.at_post_disconnect()
# remove any webclient settings monitors associated with this
# session
MONITOR_HANDLER.remove(account, "_saved_webclient_options",
self.sessid) | [
"def",
"at_disconnect",
"(",
"self",
",",
"reason",
"=",
"None",
")",
":",
"if",
"self",
".",
"logged_in",
":",
"account",
"=",
"self",
".",
"account",
"if",
"self",
".",
"puppet",
":",
"account",
".",
"unpuppet_object",
"(",
"self",
")",
"uaccount",
"=",
"account",
"uaccount",
".",
"last_login",
"=",
"timezone",
".",
"now",
"(",
")",
"uaccount",
".",
"save",
"(",
")",
"# calling account hook",
"account",
".",
"at_disconnect",
"(",
"reason",
")",
"self",
".",
"logged_in",
"=",
"False",
"if",
"not",
"self",
".",
"sessionhandler",
".",
"sessions_from_account",
"(",
"account",
")",
":",
"# no more sessions connected to this account",
"account",
".",
"is_connected",
"=",
"False",
"# this may be used to e.g. delete account after disconnection etc",
"account",
".",
"at_post_disconnect",
"(",
")",
"# remove any webclient settings monitors associated with this",
"# session",
"MONITOR_HANDLER",
".",
"remove",
"(",
"account",
",",
"\"_saved_webclient_options\"",
",",
"self",
".",
"sessid",
")"
] | [
234,
4
] | [
257,
47
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.get_account | (self) |
Get the account associated with this session
Returns:
account (Account): The associated Account.
|
Get the account associated with this session | def get_account(self):
"""
Get the account associated with this session
Returns:
account (Account): The associated Account.
"""
return self.logged_in and self.account | [
"def",
"get_account",
"(",
"self",
")",
":",
"return",
"self",
".",
"logged_in",
"and",
"self",
".",
"account"
] | [
259,
4
] | [
267,
46
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.get_puppet | (self) |
Get the in-game character associated with this session.
Returns:
puppet (Object): The puppeted object, if any.
|
Get the in-game character associated with this session. | def get_puppet(self):
"""
Get the in-game character associated with this session.
Returns:
puppet (Object): The puppeted object, if any.
"""
return self.logged_in and self.puppet | [
"def",
"get_puppet",
"(",
"self",
")",
":",
"return",
"self",
".",
"logged_in",
"and",
"self",
".",
"puppet"
] | [
269,
4
] | [
277,
45
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.get_puppet_or_account | (self) |
Get puppet or account.
Returns:
controller (Object or Account): The puppet if one exists,
otherwise return the account.
|
Get puppet or account. | def get_puppet_or_account(self):
"""
Get puppet or account.
Returns:
controller (Object or Account): The puppet if one exists,
otherwise return the account.
"""
if self.logged_in:
return self.puppet if self.puppet else self.account
return None | [
"def",
"get_puppet_or_account",
"(",
"self",
")",
":",
"if",
"self",
".",
"logged_in",
":",
"return",
"self",
".",
"puppet",
"if",
"self",
".",
"puppet",
"else",
"self",
".",
"account",
"return",
"None"
] | [
280,
4
] | [
291,
19
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.log | (self, message, channel=True) |
Emits session info to the appropriate outputs and info channels.
Args:
message (str): The message to log.
channel (bool, optional): Log to the CHANNEL_CONNECTINFO channel
in addition to the server log.
|
Emits session info to the appropriate outputs and info channels. | def log(self, message, channel=True):
"""
Emits session info to the appropriate outputs and info channels.
Args:
message (str): The message to log.
channel (bool, optional): Log to the CHANNEL_CONNECTINFO channel
in addition to the server log.
"""
cchan = channel and settings.CHANNEL_CONNECTINFO
if cchan:
try:
cchan = ChannelDB.objects.get_channel(cchan[0])
cchan.msg("[%s]: %s" % (cchan.key, message))
except Exception:
logger.log_trace()
logger.log_info(message) | [
"def",
"log",
"(",
"self",
",",
"message",
",",
"channel",
"=",
"True",
")",
":",
"cchan",
"=",
"channel",
"and",
"settings",
".",
"CHANNEL_CONNECTINFO",
"if",
"cchan",
":",
"try",
":",
"cchan",
"=",
"ChannelDB",
".",
"objects",
".",
"get_channel",
"(",
"cchan",
"[",
"0",
"]",
")",
"cchan",
".",
"msg",
"(",
"\"[%s]: %s\"",
"%",
"(",
"cchan",
".",
"key",
",",
"message",
")",
")",
"except",
"Exception",
":",
"logger",
".",
"log_trace",
"(",
")",
"logger",
".",
"log_info",
"(",
"message",
")"
] | [
293,
4
] | [
310,
32
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.get_client_size | (self) |
Return eventual eventual width and height reported by the
client. Note that this currently only deals with a single
client window (windowID==0) as in a traditional telnet session.
|
Return eventual eventual width and height reported by the
client. Note that this currently only deals with a single
client window (windowID==0) as in a traditional telnet session. | def get_client_size(self):
"""
Return eventual eventual width and height reported by the
client. Note that this currently only deals with a single
client window (windowID==0) as in a traditional telnet session.
"""
flags = self.protocol_flags
width = flags.get('SCREENWIDTH', {}).get(0, settings.CLIENT_DEFAULT_WIDTH)
height = flags.get('SCREENHEIGHT', {}).get(0, settings.CLIENT_DEFAULT_HEIGHT)
return width, height | [
"def",
"get_client_size",
"(",
"self",
")",
":",
"flags",
"=",
"self",
".",
"protocol_flags",
"width",
"=",
"flags",
".",
"get",
"(",
"'SCREENWIDTH'",
",",
"{",
"}",
")",
".",
"get",
"(",
"0",
",",
"settings",
".",
"CLIENT_DEFAULT_WIDTH",
")",
"height",
"=",
"flags",
".",
"get",
"(",
"'SCREENHEIGHT'",
",",
"{",
"}",
")",
".",
"get",
"(",
"0",
",",
"settings",
".",
"CLIENT_DEFAULT_HEIGHT",
")",
"return",
"width",
",",
"height"
] | [
312,
4
] | [
322,
28
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.update_session_counters | (self, idle=False) |
Hit this when the user enters a command in order to update
idle timers and command counters.
|
Hit this when the user enters a command in order to update
idle timers and command counters. | def update_session_counters(self, idle=False):
"""
Hit this when the user enters a command in order to update
idle timers and command counters.
"""
# Idle time used for timeout calcs.
self.cmd_last = time.time()
# Store the timestamp of the user's last command.
if not idle:
# Increment the user's command counter.
self.cmd_total += 1
# Account-visible idle time, not used in idle timeout calcs.
self.cmd_last_visible = self.cmd_last | [
"def",
"update_session_counters",
"(",
"self",
",",
"idle",
"=",
"False",
")",
":",
"# Idle time used for timeout calcs.",
"self",
".",
"cmd_last",
"=",
"time",
".",
"time",
"(",
")",
"# Store the timestamp of the user's last command.",
"if",
"not",
"idle",
":",
"# Increment the user's command counter.",
"self",
".",
"cmd_total",
"+=",
"1",
"# Account-visible idle time, not used in idle timeout calcs.",
"self",
".",
"cmd_last_visible",
"=",
"self",
".",
"cmd_last"
] | [
324,
4
] | [
338,
49
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.update_flags | (self, **kwargs) |
Update the protocol_flags and sync them with Portal.
Kwargs:
key, value - A key:value pair to set in the
protocol_flags dictionary.
Notes:
Since protocols can vary, no checking is done
as to the existene of the flag or not. The input
data should have been validated before this call.
|
Update the protocol_flags and sync them with Portal. | def update_flags(self, **kwargs):
"""
Update the protocol_flags and sync them with Portal.
Kwargs:
key, value - A key:value pair to set in the
protocol_flags dictionary.
Notes:
Since protocols can vary, no checking is done
as to the existene of the flag or not. The input
data should have been validated before this call.
"""
if kwargs:
self.protocol_flags.update(kwargs)
self.sessionhandler.session_portal_sync(self) | [
"def",
"update_flags",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"self",
".",
"protocol_flags",
".",
"update",
"(",
"kwargs",
")",
"self",
".",
"sessionhandler",
".",
"session_portal_sync",
"(",
"self",
")"
] | [
340,
4
] | [
356,
57
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.data_out | (self, **kwargs) |
Sending data from Evennia->Client
Kwargs:
text (str or tuple)
any (str or tuple): Send-commands identified
by their keys. Or "options", carrying options
for the protocol(s).
|
Sending data from Evennia->Client | def data_out(self, **kwargs):
"""
Sending data from Evennia->Client
Kwargs:
text (str or tuple)
any (str or tuple): Send-commands identified
by their keys. Or "options", carrying options
for the protocol(s).
"""
self.sessionhandler.data_out(self, **kwargs) | [
"def",
"data_out",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"sessionhandler",
".",
"data_out",
"(",
"self",
",",
"*",
"*",
"kwargs",
")"
] | [
358,
4
] | [
369,
52
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.data_in | (self, **kwargs) |
Receiving data from the client, sending it off to
the respective inputfuncs.
Kwargs:
kwargs (any): Incoming data from protocol on
the form `{"commandname": ((args), {kwargs}),...}`
Notes:
This method is here in order to give the user
a single place to catch and possibly process all incoming data from
the client. It should usually always end by sending
this data off to `self.sessionhandler.call_inputfuncs(self, **kwargs)`.
|
Receiving data from the client, sending it off to
the respective inputfuncs. | def data_in(self, **kwargs):
"""
Receiving data from the client, sending it off to
the respective inputfuncs.
Kwargs:
kwargs (any): Incoming data from protocol on
the form `{"commandname": ((args), {kwargs}),...}`
Notes:
This method is here in order to give the user
a single place to catch and possibly process all incoming data from
the client. It should usually always end by sending
this data off to `self.sessionhandler.call_inputfuncs(self, **kwargs)`.
"""
self.sessionhandler.call_inputfuncs(self, **kwargs) | [
"def",
"data_in",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"sessionhandler",
".",
"call_inputfuncs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")"
] | [
371,
4
] | [
385,
59
] | python | en | ['en', 'error', 'th'] | False |
ServerSession.msg | (self, text=None, **kwargs) |
Wrapper to mimic msg() functionality of Objects and Accounts.
Args:
text (str): String input.
Kwargs:
any (str or tuple): Send-commands identified
by their keys. Or "options", carrying options
for the protocol(s).
|
Wrapper to mimic msg() functionality of Objects and Accounts. | def msg(self, text=None, **kwargs):
"""
Wrapper to mimic msg() functionality of Objects and Accounts.
Args:
text (str): String input.
Kwargs:
any (str or tuple): Send-commands identified
by their keys. Or "options", carrying options
for the protocol(s).
"""
# this can happen if this is triggered e.g. a command.msg
# that auto-adds the session, we'd get a kwarg collision.
kwargs.pop("session", None)
kwargs.pop("from_obj", None)
if text is not None:
self.data_out(text=text, **kwargs)
else:
self.data_out(**kwargs) | [
"def",
"msg",
"(",
"self",
",",
"text",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# this can happen if this is triggered e.g. a command.msg",
"# that auto-adds the session, we'd get a kwarg collision.",
"kwargs",
".",
"pop",
"(",
"\"session\"",
",",
"None",
")",
"kwargs",
".",
"pop",
"(",
"\"from_obj\"",
",",
"None",
")",
"if",
"text",
"is",
"not",
"None",
":",
"self",
".",
"data_out",
"(",
"text",
"=",
"text",
",",
"*",
"*",
"kwargs",
")",
"else",
":",
"self",
".",
"data_out",
"(",
"*",
"*",
"kwargs",
")"
] | [
387,
4
] | [
407,
35
] | 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.