Search is not available for this dataset
identifier
stringlengths 1
155
| parameters
stringlengths 2
6.09k
| docstring
stringlengths 11
63.4k
| docstring_summary
stringlengths 0
63.4k
| function
stringlengths 29
99.8k
| function_tokens
sequence | start_point
sequence | end_point
sequence | language
stringclasses 1
value | docstring_language
stringlengths 2
7
| docstring_language_predictions
stringlengths 18
23
| is_langid_reliable
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|
Parcoords.uid | (self) |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["uid"] | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | [
692,
4
] | [
705,
26
] | python | en | ['en', 'error', 'th'] | False |
Parcoords.uirevision | (self) |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
|
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
"""
return self["uirevision"] | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | [
714,
4
] | [
738,
33
] | python | en | ['en', 'error', 'th'] | False |
Parcoords.visible | (self) |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
|
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly'] | def visible(self):
"""
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
747,
4
] | [
761,
30
] | python | en | ['en', 'error', 'th'] | False |
Parcoords.__init__ | (
self,
arg=None,
customdata=None,
customdatasrc=None,
dimensions=None,
dimensiondefaults=None,
domain=None,
ids=None,
idssrc=None,
labelangle=None,
labelfont=None,
labelside=None,
line=None,
meta=None,
metasrc=None,
name=None,
rangefont=None,
stream=None,
tickfont=None,
uid=None,
uirevision=None,
visible=None,
**kwargs
) |
Construct a new Parcoords object
Parallel coordinates for multidimensional exploratory data
analysis. The samples are specified in `dimensions`. The colors
are set in `line.color`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Parcoords`
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
dimensions
The dimensions (variables) of the parallel coordinates
chart. 2..60 dimensions are supported.
dimensiondefaults
When used in a template (as
layout.template.data.parcoords.dimensiondefaults), sets
the default property values to use for elements of
parcoords.dimensions
domain
:class:`plotly.graph_objects.parcoords.Domain` instance
or dict with compatible properties
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
labelangle
Sets the angle of the labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
labels vertically. Tilted labels with "labelangle" may
be positioned better inside margins when
`labelposition` is set to "bottom".
labelfont
Sets the font for the `dimension` labels.
labelside
Specifies the location of the `label`. "top" positions
labels above, next to the title "bottom" positions
labels below the graph Tilted labels with "labelangle"
may be positioned better inside margins when
`labelposition` is set to "bottom".
line
:class:`plotly.graph_objects.parcoords.Line` instance
or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
rangefont
Sets the font for the `dimension` range values.
stream
:class:`plotly.graph_objects.parcoords.Stream` instance
or dict with compatible properties
tickfont
Sets the font for the `dimension` tick values.
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
Returns
-------
Parcoords
|
Construct a new Parcoords object
Parallel coordinates for multidimensional exploratory data
analysis. The samples are specified in `dimensions`. The colors
are set in `line.color`. | def __init__(
self,
arg=None,
customdata=None,
customdatasrc=None,
dimensions=None,
dimensiondefaults=None,
domain=None,
ids=None,
idssrc=None,
labelangle=None,
labelfont=None,
labelside=None,
line=None,
meta=None,
metasrc=None,
name=None,
rangefont=None,
stream=None,
tickfont=None,
uid=None,
uirevision=None,
visible=None,
**kwargs
):
"""
Construct a new Parcoords object
Parallel coordinates for multidimensional exploratory data
analysis. The samples are specified in `dimensions`. The colors
are set in `line.color`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.Parcoords`
customdata
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note
that, "scatter" traces also appends customdata items in
the markers DOM elements
customdatasrc
Sets the source reference on Chart Studio Cloud for
customdata .
dimensions
The dimensions (variables) of the parallel coordinates
chart. 2..60 dimensions are supported.
dimensiondefaults
When used in a template (as
layout.template.data.parcoords.dimensiondefaults), sets
the default property values to use for elements of
parcoords.dimensions
domain
:class:`plotly.graph_objects.parcoords.Domain` instance
or dict with compatible properties
ids
Assigns id labels to each datum. These ids for object
constancy of data points during animation. Should be an
array of strings, not numbers or any other type.
idssrc
Sets the source reference on Chart Studio Cloud for
ids .
labelangle
Sets the angle of the labels with respect to the
horizontal. For example, a `tickangle` of -90 draws the
labels vertically. Tilted labels with "labelangle" may
be positioned better inside margins when
`labelposition` is set to "bottom".
labelfont
Sets the font for the `dimension` labels.
labelside
Specifies the location of the `label`. "top" positions
labels above, next to the title "bottom" positions
labels below the graph Tilted labels with "labelangle"
may be positioned better inside margins when
`labelposition` is set to "bottom".
line
:class:`plotly.graph_objects.parcoords.Line` instance
or dict with compatible properties
meta
Assigns extra meta information associated with this
trace that can be used in various text attributes.
Attributes such as trace `name`, graph, axis and
colorbar `title.text`, annotation `text`
`rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta`
values in an attribute in the same trace, simply use
`%{meta[i]}` where `i` is the index or key of the
`meta` item in question. To access trace `meta` in
layout attributes, use `%{data[n[.meta[i]}` where `i`
is the index or key of the `meta` and `n` is the trace
index.
metasrc
Sets the source reference on Chart Studio Cloud for
meta .
name
Sets the trace name. The trace name appear as the
legend item and on hover.
rangefont
Sets the font for the `dimension` range values.
stream
:class:`plotly.graph_objects.parcoords.Stream` instance
or dict with compatible properties
tickfont
Sets the font for the `dimension` tick values.
uid
Assign an id to this trace, Use this to provide object
constancy between traces during animations and
transitions.
uirevision
Controls persistence of some user-driven changes to the
trace: `constraintrange` in `parcoords` traces, as well
as some `editable: true` modifications such as `name`
and `colorbar.title`. Defaults to `layout.uirevision`.
Note that other user-driven trace attribute changes are
controlled by `layout` attributes: `trace.visible` is
controlled by `layout.legend.uirevision`,
`selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)`
(accessible with `config: {editable: true}`) is
controlled by `layout.editrevision`. Trace changes are
tracked by `uid`, which only falls back on trace index
if no `uid` is provided. So if your app can add/remove
traces before the end of the `data` array, such that
the same trace has a different index, you can still
preserve user-driven changes if you give each trace a
`uid` that stays with it as it moves.
visible
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as
a legend item (provided that the legend itself is
visible).
Returns
-------
Parcoords
"""
super(Parcoords, self).__init__("parcoords")
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.Parcoords
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Parcoords`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("customdata", None)
_v = customdata if customdata is not None else _v
if _v is not None:
self["customdata"] = _v
_v = arg.pop("customdatasrc", None)
_v = customdatasrc if customdatasrc is not None else _v
if _v is not None:
self["customdatasrc"] = _v
_v = arg.pop("dimensions", None)
_v = dimensions if dimensions is not None else _v
if _v is not None:
self["dimensions"] = _v
_v = arg.pop("dimensiondefaults", None)
_v = dimensiondefaults if dimensiondefaults is not None else _v
if _v is not None:
self["dimensiondefaults"] = _v
_v = arg.pop("domain", None)
_v = domain if domain is not None else _v
if _v is not None:
self["domain"] = _v
_v = arg.pop("ids", None)
_v = ids if ids is not None else _v
if _v is not None:
self["ids"] = _v
_v = arg.pop("idssrc", None)
_v = idssrc if idssrc is not None else _v
if _v is not None:
self["idssrc"] = _v
_v = arg.pop("labelangle", None)
_v = labelangle if labelangle is not None else _v
if _v is not None:
self["labelangle"] = _v
_v = arg.pop("labelfont", None)
_v = labelfont if labelfont is not None else _v
if _v is not None:
self["labelfont"] = _v
_v = arg.pop("labelside", None)
_v = labelside if labelside is not None else _v
if _v is not None:
self["labelside"] = _v
_v = arg.pop("line", None)
_v = line if line is not None else _v
if _v is not None:
self["line"] = _v
_v = arg.pop("meta", None)
_v = meta if meta is not None else _v
if _v is not None:
self["meta"] = _v
_v = arg.pop("metasrc", None)
_v = metasrc if metasrc is not None else _v
if _v is not None:
self["metasrc"] = _v
_v = arg.pop("name", None)
_v = name if name is not None else _v
if _v is not None:
self["name"] = _v
_v = arg.pop("rangefont", None)
_v = rangefont if rangefont is not None else _v
if _v is not None:
self["rangefont"] = _v
_v = arg.pop("stream", None)
_v = stream if stream is not None else _v
if _v is not None:
self["stream"] = _v
_v = arg.pop("tickfont", None)
_v = tickfont if tickfont is not None else _v
if _v is not None:
self["tickfont"] = _v
_v = arg.pop("uid", None)
_v = uid if uid is not None else _v
if _v is not None:
self["uid"] = _v
_v = arg.pop("uirevision", None)
_v = uirevision if uirevision is not None else _v
if _v is not None:
self["uirevision"] = _v
_v = arg.pop("visible", None)
_v = visible if visible is not None else _v
if _v is not None:
self["visible"] = _v
# Read-only literals
# ------------------
self._props["type"] = "parcoords"
arg.pop("type", None)
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"customdata",
"=",
"None",
",",
"customdatasrc",
"=",
"None",
",",
"dimensions",
"=",
"None",
",",
"dimensiondefaults",
"=",
"None",
",",
"domain",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"idssrc",
"=",
"None",
",",
"labelangle",
"=",
"None",
",",
"labelfont",
"=",
"None",
",",
"labelside",
"=",
"None",
",",
"line",
"=",
"None",
",",
"meta",
"=",
"None",
",",
"metasrc",
"=",
"None",
",",
"name",
"=",
"None",
",",
"rangefont",
"=",
"None",
",",
"stream",
"=",
"None",
",",
"tickfont",
"=",
"None",
",",
"uid",
"=",
"None",
",",
"uirevision",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Parcoords",
",",
"self",
")",
".",
"__init__",
"(",
"\"parcoords\"",
")",
"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.Parcoords \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.Parcoords`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdata\"",
",",
"None",
")",
"_v",
"=",
"customdata",
"if",
"customdata",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdata\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"customdatasrc\"",
",",
"None",
")",
"_v",
"=",
"customdatasrc",
"if",
"customdatasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"customdatasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"dimensions\"",
",",
"None",
")",
"_v",
"=",
"dimensions",
"if",
"dimensions",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"dimensions\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"dimensiondefaults\"",
",",
"None",
")",
"_v",
"=",
"dimensiondefaults",
"if",
"dimensiondefaults",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"dimensiondefaults\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"domain\"",
",",
"None",
")",
"_v",
"=",
"domain",
"if",
"domain",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"domain\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"ids\"",
",",
"None",
")",
"_v",
"=",
"ids",
"if",
"ids",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"ids\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"idssrc\"",
",",
"None",
")",
"_v",
"=",
"idssrc",
"if",
"idssrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"idssrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"labelangle\"",
",",
"None",
")",
"_v",
"=",
"labelangle",
"if",
"labelangle",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"labelangle\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"labelfont\"",
",",
"None",
")",
"_v",
"=",
"labelfont",
"if",
"labelfont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"labelfont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"labelside\"",
",",
"None",
")",
"_v",
"=",
"labelside",
"if",
"labelside",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"labelside\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"line\"",
",",
"None",
")",
"_v",
"=",
"line",
"if",
"line",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"line\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"meta\"",
",",
"None",
")",
"_v",
"=",
"meta",
"if",
"meta",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"meta\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"metasrc\"",
",",
"None",
")",
"_v",
"=",
"metasrc",
"if",
"metasrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"metasrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"name\"",
",",
"None",
")",
"_v",
"=",
"name",
"if",
"name",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"name\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"rangefont\"",
",",
"None",
")",
"_v",
"=",
"rangefont",
"if",
"rangefont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"rangefont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"stream\"",
",",
"None",
")",
"_v",
"=",
"stream",
"if",
"stream",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"stream\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tickfont\"",
",",
"None",
")",
"_v",
"=",
"tickfont",
"if",
"tickfont",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tickfont\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uid\"",
",",
"None",
")",
"_v",
"=",
"uid",
"if",
"uid",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uid\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"uirevision\"",
",",
"None",
")",
"_v",
"=",
"uirevision",
"if",
"uirevision",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"uirevision\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"visible\"",
",",
"None",
")",
"_v",
"=",
"visible",
"if",
"visible",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"visible\"",
"]",
"=",
"_v",
"# Read-only literals",
"# ------------------",
"self",
".",
"_props",
"[",
"\"type\"",
"]",
"=",
"\"parcoords\"",
"arg",
".",
"pop",
"(",
"\"type\"",
",",
"None",
")",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
876,
4
] | [
1136,
34
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_repeater | (self) |
Test a simple repeat-after-me model.
|
Test a simple repeat-after-me model.
| def test_repeater(self):
"""
Test a simple repeat-after-me model.
"""
valid, test = self._overfit_train()
self.assertGreaterEqual(valid['hits@1'], 0.90)
self.assertGreaterEqual(test['hits@1'], 0.90) | [
"def",
"test_repeater",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'hits@1'",
"]",
",",
"0.90",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'hits@1'",
"]",
",",
"0.90",
")"
] | [
97,
4
] | [
104,
53
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_resuming | (self) |
Test saving and resuming training.
|
Test saving and resuming training.
| def test_resuming(self):
"""
Test saving and resuming training.
"""
with testing_utils.tempdir() as tmpdir:
model_file = os.path.join(tmpdir, 'model')
valid1, test1 = testing_utils.train_model(
dict(
model_file=model_file,
task='integration_tests:candidate',
model='transformer/ranker',
batchsize=16,
num_epochs=0.1,
n_layers=1,
n_heads=1,
ffn_size=4,
embedding_size=4,
warmup_updates=1,
lr_scheduler='invsqrt',
)
)
valid2, test2 = testing_utils.train_model(
dict(
model_file=model_file,
task='integration_tests:candidate',
model='transformer/ranker',
num_epochs=0.1,
)
)
# make sure the number of updates is being tracked correctly
self.assertGreater(
valid2['total_train_updates'],
valid1['total_train_updates'],
'Number of updates is not increasing',
)
# make sure the learning rate is decreasing
self.assertLess(
valid2['lr'], valid1['lr'], 'Learning rate is not decreasing'
) | [
"def",
"test_resuming",
"(",
"self",
")",
":",
"with",
"testing_utils",
".",
"tempdir",
"(",
")",
"as",
"tmpdir",
":",
"model_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'model'",
")",
"valid1",
",",
"test1",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"model_file",
"=",
"model_file",
",",
"task",
"=",
"'integration_tests:candidate'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"batchsize",
"=",
"16",
",",
"num_epochs",
"=",
"0.1",
",",
"n_layers",
"=",
"1",
",",
"n_heads",
"=",
"1",
",",
"ffn_size",
"=",
"4",
",",
"embedding_size",
"=",
"4",
",",
"warmup_updates",
"=",
"1",
",",
"lr_scheduler",
"=",
"'invsqrt'",
",",
")",
")",
"valid2",
",",
"test2",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"model_file",
"=",
"model_file",
",",
"task",
"=",
"'integration_tests:candidate'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"num_epochs",
"=",
"0.1",
",",
")",
")",
"# make sure the number of updates is being tracked correctly",
"self",
".",
"assertGreater",
"(",
"valid2",
"[",
"'total_train_updates'",
"]",
",",
"valid1",
"[",
"'total_train_updates'",
"]",
",",
"'Number of updates is not increasing'",
",",
")",
"# make sure the learning rate is decreasing",
"self",
".",
"assertLess",
"(",
"valid2",
"[",
"'lr'",
"]",
",",
"valid1",
"[",
"'lr'",
"]",
",",
"'Learning rate is not decreasing'",
")"
] | [
106,
4
] | [
146,
13
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_resuming_reduce_on_plateau | (self) |
Reduce on Plateau can be tricky when combined with warmup.
See: https://github.com/facebookresearch/ParlAI/pull/1812
|
Reduce on Plateau can be tricky when combined with warmup. | def test_resuming_reduce_on_plateau(self):
"""
Reduce on Plateau can be tricky when combined with warmup.
See: https://github.com/facebookresearch/ParlAI/pull/1812
"""
with testing_utils.tempdir() as tmpdir:
model_file = os.path.join(tmpdir, 'model')
valid1, test1 = testing_utils.train_model(
dict(
model_file=model_file,
task='integration_tests:candidate',
model='transformer/ranker',
optimizer='adamax',
learningrate=7e-3,
batchsize=32,
num_epochs=1,
n_layers=1,
n_heads=1,
ffn_size=32,
embedding_size=32,
warmup_updates=1,
lr_scheduler='reduceonplateau',
)
)
valid2, test2 = testing_utils.train_model(
dict(
model_file=model_file,
task='integration_tests:candidate',
model='transformer/ranker',
num_epochs=1,
lr_scheduler='reduceonplateau',
)
)
# make sure the learning rate is decreasing
self.assertGreater(
valid2['lr'], 1e-5, 'Learning rate should not be that low when resuming'
) | [
"def",
"test_resuming_reduce_on_plateau",
"(",
"self",
")",
":",
"with",
"testing_utils",
".",
"tempdir",
"(",
")",
"as",
"tmpdir",
":",
"model_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'model'",
")",
"valid1",
",",
"test1",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"model_file",
"=",
"model_file",
",",
"task",
"=",
"'integration_tests:candidate'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"optimizer",
"=",
"'adamax'",
",",
"learningrate",
"=",
"7e-3",
",",
"batchsize",
"=",
"32",
",",
"num_epochs",
"=",
"1",
",",
"n_layers",
"=",
"1",
",",
"n_heads",
"=",
"1",
",",
"ffn_size",
"=",
"32",
",",
"embedding_size",
"=",
"32",
",",
"warmup_updates",
"=",
"1",
",",
"lr_scheduler",
"=",
"'reduceonplateau'",
",",
")",
")",
"valid2",
",",
"test2",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"model_file",
"=",
"model_file",
",",
"task",
"=",
"'integration_tests:candidate'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"num_epochs",
"=",
"1",
",",
"lr_scheduler",
"=",
"'reduceonplateau'",
",",
")",
")",
"# make sure the learning rate is decreasing",
"self",
".",
"assertGreater",
"(",
"valid2",
"[",
"'lr'",
"]",
",",
"1e-5",
",",
"'Learning rate should not be that low when resuming'",
")"
] | [
148,
4
] | [
186,
13
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_backcomp | (self) |
Tests that the transformer ranker model files continue to work over time.
|
Tests that the transformer ranker model files continue to work over time.
| def test_backcomp(self):
"""
Tests that the transformer ranker model files continue to work over time.
"""
valid, test = testing_utils.eval_model(
dict(
task='integration_tests:multiturn_candidate',
model='transformer/ranker',
model_file='zoo:unittest/transformer_ranker/model',
dict_file='zoo:unittest/transformer_ranker/model.dict',
batchsize=64,
)
)
self.assertGreaterEqual(valid['hits@1'], 0.99)
self.assertGreaterEqual(valid['accuracy'], 0.99)
self.assertGreaterEqual(valid['f1'], 0.99)
self.assertGreaterEqual(test['hits@1'], 0.99)
self.assertGreaterEqual(test['accuracy'], 0.99)
self.assertGreaterEqual(test['f1'], 0.99) | [
"def",
"test_backcomp",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests:multiturn_candidate'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"model_file",
"=",
"'zoo:unittest/transformer_ranker/model'",
",",
"dict_file",
"=",
"'zoo:unittest/transformer_ranker/model.dict'",
",",
"batchsize",
"=",
"64",
",",
")",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'hits@1'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'accuracy'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'f1'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'hits@1'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'accuracy'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'f1'",
"]",
",",
"0.99",
")"
] | [
188,
4
] | [
207,
49
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_xlm | (self) |
Test --variant xlm.
|
Test --variant xlm.
| def test_xlm(self):
"""
Test --variant xlm.
"""
valid, test = self._overfit_train(variant='xlm', activation='gelu')
self.assertGreaterEqual(valid['hits@1'], 0.90)
self.assertGreaterEqual(test['hits@1'], 0.90) | [
"def",
"test_xlm",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
"variant",
"=",
"'xlm'",
",",
"activation",
"=",
"'gelu'",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'hits@1'",
"]",
",",
"0.90",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'hits@1'",
"]",
",",
"0.90",
")"
] | [
210,
4
] | [
217,
53
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_prelayernorm | (self) |
Test --variant prelayernorm with history_add_global_end_token option.
|
Test --variant prelayernorm with history_add_global_end_token option.
| def test_prelayernorm(self):
"""
Test --variant prelayernorm with history_add_global_end_token option.
"""
valid, test = self._overfit_train(
task='integration_tests:overfit',
model='transformer/ranker',
variant='prelayernorm',
activation='gelu',
history_add_global_end_token='end',
)
self.assertGreaterEqual(valid['hits@1'], 0.90)
self.assertGreaterEqual(test['hits@1'], 0.90) | [
"def",
"test_prelayernorm",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
"task",
"=",
"'integration_tests:overfit'",
",",
"model",
"=",
"'transformer/ranker'",
",",
"variant",
"=",
"'prelayernorm'",
",",
"activation",
"=",
"'gelu'",
",",
"history_add_global_end_token",
"=",
"'end'",
",",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'hits@1'",
"]",
",",
"0.90",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'hits@1'",
"]",
",",
"0.90",
")"
] | [
220,
4
] | [
233,
53
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerRanker.test_alt_reduction | (self) |
Test a transformer ranker reduction method other than `mean`.
|
Test a transformer ranker reduction method other than `mean`.
| def test_alt_reduction(self):
"""
Test a transformer ranker reduction method other than `mean`.
"""
valid, test = self._overfit_train(
variant='xlm',
activation='gelu',
reduction_type='first', # this is really what we're trying to test for
)
self.assertGreaterEqual(valid['hits@1'], 0.90)
self.assertGreaterEqual(test['hits@1'], 0.90) | [
"def",
"test_alt_reduction",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
"variant",
"=",
"'xlm'",
",",
"activation",
"=",
"'gelu'",
",",
"reduction_type",
"=",
"'first'",
",",
"# this is really what we're trying to test for",
")",
"self",
".",
"assertGreaterEqual",
"(",
"valid",
"[",
"'hits@1'",
"]",
",",
"0.90",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'hits@1'",
"]",
",",
"0.90",
")"
] | [
236,
4
] | [
247,
53
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_greedysearch | (self) |
Test greedy search.
|
Test greedy search.
| def test_greedysearch(self):
"""
Test greedy search.
"""
valid, test = testing_utils.eval_model(
dict(
task='integration_tests:multiturn_candidate',
model='transformer/generator',
model_file='zoo:unittest/transformer_generator2/model',
batchsize=4,
inference='greedy',
metrics='bleu',
beam_size=1,
num_examples=20,
)
)
self.assertLessEqual(valid['ppl'], 1.05)
# 0.75 because some of the turns contain fewer than 2 words
self.assertAlmostEqual(valid['bleu-2'], 0.60, delta=0.001)
self.assertAlmostEqual(valid['bleu-3'], 0.40, delta=0.001)
self.assertLessEqual(test['ppl'], 1.05)
self.assertAlmostEqual(test['bleu-2'], 0.60, delta=0.001)
self.assertAlmostEqual(test['bleu-3'], 0.40, delta=0.001) | [
"def",
"test_greedysearch",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests:multiturn_candidate'",
",",
"model",
"=",
"'transformer/generator'",
",",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"batchsize",
"=",
"4",
",",
"inference",
"=",
"'greedy'",
",",
"metrics",
"=",
"'bleu'",
",",
"beam_size",
"=",
"1",
",",
"num_examples",
"=",
"20",
",",
")",
")",
"self",
".",
"assertLessEqual",
"(",
"valid",
"[",
"'ppl'",
"]",
",",
"1.05",
")",
"# 0.75 because some of the turns contain fewer than 2 words",
"self",
".",
"assertAlmostEqual",
"(",
"valid",
"[",
"'bleu-2'",
"]",
",",
"0.60",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertAlmostEqual",
"(",
"valid",
"[",
"'bleu-3'",
"]",
",",
"0.40",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertLessEqual",
"(",
"test",
"[",
"'ppl'",
"]",
",",
"1.05",
")",
"self",
".",
"assertAlmostEqual",
"(",
"test",
"[",
"'bleu-2'",
"]",
",",
"0.60",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertAlmostEqual",
"(",
"test",
"[",
"'bleu-3'",
"]",
",",
"0.40",
",",
"delta",
"=",
"0.001",
")"
] | [
277,
4
] | [
300,
65
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_beamsearch | (self) |
Test beamsearch.
|
Test beamsearch.
| def test_beamsearch(self):
"""
Test beamsearch.
"""
valid, test = testing_utils.eval_model(
dict(
task='integration_tests:multiturn_candidate',
model='transformer/generator',
model_file='zoo:unittest/transformer_generator2/model',
batchsize=4,
metrics='bleu',
inference='beam',
beam_size=5,
num_examples=20,
)
)
self.assertLessEqual(valid['ppl'], 1.05)
self.assertAlmostEqual(valid['bleu-2'], 0.60, delta=0.001)
self.assertAlmostEqual(valid['bleu-3'], 0.40, delta=0.001)
self.assertLessEqual(test['ppl'], 1.05)
self.assertAlmostEqual(test['bleu-2'], 0.60, delta=0.001)
self.assertAlmostEqual(test['bleu-3'], 0.40, delta=0.001) | [
"def",
"test_beamsearch",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests:multiturn_candidate'",
",",
"model",
"=",
"'transformer/generator'",
",",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"batchsize",
"=",
"4",
",",
"metrics",
"=",
"'bleu'",
",",
"inference",
"=",
"'beam'",
",",
"beam_size",
"=",
"5",
",",
"num_examples",
"=",
"20",
",",
")",
")",
"self",
".",
"assertLessEqual",
"(",
"valid",
"[",
"'ppl'",
"]",
",",
"1.05",
")",
"self",
".",
"assertAlmostEqual",
"(",
"valid",
"[",
"'bleu-2'",
"]",
",",
"0.60",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertAlmostEqual",
"(",
"valid",
"[",
"'bleu-3'",
"]",
",",
"0.40",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertLessEqual",
"(",
"test",
"[",
"'ppl'",
"]",
",",
"1.05",
")",
"self",
".",
"assertAlmostEqual",
"(",
"test",
"[",
"'bleu-2'",
"]",
",",
"0.60",
",",
"delta",
"=",
"0.001",
")",
"self",
".",
"assertAlmostEqual",
"(",
"test",
"[",
"'bleu-3'",
"]",
",",
"0.40",
",",
"delta",
"=",
"0.001",
")"
] | [
302,
4
] | [
324,
65
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_beamsearch_return_all_texts | (self) |
Test beam_texts for beam_size > 1.
|
Test beam_texts for beam_size > 1.
| def test_beamsearch_return_all_texts(self):
"""
Test beam_texts for beam_size > 1.
"""
size = 3
agent = create_agent_from_model_file(
'zoo:unittest/beam_blocking/model',
opt_overrides={"beam_size": size, "inference": "beam"},
)
agent.observe({'text': '5 5 5 5 5 5 5', 'episode_done': True})
response = agent.act()
self.assertTrue("beam_texts" in response)
self.assertGreaterEqual(len(response["beam_texts"]), size)
hyp, score = response["beam_texts"][0]
self.assertTrue(isinstance(hyp, str))
self.assertTrue(isinstance(score, float))
agent = create_agent_from_model_file(
'zoo:unittest/beam_blocking/model',
opt_overrides={"beam_size": size, "inference": "topk"},
)
agent.observe({'text': '5 5 5 5 5 5 5', 'episode_done': True})
response = agent.act()
self.assertTrue("beam_texts" in response)
self.assertEqual(len(response["beam_texts"]), size) | [
"def",
"test_beamsearch_return_all_texts",
"(",
"self",
")",
":",
"size",
"=",
"3",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
",",
"opt_overrides",
"=",
"{",
"\"beam_size\"",
":",
"size",
",",
"\"inference\"",
":",
"\"beam\"",
"}",
",",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 5 5 5 5 5 5'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"response",
"=",
"agent",
".",
"act",
"(",
")",
"self",
".",
"assertTrue",
"(",
"\"beam_texts\"",
"in",
"response",
")",
"self",
".",
"assertGreaterEqual",
"(",
"len",
"(",
"response",
"[",
"\"beam_texts\"",
"]",
")",
",",
"size",
")",
"hyp",
",",
"score",
"=",
"response",
"[",
"\"beam_texts\"",
"]",
"[",
"0",
"]",
"self",
".",
"assertTrue",
"(",
"isinstance",
"(",
"hyp",
",",
"str",
")",
")",
"self",
".",
"assertTrue",
"(",
"isinstance",
"(",
"score",
",",
"float",
")",
")",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
",",
"opt_overrides",
"=",
"{",
"\"beam_size\"",
":",
"size",
",",
"\"inference\"",
":",
"\"topk\"",
"}",
",",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 5 5 5 5 5 5'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"response",
"=",
"agent",
".",
"act",
"(",
")",
"self",
".",
"assertTrue",
"(",
"\"beam_texts\"",
"in",
"response",
")",
"self",
".",
"assertEqual",
"(",
"len",
"(",
"response",
"[",
"\"beam_texts\"",
"]",
")",
",",
"size",
")"
] | [
327,
4
] | [
352,
59
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_beamsearch_blocking | (self) |
Test beamsearch blocking.
|
Test beamsearch blocking.
| def test_beamsearch_blocking(self):
"""
Test beamsearch blocking.
"""
with testing_utils.tempdir() as tmpdir:
agent = create_agent_from_model_file('zoo:unittest/beam_blocking/model')
agent.observe({'text': '5 5 5 5 5 5 5', 'episode_done': True})
assert agent.act()['text'] == '5 5 5 5 5 5 5'
agent = create_agent_from_model_file(
'zoo:unittest/beam_blocking/model', Opt(beam_block_ngram=1)
)
agent.observe({'text': '5 5 5 5 5 5 5', 'episode_done': True})
assert '5 5' not in agent.act()['text']
agent = create_agent_from_model_file(
'zoo:unittest/beam_blocking/model', Opt(beam_block_ngram=2)
)
agent.observe({'text': '5 5 5 5 5 5 5', 'episode_done': True})
assert '5 5 5' not in agent.act()['text']
with open(os.path.join(tmpdir, 'blocklist.txt'), 'w') as f:
f.write("38\n62\n34 34\n")
agent = create_agent_from_model_file(
'zoo:unittest/beam_blocking/model',
Opt(beam_block_list_filename=os.path.join(tmpdir, 'blocklist.txt')),
)
agent.observe({'text': '4 4 4', 'episode_done': True})
assert agent.act()['text'] == '4 4 4'
agent.observe({'text': '38 38 38', 'episode_done': True})
assert '38' not in agent.act()['text']
agent.observe({'text': '62 62 62', 'episode_done': True})
assert '62' not in agent.act()['text']
agent.observe({'text': '34 34 34', 'episode_done': True})
text = agent.act()['text']
assert '34' in text
assert '34 34' not in text | [
"def",
"test_beamsearch_blocking",
"(",
"self",
")",
":",
"with",
"testing_utils",
".",
"tempdir",
"(",
")",
"as",
"tmpdir",
":",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 5 5 5 5 5 5'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"==",
"'5 5 5 5 5 5 5'",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
",",
"Opt",
"(",
"beam_block_ngram",
"=",
"1",
")",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 5 5 5 5 5 5'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"'5 5'",
"not",
"in",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
",",
"Opt",
"(",
"beam_block_ngram",
"=",
"2",
")",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 5 5 5 5 5 5'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"'5 5 5'",
"not",
"in",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'blocklist.txt'",
")",
",",
"'w'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"\"38\\n62\\n34 34\\n\"",
")",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/beam_blocking/model'",
",",
"Opt",
"(",
"beam_block_list_filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'blocklist.txt'",
")",
")",
",",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'4 4 4'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"==",
"'4 4 4'",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'38 38 38'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"'38'",
"not",
"in",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'62 62 62'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"'62'",
"not",
"in",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'34 34 34'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"text",
"=",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"assert",
"'34'",
"in",
"text",
"assert",
"'34 34'",
"not",
"in",
"text"
] | [
355,
4
] | [
395,
38
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_beamsearch_contextblocking | (self) |
Test beamsearch context blocking.
|
Test beamsearch context blocking.
| def test_beamsearch_contextblocking(self):
"""
Test beamsearch context blocking.
"""
agent = create_agent_from_model_file('zoo:unittest/context_blocking/model')
agent.observe({'text': '5 4 3 2', 'episode_done': True})
assert agent.act()['text'] == '5 4 3 2'
agent = create_agent_from_model_file(
'zoo:unittest/context_blocking/model', Opt(beam_context_block_ngram=1)
)
agent.observe({'text': '5 4 3 2', 'episode_done': True})
text = agent.act()['text']
assert '5' not in text
assert '4' not in text
assert '3' not in text
assert '2' not in text
agent = create_agent_from_model_file(
'zoo:unittest/context_blocking/model', Opt(beam_context_block_ngram=2)
)
agent.observe({'text': '5 4 3 2', 'episode_done': True})
text = agent.act()['text']
assert '5' in text
assert '5 4' not in text
assert '4 3' not in text
assert '3 2' not in text | [
"def",
"test_beamsearch_contextblocking",
"(",
"self",
")",
":",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/context_blocking/model'",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 4 3 2'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"assert",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"==",
"'5 4 3 2'",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/context_blocking/model'",
",",
"Opt",
"(",
"beam_context_block_ngram",
"=",
"1",
")",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 4 3 2'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"text",
"=",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"assert",
"'5'",
"not",
"in",
"text",
"assert",
"'4'",
"not",
"in",
"text",
"assert",
"'3'",
"not",
"in",
"text",
"assert",
"'2'",
"not",
"in",
"text",
"agent",
"=",
"create_agent_from_model_file",
"(",
"'zoo:unittest/context_blocking/model'",
",",
"Opt",
"(",
"beam_context_block_ngram",
"=",
"2",
")",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'5 4 3 2'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"text",
"=",
"agent",
".",
"act",
"(",
")",
"[",
"'text'",
"]",
"assert",
"'5'",
"in",
"text",
"assert",
"'5 4'",
"not",
"in",
"text",
"assert",
"'4 3'",
"not",
"in",
"text",
"assert",
"'3 2'",
"not",
"in",
"text"
] | [
398,
4
] | [
425,
32
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_nucleus | (self) |
Test nucleus generation.
|
Test nucleus generation.
| def test_nucleus(self):
"""
Test nucleus generation.
"""
# Nucleus is inherently stochastic, just ensure no crash.
opt = ParlaiParser(True, True).parse_kwargs(
model_file='zoo:unittest/transformer_generator2/model',
inference='nucleus',
topp=0.3,
)
agent = create_agent(opt, True)
agent.observe({'text': '1', 'episode_done': True})
result = agent.act()
assert 'text' in result
assert result['text'] != '' | [
"def",
"test_nucleus",
"(",
"self",
")",
":",
"# Nucleus is inherently stochastic, just ensure no crash.",
"opt",
"=",
"ParlaiParser",
"(",
"True",
",",
"True",
")",
".",
"parse_kwargs",
"(",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"inference",
"=",
"'nucleus'",
",",
"topp",
"=",
"0.3",
",",
")",
"agent",
"=",
"create_agent",
"(",
"opt",
",",
"True",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'1'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"result",
"=",
"agent",
".",
"act",
"(",
")",
"assert",
"'text'",
"in",
"result",
"assert",
"result",
"[",
"'text'",
"]",
"!=",
"''"
] | [
427,
4
] | [
441,
35
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_beamdelay | (self) |
Test delayedbeam generation.
|
Test delayedbeam generation.
| def test_beamdelay(self):
"""
Test delayedbeam generation.
"""
# Delayed Beam is inherently stochastic, just ensure no crash.
opt = ParlaiParser(True, True).parse_kwargs(
model_file='zoo:unittest/transformer_generator2/model',
inference='delayedbeam',
topk=10,
beam_delay=2,
beam_min_length=2,
)
agent = create_agent(opt, True)
agent.observe({'text': '1\n1\n2\n2\n3\n3\n4', 'episode_done': True})
result = agent.act()
assert 'text' in result
assert result['text'] != ''
assert '1 2' in result['text'] | [
"def",
"test_beamdelay",
"(",
"self",
")",
":",
"# Delayed Beam is inherently stochastic, just ensure no crash.",
"opt",
"=",
"ParlaiParser",
"(",
"True",
",",
"True",
")",
".",
"parse_kwargs",
"(",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"inference",
"=",
"'delayedbeam'",
",",
"topk",
"=",
"10",
",",
"beam_delay",
"=",
"2",
",",
"beam_min_length",
"=",
"2",
",",
")",
"agent",
"=",
"create_agent",
"(",
"opt",
",",
"True",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'1\\n1\\n2\\n2\\n3\\n3\\n4'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"result",
"=",
"agent",
".",
"act",
"(",
")",
"assert",
"'text'",
"in",
"result",
"assert",
"result",
"[",
"'text'",
"]",
"!=",
"''",
"assert",
"'1 2'",
"in",
"result",
"[",
"'text'",
"]"
] | [
443,
4
] | [
460,
38
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_topk | (self) |
Test topk generation.
|
Test topk generation.
| def test_topk(self):
"""
Test topk generation.
"""
# Topk is inherently stochastic, just ensure no crash.
opt = ParlaiParser(True, True).parse_kwargs(
model_file='zoo:unittest/transformer_generator2/model',
inference='topk',
topp=10,
)
agent = create_agent(opt, True)
agent.observe({'text': '1', 'episode_done': True})
result = agent.act()
assert 'text' in result
assert result['text'] != '' | [
"def",
"test_topk",
"(",
"self",
")",
":",
"# Topk is inherently stochastic, just ensure no crash.",
"opt",
"=",
"ParlaiParser",
"(",
"True",
",",
"True",
")",
".",
"parse_kwargs",
"(",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"inference",
"=",
"'topk'",
",",
"topp",
"=",
"10",
",",
")",
"agent",
"=",
"create_agent",
"(",
"opt",
",",
"True",
")",
"agent",
".",
"observe",
"(",
"{",
"'text'",
":",
"'1'",
",",
"'episode_done'",
":",
"True",
"}",
")",
"result",
"=",
"agent",
".",
"act",
"(",
")",
"assert",
"'text'",
"in",
"result",
"assert",
"result",
"[",
"'text'",
"]",
"!=",
"''"
] | [
462,
4
] | [
476,
35
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_generator_backcomp | (self) |
Tests that the generator model files work over time.
|
Tests that the generator model files work over time.
| def test_generator_backcomp(self):
"""
Tests that the generator model files work over time.
"""
_, test = testing_utils.eval_model(
dict(
task='integration_tests:multiturn_candidate',
model='transformer/generator',
model_file='zoo:unittest/transformer_generator2/model',
dict_file='zoo:unittest/transformer_generator2/model.dict',
rank_candidates=False,
batchsize=64,
),
skip_valid=True,
)
self.assertLessEqual(test['ppl'], 1.01)
self.assertGreaterEqual(test['accuracy'], 0.99)
self.assertGreaterEqual(test['f1'], 0.99) | [
"def",
"test_generator_backcomp",
"(",
"self",
")",
":",
"_",
",",
"test",
"=",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests:multiturn_candidate'",
",",
"model",
"=",
"'transformer/generator'",
",",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"dict_file",
"=",
"'zoo:unittest/transformer_generator2/model.dict'",
",",
"rank_candidates",
"=",
"False",
",",
"batchsize",
"=",
"64",
",",
")",
",",
"skip_valid",
"=",
"True",
",",
")",
"self",
".",
"assertLessEqual",
"(",
"test",
"[",
"'ppl'",
"]",
",",
"1.01",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'accuracy'",
"]",
",",
"0.99",
")",
"self",
".",
"assertGreaterEqual",
"(",
"test",
"[",
"'f1'",
"]",
",",
"0.99",
")"
] | [
478,
4
] | [
496,
49
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_xlm | (self) |
Test --variant xlm.
|
Test --variant xlm.
| def test_xlm(self):
"""
Test --variant xlm.
"""
valid, test = self._overfit_train(
variant='xlm',
activation='gelu',
n_segments=8, # doesn't do anything but still good to test
adam_eps=1e-6, # just to test another flag simultaneously
)
self.assertLessEqual(valid['ppl'], 1.30)
self.assertLessEqual(test['ppl'], 1.30) | [
"def",
"test_xlm",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
"variant",
"=",
"'xlm'",
",",
"activation",
"=",
"'gelu'",
",",
"n_segments",
"=",
"8",
",",
"# doesn't do anything but still good to test",
"adam_eps",
"=",
"1e-6",
",",
"# just to test another flag simultaneously",
")",
"self",
".",
"assertLessEqual",
"(",
"valid",
"[",
"'ppl'",
"]",
",",
"1.30",
")",
"self",
".",
"assertLessEqual",
"(",
"test",
"[",
"'ppl'",
"]",
",",
"1.30",
")"
] | [
499,
4
] | [
511,
47
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_prelayernorm | (self) |
Test --variant prelayernorm.
|
Test --variant prelayernorm.
| def test_prelayernorm(self):
"""
Test --variant prelayernorm.
"""
valid, test = self._overfit_train(variant='prelayernorm', activation='gelu')
self.assertLessEqual(valid['ppl'], 1.30)
self.assertLessEqual(test['ppl'], 1.30) | [
"def",
"test_prelayernorm",
"(",
"self",
")",
":",
"valid",
",",
"test",
"=",
"self",
".",
"_overfit_train",
"(",
"variant",
"=",
"'prelayernorm'",
",",
"activation",
"=",
"'gelu'",
")",
"self",
".",
"assertLessEqual",
"(",
"valid",
"[",
"'ppl'",
"]",
",",
"1.30",
")",
"self",
".",
"assertLessEqual",
"(",
"test",
"[",
"'ppl'",
"]",
",",
"1.30",
")"
] | [
514,
4
] | [
521,
47
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_compute_tokenized_bleu | (self) |
Test that the model outputs self-computed bleu correctly.
|
Test that the model outputs self-computed bleu correctly.
| def test_compute_tokenized_bleu(self):
"""
Test that the model outputs self-computed bleu correctly.
"""
valid, _ = testing_utils.eval_model(
dict(
task='integration_tests',
model_file='zoo:unittest/context_blocking/model',
dict_file='zoo:unittest/context_blocking/model.dict',
inference='greedy',
beam_size=1,
skip_generation=False,
compute_tokenized_bleu=True,
metrics='all',
)
)
try:
import fairseq # @manual # noqa: F401
assert valid['fairseq_bleu1'] > 0.9
except ImportError:
# fairseq not installed, let's just move on
pass
try:
import nltk # noqa: F401
assert valid['nltk_bleu1'] > 0.9
except ImportError:
# nltk not installed, let's just move on
pass | [
"def",
"test_compute_tokenized_bleu",
"(",
"self",
")",
":",
"valid",
",",
"_",
"=",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests'",
",",
"model_file",
"=",
"'zoo:unittest/context_blocking/model'",
",",
"dict_file",
"=",
"'zoo:unittest/context_blocking/model.dict'",
",",
"inference",
"=",
"'greedy'",
",",
"beam_size",
"=",
"1",
",",
"skip_generation",
"=",
"False",
",",
"compute_tokenized_bleu",
"=",
"True",
",",
"metrics",
"=",
"'all'",
",",
")",
")",
"try",
":",
"import",
"fairseq",
"# @manual # noqa: F401",
"assert",
"valid",
"[",
"'fairseq_bleu1'",
"]",
">",
"0.9",
"except",
"ImportError",
":",
"# fairseq not installed, let's just move on",
"pass",
"try",
":",
"import",
"nltk",
"# noqa: F401",
"assert",
"valid",
"[",
"'nltk_bleu1'",
"]",
">",
"0.9",
"except",
"ImportError",
":",
"# nltk not installed, let's just move on",
"pass"
] | [
524,
4
] | [
553,
16
] | python | en | ['en', 'error', 'th'] | False |
TestTransformerGenerator.test_temperature | (self) |
Test temperature.
|
Test temperature.
| def test_temperature(self):
"""
Test temperature.
"""
# Just ensuring no crash.
testing_utils.eval_model(
dict(
task='integration_tests:multiturn_candidate',
model='transformer/generator',
model_file='zoo:unittest/transformer_generator2/model',
batchsize=32,
inference='beam',
beam_size=5,
temperature=0.99,
)
) | [
"def",
"test_temperature",
"(",
"self",
")",
":",
"# Just ensuring no crash.",
"testing_utils",
".",
"eval_model",
"(",
"dict",
"(",
"task",
"=",
"'integration_tests:multiturn_candidate'",
",",
"model",
"=",
"'transformer/generator'",
",",
"model_file",
"=",
"'zoo:unittest/transformer_generator2/model'",
",",
"batchsize",
"=",
"32",
",",
"inference",
"=",
"'beam'",
",",
"beam_size",
"=",
"5",
",",
"temperature",
"=",
"0.99",
",",
")",
")"
] | [
592,
4
] | [
607,
9
] | python | en | ['en', 'error', 'th'] | False |
TestLearningRateScheduler._test_learning_rate_resuming | (self, user_args) |
Test learning rate resumes correctly.
|
Test learning rate resumes correctly.
| def _test_learning_rate_resuming(self, user_args):
"""
Test learning rate resumes correctly.
"""
args = dict(
task='integration_tests:overfit',
lr_scheduler='invsqrt',
optimizer='sgd',
learningrate=1e-3,
batchsize=4,
num_epochs=1,
n_layers=1,
n_heads=1,
ffn_size=4,
embedding_size=4,
)
args.update(user_args)
with testing_utils.tempdir() as tmpdir:
model_file = os.path.join(tmpdir, 'model')
args['model_file'] = model_file
valid1, test1 = testing_utils.train_model(args)
valid2, test2 = testing_utils.train_model(args)
# make sure the number of updates is being tracked correctly
self.assertGreater(
valid2['total_train_updates'],
valid1['total_train_updates'],
'Number of updates is not increasing',
)
# make sure the learning rate is decreasing
self.assertLess(
valid2['lr'], valid1['lr'], 'Learning rate is not decreasing'
)
del args['lr_scheduler']
del args['model_file']
# but make sure we're not loading the scheduler if we're fine
# tuning
valid3, test3 = testing_utils.train_model(
dict(
init_model=os.path.join(tmpdir, 'model'),
model_file=os.path.join(tmpdir, 'newmodel'),
lr_scheduler='invsqrt',
**args,
)
)
self.assertEqual(
valid3['total_train_updates'],
valid1['total_train_updates'],
'Finetuning LR scheduler reset failed (total_train_updates).',
)
self.assertEqual(
valid3['lr'], valid1['lr'], 'Finetuning LR scheduler reset failed (lr).'
)
# and make sure we're not loading the scheduler if it changes
valid4, test4 = testing_utils.train_model(
dict(
init_model=os.path.join(tmpdir, 'model'),
model_file=os.path.join(tmpdir, 'newmodel2'),
lr_scheduler='reduceonplateau',
log_every_n_secs=0.001,
**args,
)
)
self.assertEqual(
valid4['total_train_updates'],
valid1['total_train_updates'],
'LR scheduler change reset failed (total_train_updates).',
)
self.assertEqual(
valid4['lr'], 1e-3, '({}) LR is not correct in final resume.'
) | [
"def",
"_test_learning_rate_resuming",
"(",
"self",
",",
"user_args",
")",
":",
"args",
"=",
"dict",
"(",
"task",
"=",
"'integration_tests:overfit'",
",",
"lr_scheduler",
"=",
"'invsqrt'",
",",
"optimizer",
"=",
"'sgd'",
",",
"learningrate",
"=",
"1e-3",
",",
"batchsize",
"=",
"4",
",",
"num_epochs",
"=",
"1",
",",
"n_layers",
"=",
"1",
",",
"n_heads",
"=",
"1",
",",
"ffn_size",
"=",
"4",
",",
"embedding_size",
"=",
"4",
",",
")",
"args",
".",
"update",
"(",
"user_args",
")",
"with",
"testing_utils",
".",
"tempdir",
"(",
")",
"as",
"tmpdir",
":",
"model_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'model'",
")",
"args",
"[",
"'model_file'",
"]",
"=",
"model_file",
"valid1",
",",
"test1",
"=",
"testing_utils",
".",
"train_model",
"(",
"args",
")",
"valid2",
",",
"test2",
"=",
"testing_utils",
".",
"train_model",
"(",
"args",
")",
"# make sure the number of updates is being tracked correctly",
"self",
".",
"assertGreater",
"(",
"valid2",
"[",
"'total_train_updates'",
"]",
",",
"valid1",
"[",
"'total_train_updates'",
"]",
",",
"'Number of updates is not increasing'",
",",
")",
"# make sure the learning rate is decreasing",
"self",
".",
"assertLess",
"(",
"valid2",
"[",
"'lr'",
"]",
",",
"valid1",
"[",
"'lr'",
"]",
",",
"'Learning rate is not decreasing'",
")",
"del",
"args",
"[",
"'lr_scheduler'",
"]",
"del",
"args",
"[",
"'model_file'",
"]",
"# but make sure we're not loading the scheduler if we're fine",
"# tuning",
"valid3",
",",
"test3",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"init_model",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'model'",
")",
",",
"model_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'newmodel'",
")",
",",
"lr_scheduler",
"=",
"'invsqrt'",
",",
"*",
"*",
"args",
",",
")",
")",
"self",
".",
"assertEqual",
"(",
"valid3",
"[",
"'total_train_updates'",
"]",
",",
"valid1",
"[",
"'total_train_updates'",
"]",
",",
"'Finetuning LR scheduler reset failed (total_train_updates).'",
",",
")",
"self",
".",
"assertEqual",
"(",
"valid3",
"[",
"'lr'",
"]",
",",
"valid1",
"[",
"'lr'",
"]",
",",
"'Finetuning LR scheduler reset failed (lr).'",
")",
"# and make sure we're not loading the scheduler if it changes",
"valid4",
",",
"test4",
"=",
"testing_utils",
".",
"train_model",
"(",
"dict",
"(",
"init_model",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'model'",
")",
",",
"model_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tmpdir",
",",
"'newmodel2'",
")",
",",
"lr_scheduler",
"=",
"'reduceonplateau'",
",",
"log_every_n_secs",
"=",
"0.001",
",",
"*",
"*",
"args",
",",
")",
")",
"self",
".",
"assertEqual",
"(",
"valid4",
"[",
"'total_train_updates'",
"]",
",",
"valid1",
"[",
"'total_train_updates'",
"]",
",",
"'LR scheduler change reset failed (total_train_updates).'",
",",
")",
"self",
".",
"assertEqual",
"(",
"valid4",
"[",
"'lr'",
"]",
",",
"1e-3",
",",
"'({}) LR is not correct in final resume.'",
")"
] | [
646,
4
] | [
717,
13
] | python | en | ['en', 'error', 'th'] | False |
TestLearningRateScheduler.test_resuming_generator | (self) |
Test generators resume correctly.
|
Test generators resume correctly.
| def test_resuming_generator(self):
"""
Test generators resume correctly.
"""
GENERATOR_ARGS = dict(
model='transformer/generator', skip_generation=True, warmup_updates=1
)
self._test_learning_rate_resuming(GENERATOR_ARGS) | [
"def",
"test_resuming_generator",
"(",
"self",
")",
":",
"GENERATOR_ARGS",
"=",
"dict",
"(",
"model",
"=",
"'transformer/generator'",
",",
"skip_generation",
"=",
"True",
",",
"warmup_updates",
"=",
"1",
")",
"self",
".",
"_test_learning_rate_resuming",
"(",
"GENERATOR_ARGS",
")"
] | [
719,
4
] | [
726,
57
] | python | en | ['en', 'error', 'th'] | False |
TestLearningRateScheduler.test_resuming_ranker | (self) |
Test resuming learning rate for the ranker.
|
Test resuming learning rate for the ranker.
| def test_resuming_ranker(self):
"""
Test resuming learning rate for the ranker.
"""
RANKER_ARGS = dict(model='transformer/ranker', warmup_updates=1)
self._test_learning_rate_resuming(RANKER_ARGS) | [
"def",
"test_resuming_ranker",
"(",
"self",
")",
":",
"RANKER_ARGS",
"=",
"dict",
"(",
"model",
"=",
"'transformer/ranker'",
",",
"warmup_updates",
"=",
"1",
")",
"self",
".",
"_test_learning_rate_resuming",
"(",
"RANKER_ARGS",
")"
] | [
728,
4
] | [
733,
54
] | python | en | ['en', 'error', 'th'] | False |
BaseError.__init__ | (self, *args, error_code: str = None, **kwargs) | Initialize a BaseError instance. | Initialize a BaseError instance. | def __init__(self, *args, error_code: str = None, **kwargs):
"""Initialize a BaseError instance."""
super().__init__(*args, **kwargs)
if error_code:
self.error_code = error_code | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"error_code",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"error_code",
":",
"self",
".",
"error_code",
"=",
"error_code"
] | [
8,
4
] | [
12,
40
] | python | en | ['en', 'fy', 'en'] | True |
BaseError.message | (self) | Accessor for the error message. | Accessor for the error message. | def message(self) -> str:
"""Accessor for the error message."""
return self.args and self.args[0] | [
"def",
"message",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"args",
"and",
"self",
".",
"args",
"[",
"0",
"]"
] | [
15,
4
] | [
17,
41
] | python | en | ['en', 'it', 'en'] | True |
Title.font | (self) |
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.marker.colorbar.title.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.scattergeo.marker.colorbar.title.Font
|
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.marker.colorbar.title.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 this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattergeo.marker.colorbar.title.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.scattergeo.marker.colorbar.title.Font
"""
return self["font"] | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
15,
4
] | [
53,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.side | (self) |
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.
The 'side' property is an enumeration that may be specified as:
- One of the following enumeration values:
['right', 'top', 'bottom']
Returns
-------
Any
|
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.
The 'side' property is an enumeration that may be specified as:
- One of the following enumeration values:
['right', 'top', 'bottom'] | def side(self):
"""
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.
The 'side' property is an enumeration that may be specified as:
- One of the following enumeration values:
['right', 'top', 'bottom']
Returns
-------
Any
"""
return self["side"] | [
"def",
"side",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"side\"",
"]"
] | [
62,
4
] | [
76,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.text | (self) |
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def text(self):
"""
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["text"] | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
85,
4
] | [
99,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.__init__ | (self, arg=None, font=None, side=None, text=None, **kwargs) |
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scattergeo.mar
ker.colorbar.Title`
font
Sets this color bar's title font. Note that the title's
font used to be set by the now deprecated `titlefont`
attribute.
side
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.
text
Sets the title of the color bar. Note that before the
existence of `title.text`, the title's contents used to
be defined as the `title` attribute itself. This
behavior has been deprecated.
Returns
-------
Title
|
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scattergeo.mar
ker.colorbar.Title`
font
Sets this color bar's title font. Note that the title's
font used to be set by the now deprecated `titlefont`
attribute.
side
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.
text
Sets the title of the color bar. Note that before the
existence of `title.text`, the title's contents used to
be defined as the `title` attribute itself. This
behavior has been deprecated. | def __init__(self, arg=None, font=None, side=None, text=None, **kwargs):
"""
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scattergeo.mar
ker.colorbar.Title`
font
Sets this color bar's title font. Note that the title's
font used to be set by the now deprecated `titlefont`
attribute.
side
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.
text
Sets the title of the color bar. Note that before the
existence of `title.text`, the title's contents used to
be defined as the `title` attribute itself. This
behavior has been deprecated.
Returns
-------
Title
"""
super(Title, self).__init__("title")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.scattergeo.marker.colorbar.Title
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scattergeo.marker.colorbar.Title`"""
)
# 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("font", None)
_v = font if font is not None else _v
if _v is not None:
self["font"] = _v
_v = arg.pop("side", None)
_v = side if side is not None else _v
if _v is not None:
self["side"] = _v
_v = arg.pop("text", None)
_v = text if text is not None else _v
if _v is not None:
self["text"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"font",
"=",
"None",
",",
"side",
"=",
"None",
",",
"text",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Title",
",",
"self",
")",
".",
"__init__",
"(",
"\"title\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.scattergeo.marker.colorbar.Title \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.scattergeo.marker.colorbar.Title`\"\"\"",
")",
"# 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",
"(",
"\"font\"",
",",
"None",
")",
"_v",
"=",
"font",
"if",
"font",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"font\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"side\"",
",",
"None",
")",
"_v",
"=",
"side",
"if",
"side",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"side\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"text\"",
",",
"None",
")",
"_v",
"=",
"text",
"if",
"text",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"text\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
126,
4
] | [
203,
34
] | python | en | ['en', 'error', 'th'] | False |
Marker.color | (self) |
Sets the marker color of selected points.
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
|
Sets the marker color of selected points.
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):
"""
Sets the marker color of selected points.
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
] | [
65,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def opacity(self):
"""
Sets the marker opacity of selected points.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["opacity"] | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
74,
4
] | [
85,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, color=None, opacity=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points.
Returns
-------
Marker
|
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points. | def __init__(self, arg=None, color=None, opacity=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram.selected.Marker`
color
Sets the marker color of selected points.
opacity
Sets the marker opacity of selected points.
Returns
-------
Marker
"""
super(Marker, self).__init__("marker")
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.histogram.selected.Marker
constructor must be a dict or
an instance of :class:`plotly.graph_objs.histogram.selected.Marker`"""
)
# 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("opacity", None)
_v = opacity if opacity is not None else _v
if _v is not None:
self["opacity"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"marker\"",
")",
"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.histogram.selected.Marker \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.histogram.selected.Marker`\"\"\"",
")",
"# 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",
"(",
"\"opacity\"",
",",
"None",
")",
"_v",
"=",
"opacity",
"if",
"opacity",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"opacity\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
102,
4
] | [
165,
34
] | python | en | ['en', 'error', 'th'] | False |
ProtocolRegistry.__init__ | (self) | Initialize a `ProtocolRegistry` instance. | Initialize a `ProtocolRegistry` instance. | def __init__(self):
"""Initialize a `ProtocolRegistry` instance."""
self._controllers = {}
self._typemap = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_controllers",
"=",
"{",
"}",
"self",
".",
"_typemap",
"=",
"{",
"}"
] | [
11,
4
] | [
14,
26
] | python | en | ['en', 'en', 'it'] | True |
ProtocolRegistry.protocols | (self) | Accessor for a list of all message protocols. | Accessor for a list of all message protocols. | def protocols(self) -> Sequence[str]:
"""Accessor for a list of all message protocols."""
prots = set()
for message_type in self._typemap.keys():
pos = message_type.rfind("/")
if pos > 0:
family = message_type[:pos]
prots.add(family)
return prots | [
"def",
"protocols",
"(",
"self",
")",
"->",
"Sequence",
"[",
"str",
"]",
":",
"prots",
"=",
"set",
"(",
")",
"for",
"message_type",
"in",
"self",
".",
"_typemap",
".",
"keys",
"(",
")",
":",
"pos",
"=",
"message_type",
".",
"rfind",
"(",
"\"/\"",
")",
"if",
"pos",
">",
"0",
":",
"family",
"=",
"message_type",
"[",
":",
"pos",
"]",
"prots",
".",
"add",
"(",
"family",
")",
"return",
"prots"
] | [
17,
4
] | [
25,
20
] | python | en | ['en', 'en', 'en'] | True |
ProtocolRegistry.message_types | (self) | Accessor for a list of all message types. | Accessor for a list of all message types. | def message_types(self) -> Sequence[str]:
"""Accessor for a list of all message types."""
return tuple(self._typemap.keys()) | [
"def",
"message_types",
"(",
"self",
")",
"->",
"Sequence",
"[",
"str",
"]",
":",
"return",
"tuple",
"(",
"self",
".",
"_typemap",
".",
"keys",
"(",
")",
")"
] | [
28,
4
] | [
30,
42
] | python | en | ['en', 'en', 'en'] | True |
ProtocolRegistry.controllers | (self) | Accessor for a list of all protocol controller functions. | Accessor for a list of all protocol controller functions. | def controllers(self) -> Mapping[str, str]:
"""Accessor for a list of all protocol controller functions."""
return self._controllers.copy() | [
"def",
"controllers",
"(",
"self",
")",
"->",
"Mapping",
"[",
"str",
",",
"str",
"]",
":",
"return",
"self",
".",
"_controllers",
".",
"copy",
"(",
")"
] | [
33,
4
] | [
35,
39
] | python | en | ['en', 'en', 'en'] | True |
ProtocolRegistry.protocols_matching_query | (self, query: str) | Return a list of message protocols matching a query string. | Return a list of message protocols matching a query string. | def protocols_matching_query(self, query: str) -> Sequence[str]:
"""Return a list of message protocols matching a query string."""
all_types = self.protocols
result = None
if query == "*" or query is None:
result = all_types
elif query:
if query.endswith("*"):
match = query[:-1]
result = tuple(k for k in all_types if k.startswith(match))
elif query in all_types:
result = (query,)
return result or () | [
"def",
"protocols_matching_query",
"(",
"self",
",",
"query",
":",
"str",
")",
"->",
"Sequence",
"[",
"str",
"]",
":",
"all_types",
"=",
"self",
".",
"protocols",
"result",
"=",
"None",
"if",
"query",
"==",
"\"*\"",
"or",
"query",
"is",
"None",
":",
"result",
"=",
"all_types",
"elif",
"query",
":",
"if",
"query",
".",
"endswith",
"(",
"\"*\"",
")",
":",
"match",
"=",
"query",
"[",
":",
"-",
"1",
"]",
"result",
"=",
"tuple",
"(",
"k",
"for",
"k",
"in",
"all_types",
"if",
"k",
".",
"startswith",
"(",
"match",
")",
")",
"elif",
"query",
"in",
"all_types",
":",
"result",
"=",
"(",
"query",
",",
")",
"return",
"result",
"or",
"(",
")"
] | [
37,
4
] | [
50,
27
] | python | en | ['en', 'en', 'en'] | True |
ProtocolRegistry.register_message_types | (self, *typesets) |
Add new supported message types.
Args:
typesets: Mappings of message types to register
|
Add new supported message types. | def register_message_types(self, *typesets):
"""
Add new supported message types.
Args:
typesets: Mappings of message types to register
"""
for typeset in typesets:
self._typemap.update(typeset) | [
"def",
"register_message_types",
"(",
"self",
",",
"*",
"typesets",
")",
":",
"for",
"typeset",
"in",
"typesets",
":",
"self",
".",
"_typemap",
".",
"update",
"(",
"typeset",
")"
] | [
52,
4
] | [
61,
41
] | python | en | ['en', 'error', 'th'] | False |
ProtocolRegistry.register_controllers | (self, *controller_sets) |
Add new controllers.
Args:
controller_sets: Mappings of message families to coroutines
|
Add new controllers. | def register_controllers(self, *controller_sets):
"""
Add new controllers.
Args:
controller_sets: Mappings of message families to coroutines
"""
for controlset in controller_sets:
self._controllers.update(controlset) | [
"def",
"register_controllers",
"(",
"self",
",",
"*",
"controller_sets",
")",
":",
"for",
"controlset",
"in",
"controller_sets",
":",
"self",
".",
"_controllers",
".",
"update",
"(",
"controlset",
")"
] | [
63,
4
] | [
72,
48
] | python | en | ['en', 'error', 'th'] | False |
ProtocolRegistry.resolve_message_class | (self, message_type: str) |
Resolve a message_type to a message class.
Given a message type identifier, this method
returns the corresponding registered message class.
Args:
message_type: Message type to resolve
Returns:
The resolved message class
|
Resolve a message_type to a message class. | def resolve_message_class(self, message_type: str) -> type:
"""
Resolve a message_type to a message class.
Given a message type identifier, this method
returns the corresponding registered message class.
Args:
message_type: Message type to resolve
Returns:
The resolved message class
"""
msg_cls = self._typemap.get(message_type)
if isinstance(msg_cls, str):
msg_cls = ClassLoader.load_class(msg_cls)
return msg_cls | [
"def",
"resolve_message_class",
"(",
"self",
",",
"message_type",
":",
"str",
")",
"->",
"type",
":",
"msg_cls",
"=",
"self",
".",
"_typemap",
".",
"get",
"(",
"message_type",
")",
"if",
"isinstance",
"(",
"msg_cls",
",",
"str",
")",
":",
"msg_cls",
"=",
"ClassLoader",
".",
"load_class",
"(",
"msg_cls",
")",
"return",
"msg_cls"
] | [
74,
4
] | [
91,
22
] | python | en | ['en', 'error', 'th'] | False |
ProtocolRegistry.prepare_disclosed | (
self, context: InjectionContext, protocols: Sequence[str]
) | Call controllers and return publicly supported message families and roles. | Call controllers and return publicly supported message families and roles. | async def prepare_disclosed(
self, context: InjectionContext, protocols: Sequence[str]
):
"""Call controllers and return publicly supported message families and roles."""
published = []
for protocol in protocols:
result = {"pid": protocol}
if protocol in self._controllers:
ctl_cls = self._controllers[protocol]
if isinstance(ctl_cls, str):
ctl_cls = ClassLoader.load_class(ctl_cls)
ctl_instance = ctl_cls(protocol)
if hasattr(ctl_instance, "check_access"):
allowed = await ctl_instance.check_access(context)
if not allowed:
# remove from published
continue
if hasattr(ctl_instance, "determine_roles"):
roles = await ctl_instance.determine_roles(context)
if roles:
result["roles"] = list(roles)
published.append(result)
return published | [
"async",
"def",
"prepare_disclosed",
"(",
"self",
",",
"context",
":",
"InjectionContext",
",",
"protocols",
":",
"Sequence",
"[",
"str",
"]",
")",
":",
"published",
"=",
"[",
"]",
"for",
"protocol",
"in",
"protocols",
":",
"result",
"=",
"{",
"\"pid\"",
":",
"protocol",
"}",
"if",
"protocol",
"in",
"self",
".",
"_controllers",
":",
"ctl_cls",
"=",
"self",
".",
"_controllers",
"[",
"protocol",
"]",
"if",
"isinstance",
"(",
"ctl_cls",
",",
"str",
")",
":",
"ctl_cls",
"=",
"ClassLoader",
".",
"load_class",
"(",
"ctl_cls",
")",
"ctl_instance",
"=",
"ctl_cls",
"(",
"protocol",
")",
"if",
"hasattr",
"(",
"ctl_instance",
",",
"\"check_access\"",
")",
":",
"allowed",
"=",
"await",
"ctl_instance",
".",
"check_access",
"(",
"context",
")",
"if",
"not",
"allowed",
":",
"# remove from published",
"continue",
"if",
"hasattr",
"(",
"ctl_instance",
",",
"\"determine_roles\"",
")",
":",
"roles",
"=",
"await",
"ctl_instance",
".",
"determine_roles",
"(",
"context",
")",
"if",
"roles",
":",
"result",
"[",
"\"roles\"",
"]",
"=",
"list",
"(",
"roles",
")",
"published",
".",
"append",
"(",
"result",
")",
"return",
"published"
] | [
93,
4
] | [
115,
24
] | python | en | ['en', 'en', 'en'] | True |
ProtocolRegistry.__repr__ | (self) | Return a string representation for this class. | Return a string representation for this class. | def __repr__(self) -> str:
"""Return a string representation for this class."""
return "<{}>".format(self.__class__.__name__) | [
"def",
"__repr__",
"(",
"self",
")",
"->",
"str",
":",
"return",
"\"<{}>\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
")"
] | [
117,
4
] | [
119,
53
] | python | en | ['en', 'en', 'en'] | True |
repeat | (tensor, K) |
[B, ...] => [B*K, ...]
#-- Important --#
Used unsqueeze and transpose to avoid [K*B] when using torch.Tensor.repeat
|
[B, ...] => [B*K, ...] | def repeat(tensor, K):
"""
[B, ...] => [B*K, ...]
#-- Important --#
Used unsqueeze and transpose to avoid [K*B] when using torch.Tensor.repeat
"""
if isinstance(tensor, torch.Tensor):
B, *size = tensor.size()
repeat_size = [1] + [K] + [1] * (tensor.dim() - 1)
tensor = tensor.unsqueeze(1).repeat(*repeat_size).view(B * K, *size)
return tensor
elif isinstance(tensor, list):
out = []
for x in tensor:
for _ in range(K):
out.append(x.copy())
return out | [
"def",
"repeat",
"(",
"tensor",
",",
"K",
")",
":",
"if",
"isinstance",
"(",
"tensor",
",",
"torch",
".",
"Tensor",
")",
":",
"B",
",",
"",
"*",
"size",
"=",
"tensor",
".",
"size",
"(",
")",
"repeat_size",
"=",
"[",
"1",
"]",
"+",
"[",
"K",
"]",
"+",
"[",
"1",
"]",
"*",
"(",
"tensor",
".",
"dim",
"(",
")",
"-",
"1",
")",
"tensor",
"=",
"tensor",
".",
"unsqueeze",
"(",
"1",
")",
".",
"repeat",
"(",
"*",
"repeat_size",
")",
".",
"view",
"(",
"B",
"*",
"K",
",",
"*",
"size",
")",
"return",
"tensor",
"elif",
"isinstance",
"(",
"tensor",
",",
"list",
")",
":",
"out",
"=",
"[",
"]",
"for",
"x",
"in",
"tensor",
":",
"for",
"_",
"in",
"range",
"(",
"K",
")",
":",
"out",
".",
"append",
"(",
"x",
".",
"copy",
"(",
")",
")",
"return",
"out"
] | [
3,
0
] | [
20,
18
] | python | en | ['en', 'error', 'th'] | False |
setTTL | (qstate, ttl) | Updates return_msg TTL and the TTL of all the RRs | Updates return_msg TTL and the TTL of all the RRs | def setTTL(qstate, ttl):
"""Updates return_msg TTL and the TTL of all the RRs"""
if qstate.return_msg:
qstate.return_msg.rep.ttl = ttl
if (qstate.return_msg.rep):
for i in range(0,qstate.return_msg.rep.rrset_count):
d = qstate.return_msg.rep.rrsets[i].entry.data
for j in range(0,d.count+d.rrsig_count):
d.rr_ttl[j] = ttl | [
"def",
"setTTL",
"(",
"qstate",
",",
"ttl",
")",
":",
"if",
"qstate",
".",
"return_msg",
":",
"qstate",
".",
"return_msg",
".",
"rep",
".",
"ttl",
"=",
"ttl",
"if",
"(",
"qstate",
".",
"return_msg",
".",
"rep",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"qstate",
".",
"return_msg",
".",
"rep",
".",
"rrset_count",
")",
":",
"d",
"=",
"qstate",
".",
"return_msg",
".",
"rep",
".",
"rrsets",
"[",
"i",
"]",
".",
"entry",
".",
"data",
"for",
"j",
"in",
"range",
"(",
"0",
",",
"d",
".",
"count",
"+",
"d",
".",
"rrsig_count",
")",
":",
"d",
".",
"rr_ttl",
"[",
"j",
"]",
"=",
"ttl"
] | [
42,
0
] | [
50,
37
] | python | en | ['en', 'en', 'en'] | True |
Stream.maxpoints | (self) |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]
Returns
-------
int|float
|
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000] | def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]
Returns
-------
int|float
"""
return self["maxpoints"] | [
"def",
"maxpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxpoints\"",
"]"
] | [
15,
4
] | [
28,
32
] | python | en | ['en', 'error', 'th'] | False |
Stream.token | (self) |
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string | def token(self):
"""
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["token"] | [
"def",
"token",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"token\"",
"]"
] | [
37,
4
] | [
50,
28
] | python | en | ['en', 'error', 'th'] | False |
Stream.__init__ | (self, arg=None, maxpoints=None, token=None, **kwargs) |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.box.Stream`
maxpoints
Sets the maximum number of points to keep on the plots
from an incoming stream. If `maxpoints` is set to 50,
only the newest 50 points will be displayed on the
plot.
token
The stream id number links a data trace on a plot with
a stream. See https://chart-studio.plotly.com/settings
for more details.
Returns
-------
Stream
|
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.box.Stream`
maxpoints
Sets the maximum number of points to keep on the plots
from an incoming stream. If `maxpoints` is set to 50,
only the newest 50 points will be displayed on the
plot.
token
The stream id number links a data trace on a plot with
a stream. See https://chart-studio.plotly.com/settings
for more details. | def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):
"""
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.box.Stream`
maxpoints
Sets the maximum number of points to keep on the plots
from an incoming stream. If `maxpoints` is set to 50,
only the newest 50 points will be displayed on the
plot.
token
The stream id number links a data trace on a plot with
a stream. See https://chart-studio.plotly.com/settings
for more details.
Returns
-------
Stream
"""
super(Stream, self).__init__("stream")
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.box.Stream
constructor must be a dict or
an instance of :class:`plotly.graph_objs.box.Stream`"""
)
# 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("maxpoints", None)
_v = maxpoints if maxpoints is not None else _v
if _v is not None:
self["maxpoints"] = _v
_v = arg.pop("token", None)
_v = token if token is not None else _v
if _v is not None:
self["token"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"maxpoints",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Stream",
",",
"self",
")",
".",
"__init__",
"(",
"\"stream\"",
")",
"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.box.Stream \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.box.Stream`\"\"\"",
")",
"# 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",
"(",
"\"maxpoints\"",
",",
"None",
")",
"_v",
"=",
"maxpoints",
"if",
"maxpoints",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"maxpoints\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"token\"",
",",
"None",
")",
"_v",
"=",
"token",
"if",
"token",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"token\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
72,
4
] | [
139,
34
] | python | en | ['en', 'error', 'th'] | False |
CredentialIssueHandler.handle | (self, context: RequestContext, responder: BaseResponder) |
Message handler logic for credential offers.
Args:
context: request context
responder: responder callback
|
Message handler logic for credential offers. | async def handle(self, context: RequestContext, responder: BaseResponder):
"""
Message handler logic for credential offers.
Args:
context: request context
responder: responder callback
"""
self._logger.debug("CredentialHandler called with context %s", context)
assert isinstance(context.message, CredentialIssue)
self._logger.info(
"Received credential message: %s",
context.message.serialize(as_string=True)
)
if not context.connection_ready:
raise HandlerException("No connection established for credential request")
credential_manager = CredentialManager(context)
credential_exchange_record = await credential_manager.receive_credential()
# Automatically move to next state if flag is set
if context.settings.get("debug.auto_store_credential"):
(
credential_exchange_record,
credential_ack_message,
) = await credential_manager.store_credential(credential_exchange_record)
# Ack issuer that holder stored credential
await responder.send_reply(credential_ack_message) | [
"async",
"def",
"handle",
"(",
"self",
",",
"context",
":",
"RequestContext",
",",
"responder",
":",
"BaseResponder",
")",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"CredentialHandler called with context %s\"",
",",
"context",
")",
"assert",
"isinstance",
"(",
"context",
".",
"message",
",",
"CredentialIssue",
")",
"self",
".",
"_logger",
".",
"info",
"(",
"\"Received credential message: %s\"",
",",
"context",
".",
"message",
".",
"serialize",
"(",
"as_string",
"=",
"True",
")",
")",
"if",
"not",
"context",
".",
"connection_ready",
":",
"raise",
"HandlerException",
"(",
"\"No connection established for credential request\"",
")",
"credential_manager",
"=",
"CredentialManager",
"(",
"context",
")",
"credential_exchange_record",
"=",
"await",
"credential_manager",
".",
"receive_credential",
"(",
")",
"# Automatically move to next state if flag is set",
"if",
"context",
".",
"settings",
".",
"get",
"(",
"\"debug.auto_store_credential\"",
")",
":",
"(",
"credential_exchange_record",
",",
"credential_ack_message",
",",
")",
"=",
"await",
"credential_manager",
".",
"store_credential",
"(",
"credential_exchange_record",
")",
"# Ack issuer that holder stored credential",
"await",
"responder",
".",
"send_reply",
"(",
"credential_ack_message",
")"
] | [
17,
4
] | [
48,
62
] | python | en | ['en', 'error', 'th'] | False |
_update_store | (caller, key=None, desc=None, delete=False, swapkey=None) |
Helper function for updating the database store.
Args:
caller (Object): The caller of the command.
key (str): Description identifier
desc (str): Description text.
delete (bool): Delete given key.
swapkey (str): Swap list positions of `key` and this key.
|
Helper function for updating the database store. | def _update_store(caller, key=None, desc=None, delete=False, swapkey=None):
"""
Helper function for updating the database store.
Args:
caller (Object): The caller of the command.
key (str): Description identifier
desc (str): Description text.
delete (bool): Delete given key.
swapkey (str): Swap list positions of `key` and this key.
"""
if not caller.db.multidesc:
# initialize the multidesc attribute
caller.db.multidesc = [("caller", caller.db.desc or "")]
if not key:
return
lokey = key.lower()
match = [ind for ind, tup in enumerate(caller.db.multidesc) if tup[0] == lokey]
if match:
idesc = match[0]
if delete:
# delete entry
del caller.db.multidesc[idesc]
elif swapkey:
# swap positions
loswapkey = swapkey.lower()
swapmatch = [ind for ind, tup in enumerate(caller.db.multidesc) if tup[0] == loswapkey]
if swapmatch:
iswap = swapmatch[0]
if idesc == iswap:
raise DescValidateError("Swapping a key with itself does nothing.")
temp = caller.db.multidesc[idesc]
caller.db.multidesc[idesc] = caller.db.multidesc[iswap]
caller.db.multidesc[iswap] = temp
else:
raise DescValidateError("Description key '|w%s|n' not found." % swapkey)
elif desc:
# update in-place
caller.db.multidesc[idesc] = (lokey, desc)
else:
raise DescValidateError("No description was set.")
else:
# no matching key
if delete or swapkey:
raise DescValidateError("Description key '|w%s|n' not found." % key)
elif desc:
# insert new at the top of the stack
caller.db.multidesc.insert(0, (lokey, desc))
else:
raise DescValidateError("No description was set.") | [
"def",
"_update_store",
"(",
"caller",
",",
"key",
"=",
"None",
",",
"desc",
"=",
"None",
",",
"delete",
"=",
"False",
",",
"swapkey",
"=",
"None",
")",
":",
"if",
"not",
"caller",
".",
"db",
".",
"multidesc",
":",
"# initialize the multidesc attribute",
"caller",
".",
"db",
".",
"multidesc",
"=",
"[",
"(",
"\"caller\"",
",",
"caller",
".",
"db",
".",
"desc",
"or",
"\"\"",
")",
"]",
"if",
"not",
"key",
":",
"return",
"lokey",
"=",
"key",
".",
"lower",
"(",
")",
"match",
"=",
"[",
"ind",
"for",
"ind",
",",
"tup",
"in",
"enumerate",
"(",
"caller",
".",
"db",
".",
"multidesc",
")",
"if",
"tup",
"[",
"0",
"]",
"==",
"lokey",
"]",
"if",
"match",
":",
"idesc",
"=",
"match",
"[",
"0",
"]",
"if",
"delete",
":",
"# delete entry",
"del",
"caller",
".",
"db",
".",
"multidesc",
"[",
"idesc",
"]",
"elif",
"swapkey",
":",
"# swap positions",
"loswapkey",
"=",
"swapkey",
".",
"lower",
"(",
")",
"swapmatch",
"=",
"[",
"ind",
"for",
"ind",
",",
"tup",
"in",
"enumerate",
"(",
"caller",
".",
"db",
".",
"multidesc",
")",
"if",
"tup",
"[",
"0",
"]",
"==",
"loswapkey",
"]",
"if",
"swapmatch",
":",
"iswap",
"=",
"swapmatch",
"[",
"0",
"]",
"if",
"idesc",
"==",
"iswap",
":",
"raise",
"DescValidateError",
"(",
"\"Swapping a key with itself does nothing.\"",
")",
"temp",
"=",
"caller",
".",
"db",
".",
"multidesc",
"[",
"idesc",
"]",
"caller",
".",
"db",
".",
"multidesc",
"[",
"idesc",
"]",
"=",
"caller",
".",
"db",
".",
"multidesc",
"[",
"iswap",
"]",
"caller",
".",
"db",
".",
"multidesc",
"[",
"iswap",
"]",
"=",
"temp",
"else",
":",
"raise",
"DescValidateError",
"(",
"\"Description key '|w%s|n' not found.\"",
"%",
"swapkey",
")",
"elif",
"desc",
":",
"# update in-place",
"caller",
".",
"db",
".",
"multidesc",
"[",
"idesc",
"]",
"=",
"(",
"lokey",
",",
"desc",
")",
"else",
":",
"raise",
"DescValidateError",
"(",
"\"No description was set.\"",
")",
"else",
":",
"# no matching key",
"if",
"delete",
"or",
"swapkey",
":",
"raise",
"DescValidateError",
"(",
"\"Description key '|w%s|n' not found.\"",
"%",
"key",
")",
"elif",
"desc",
":",
"# insert new at the top of the stack",
"caller",
".",
"db",
".",
"multidesc",
".",
"insert",
"(",
"0",
",",
"(",
"lokey",
",",
"desc",
")",
")",
"else",
":",
"raise",
"DescValidateError",
"(",
"\"No description was set.\"",
")"
] | [
45,
0
] | [
95,
62
] | python | en | ['en', 'error', 'th'] | False |
_save_editor | (caller, buffer) | Called when the editor saves its contents | Called when the editor saves its contents | def _save_editor(caller, buffer):
"Called when the editor saves its contents"
key = caller.db._multidesc_editkey
_update_store(caller, key, buffer)
caller.msg("Saved description to key '%s'." % key)
return True | [
"def",
"_save_editor",
"(",
"caller",
",",
"buffer",
")",
":",
"key",
"=",
"caller",
".",
"db",
".",
"_multidesc_editkey",
"_update_store",
"(",
"caller",
",",
"key",
",",
"buffer",
")",
"caller",
".",
"msg",
"(",
"\"Saved description to key '%s'.\"",
"%",
"key",
")",
"return",
"True"
] | [
100,
0
] | [
105,
15
] | python | en | ['en', 'en', 'en'] | True |
_load_editor | (caller) | Called when the editor loads contents | Called when the editor loads contents | def _load_editor(caller):
"Called when the editor loads contents"
key = caller.db._multidesc_editkey
match = [ind for ind, tup in enumerate(caller.db.multidesc) if tup[0] == key]
if match:
return caller.db.multidesc[match[0]][1]
return "" | [
"def",
"_load_editor",
"(",
"caller",
")",
":",
"key",
"=",
"caller",
".",
"db",
".",
"_multidesc_editkey",
"match",
"=",
"[",
"ind",
"for",
"ind",
",",
"tup",
"in",
"enumerate",
"(",
"caller",
".",
"db",
".",
"multidesc",
")",
"if",
"tup",
"[",
"0",
"]",
"==",
"key",
"]",
"if",
"match",
":",
"return",
"caller",
".",
"db",
".",
"multidesc",
"[",
"match",
"[",
"0",
"]",
"]",
"[",
"1",
"]",
"return",
"\"\""
] | [
108,
0
] | [
114,
13
] | python | en | ['en', 'en', 'en'] | True |
_quit_editor | (caller) | Called when the editor quits | Called when the editor quits | def _quit_editor(caller):
"Called when the editor quits"
del caller.db._multidesc_editkey
caller.msg("Exited editor.") | [
"def",
"_quit_editor",
"(",
"caller",
")",
":",
"del",
"caller",
".",
"db",
".",
"_multidesc_editkey",
"caller",
".",
"msg",
"(",
"\"Exited editor.\"",
")"
] | [
117,
0
] | [
120,
32
] | python | en | ['en', 'en', 'en'] | True |
CmdMultiDesc.func | (self) |
Implements the multidescer. We will use `db.desc` for the
description in use and `db.multidesc` to store all descriptions.
|
Implements the multidescer. We will use `db.desc` for the
description in use and `db.multidesc` to store all descriptions.
| def func(self):
"""
Implements the multidescer. We will use `db.desc` for the
description in use and `db.multidesc` to store all descriptions.
"""
caller = self.caller
args = self.args.strip()
switches = self.switches
try:
if "list" in switches or "all" in switches:
# list all stored descriptions, either in full or cropped.
# Note that we list starting from 1, not from 0.
_update_store(caller)
do_crop = "full" not in switches
if do_crop:
outtext = ["|w%s:|n %s" % (key, crop(desc))
for key, desc in caller.db.multidesc]
else:
outtext = ["\n|w%s:|n|n\n%s\n%s" % (key, "-" * (len(key) + 1), desc)
for key, desc in caller.db.multidesc]
caller.msg("|wStored descs:|n\n" + "\n".join(outtext))
return
elif "edit" in switches:
# Use the eveditor to edit/create the named description
if not args:
caller.msg("Usage: %s/edit key" % self.key)
return
# this is used by the editor to know what to edit; it's deleted automatically
caller.db._multidesc_editkey = args
# start the editor
EvEditor(caller, loadfunc=_load_editor, savefunc=_save_editor,
quitfunc=_quit_editor, key="multidesc editor", persistent=True)
elif "delete" in switches or "del" in switches:
# delete a multidesc entry.
if not args:
caller.msg("Usage: %s/delete key" % self.key)
return
_update_store(caller, args, delete=True)
caller.msg("Deleted description with key '%s'." % args)
elif "swap" in switches or "switch" in switches or "reorder" in switches:
# Reorder list by swapping two entries. We expect numbers starting from 1
keys = [arg for arg in args.split("-", 1)]
if not len(keys) == 2:
caller.msg("Usage: %s/swap key1-key2" % self.key)
return
key1, key2 = keys
# perform the swap
_update_store(caller, key1, swapkey=key2)
caller.msg("Swapped descs '%s' and '%s'." % (key1, key2))
elif "set" in switches:
# switches one (or more) of the multidescs to be the "active" description
_update_store(caller)
if not args:
caller.msg("Usage: %s/set key [+ key2 + key3 + ...]" % self.key)
return
new_desc = []
multidesc = caller.db.multidesc
for key in args.split("+"):
notfound = True
lokey = key.strip().lower()
for mkey, desc in multidesc:
if lokey == mkey:
new_desc.append(desc)
notfound = False
continue
if notfound:
# if we get here, there is no desc match, we add it as a normal string
new_desc.append(key)
new_desc = "".join(new_desc)
caller.db.desc = new_desc
caller.msg("%s\n\n|wThe above was set as the current description.|n" % new_desc)
elif self.rhs or "add" in switches:
# add text directly to a new entry or an existing one.
if not (self.lhs and self.rhs):
caller.msg("Usage: %s/add key = description" % self.key)
return
key, desc = self.lhs, self.rhs
_update_store(caller, key, desc)
caller.msg("Stored description '%s': \"%s\"" % (key, crop(desc)))
else:
# display the current description or a numbered description
_update_store(caller)
if args:
key = args.lower()
multidesc = caller.db.multidesc
for mkey, desc in multidesc:
if key == mkey:
caller.msg("|wDecsription %s:|n\n%s" % (key, desc))
return
caller.msg("Description key '%s' not found." % key)
else:
caller.msg("|wCurrent desc:|n\n%s" % caller.db.desc)
except DescValidateError as err:
# This is triggered by _key_to_index
caller.msg(err) | [
"def",
"func",
"(",
"self",
")",
":",
"caller",
"=",
"self",
".",
"caller",
"args",
"=",
"self",
".",
"args",
".",
"strip",
"(",
")",
"switches",
"=",
"self",
".",
"switches",
"try",
":",
"if",
"\"list\"",
"in",
"switches",
"or",
"\"all\"",
"in",
"switches",
":",
"# list all stored descriptions, either in full or cropped.",
"# Note that we list starting from 1, not from 0.",
"_update_store",
"(",
"caller",
")",
"do_crop",
"=",
"\"full\"",
"not",
"in",
"switches",
"if",
"do_crop",
":",
"outtext",
"=",
"[",
"\"|w%s:|n %s\"",
"%",
"(",
"key",
",",
"crop",
"(",
"desc",
")",
")",
"for",
"key",
",",
"desc",
"in",
"caller",
".",
"db",
".",
"multidesc",
"]",
"else",
":",
"outtext",
"=",
"[",
"\"\\n|w%s:|n|n\\n%s\\n%s\"",
"%",
"(",
"key",
",",
"\"-\"",
"*",
"(",
"len",
"(",
"key",
")",
"+",
"1",
")",
",",
"desc",
")",
"for",
"key",
",",
"desc",
"in",
"caller",
".",
"db",
".",
"multidesc",
"]",
"caller",
".",
"msg",
"(",
"\"|wStored descs:|n\\n\"",
"+",
"\"\\n\"",
".",
"join",
"(",
"outtext",
")",
")",
"return",
"elif",
"\"edit\"",
"in",
"switches",
":",
"# Use the eveditor to edit/create the named description",
"if",
"not",
"args",
":",
"caller",
".",
"msg",
"(",
"\"Usage: %s/edit key\"",
"%",
"self",
".",
"key",
")",
"return",
"# this is used by the editor to know what to edit; it's deleted automatically",
"caller",
".",
"db",
".",
"_multidesc_editkey",
"=",
"args",
"# start the editor",
"EvEditor",
"(",
"caller",
",",
"loadfunc",
"=",
"_load_editor",
",",
"savefunc",
"=",
"_save_editor",
",",
"quitfunc",
"=",
"_quit_editor",
",",
"key",
"=",
"\"multidesc editor\"",
",",
"persistent",
"=",
"True",
")",
"elif",
"\"delete\"",
"in",
"switches",
"or",
"\"del\"",
"in",
"switches",
":",
"# delete a multidesc entry.",
"if",
"not",
"args",
":",
"caller",
".",
"msg",
"(",
"\"Usage: %s/delete key\"",
"%",
"self",
".",
"key",
")",
"return",
"_update_store",
"(",
"caller",
",",
"args",
",",
"delete",
"=",
"True",
")",
"caller",
".",
"msg",
"(",
"\"Deleted description with key '%s'.\"",
"%",
"args",
")",
"elif",
"\"swap\"",
"in",
"switches",
"or",
"\"switch\"",
"in",
"switches",
"or",
"\"reorder\"",
"in",
"switches",
":",
"# Reorder list by swapping two entries. We expect numbers starting from 1",
"keys",
"=",
"[",
"arg",
"for",
"arg",
"in",
"args",
".",
"split",
"(",
"\"-\"",
",",
"1",
")",
"]",
"if",
"not",
"len",
"(",
"keys",
")",
"==",
"2",
":",
"caller",
".",
"msg",
"(",
"\"Usage: %s/swap key1-key2\"",
"%",
"self",
".",
"key",
")",
"return",
"key1",
",",
"key2",
"=",
"keys",
"# perform the swap",
"_update_store",
"(",
"caller",
",",
"key1",
",",
"swapkey",
"=",
"key2",
")",
"caller",
".",
"msg",
"(",
"\"Swapped descs '%s' and '%s'.\"",
"%",
"(",
"key1",
",",
"key2",
")",
")",
"elif",
"\"set\"",
"in",
"switches",
":",
"# switches one (or more) of the multidescs to be the \"active\" description",
"_update_store",
"(",
"caller",
")",
"if",
"not",
"args",
":",
"caller",
".",
"msg",
"(",
"\"Usage: %s/set key [+ key2 + key3 + ...]\"",
"%",
"self",
".",
"key",
")",
"return",
"new_desc",
"=",
"[",
"]",
"multidesc",
"=",
"caller",
".",
"db",
".",
"multidesc",
"for",
"key",
"in",
"args",
".",
"split",
"(",
"\"+\"",
")",
":",
"notfound",
"=",
"True",
"lokey",
"=",
"key",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"for",
"mkey",
",",
"desc",
"in",
"multidesc",
":",
"if",
"lokey",
"==",
"mkey",
":",
"new_desc",
".",
"append",
"(",
"desc",
")",
"notfound",
"=",
"False",
"continue",
"if",
"notfound",
":",
"# if we get here, there is no desc match, we add it as a normal string",
"new_desc",
".",
"append",
"(",
"key",
")",
"new_desc",
"=",
"\"\"",
".",
"join",
"(",
"new_desc",
")",
"caller",
".",
"db",
".",
"desc",
"=",
"new_desc",
"caller",
".",
"msg",
"(",
"\"%s\\n\\n|wThe above was set as the current description.|n\"",
"%",
"new_desc",
")",
"elif",
"self",
".",
"rhs",
"or",
"\"add\"",
"in",
"switches",
":",
"# add text directly to a new entry or an existing one.",
"if",
"not",
"(",
"self",
".",
"lhs",
"and",
"self",
".",
"rhs",
")",
":",
"caller",
".",
"msg",
"(",
"\"Usage: %s/add key = description\"",
"%",
"self",
".",
"key",
")",
"return",
"key",
",",
"desc",
"=",
"self",
".",
"lhs",
",",
"self",
".",
"rhs",
"_update_store",
"(",
"caller",
",",
"key",
",",
"desc",
")",
"caller",
".",
"msg",
"(",
"\"Stored description '%s': \\\"%s\\\"\"",
"%",
"(",
"key",
",",
"crop",
"(",
"desc",
")",
")",
")",
"else",
":",
"# display the current description or a numbered description",
"_update_store",
"(",
"caller",
")",
"if",
"args",
":",
"key",
"=",
"args",
".",
"lower",
"(",
")",
"multidesc",
"=",
"caller",
".",
"db",
".",
"multidesc",
"for",
"mkey",
",",
"desc",
"in",
"multidesc",
":",
"if",
"key",
"==",
"mkey",
":",
"caller",
".",
"msg",
"(",
"\"|wDecsription %s:|n\\n%s\"",
"%",
"(",
"key",
",",
"desc",
")",
")",
"return",
"caller",
".",
"msg",
"(",
"\"Description key '%s' not found.\"",
"%",
"key",
")",
"else",
":",
"caller",
".",
"msg",
"(",
"\"|wCurrent desc:|n\\n%s\"",
"%",
"caller",
".",
"db",
".",
"desc",
")",
"except",
"DescValidateError",
"as",
"err",
":",
"# This is triggered by _key_to_index",
"caller",
".",
"msg",
"(",
"err",
")"
] | [
151,
4
] | [
256,
27
] | python | en | ['en', 'error', 'th'] | False |
merge_aug_bboxes_3d | (aug_results, img_metas, test_cfg) | Merge augmented detection 3D bboxes and scores.
Args:
aug_results (list[dict]): The dict of detection results.
The dict contains the following keys
- boxes_3d (:obj:`BaseInstance3DBoxes`): Detection bbox.
- scores_3d (torch.Tensor): Detection scores.
- labels_3d (torch.Tensor): Predicted box labels.
img_metas (list[dict]): Meta information of each sample.
test_cfg (dict): Test config.
Returns:
dict: Bounding boxes results in cpu mode, containing merged results.
- boxes_3d (:obj:`BaseInstance3DBoxes`): Merged detection bbox.
- scores_3d (torch.Tensor): Merged detection scores.
- labels_3d (torch.Tensor): Merged predicted box labels.
| Merge augmented detection 3D bboxes and scores. | def merge_aug_bboxes_3d(aug_results, img_metas, test_cfg):
"""Merge augmented detection 3D bboxes and scores.
Args:
aug_results (list[dict]): The dict of detection results.
The dict contains the following keys
- boxes_3d (:obj:`BaseInstance3DBoxes`): Detection bbox.
- scores_3d (torch.Tensor): Detection scores.
- labels_3d (torch.Tensor): Predicted box labels.
img_metas (list[dict]): Meta information of each sample.
test_cfg (dict): Test config.
Returns:
dict: Bounding boxes results in cpu mode, containing merged results.
- boxes_3d (:obj:`BaseInstance3DBoxes`): Merged detection bbox.
- scores_3d (torch.Tensor): Merged detection scores.
- labels_3d (torch.Tensor): Merged predicted box labels.
"""
assert len(aug_results) == len(img_metas), \
'"aug_results" should have the same length as "img_metas", got len(' \
f'aug_results)={len(aug_results)} and len(img_metas)={len(img_metas)}'
recovered_bboxes = []
recovered_scores = []
recovered_labels = []
for bboxes, img_info in zip(aug_results, img_metas):
scale_factor = img_info[0]['pcd_scale_factor']
pcd_horizontal_flip = img_info[0]['pcd_horizontal_flip']
pcd_vertical_flip = img_info[0]['pcd_vertical_flip']
recovered_scores.append(bboxes['scores_3d'])
recovered_labels.append(bboxes['labels_3d'])
bboxes = bbox3d_mapping_back(bboxes['boxes_3d'], scale_factor,
pcd_horizontal_flip, pcd_vertical_flip)
recovered_bboxes.append(bboxes)
aug_bboxes = recovered_bboxes[0].cat(recovered_bboxes)
aug_bboxes_for_nms = xywhr2xyxyr(aug_bboxes.bev)
aug_scores = torch.cat(recovered_scores, dim=0)
aug_labels = torch.cat(recovered_labels, dim=0)
# TODO: use a more elegent way to deal with nms
if test_cfg.use_rotate_nms:
nms_func = nms_gpu
else:
nms_func = nms_normal_gpu
merged_bboxes = []
merged_scores = []
merged_labels = []
# Apply multi-class nms when merge bboxes
if len(aug_labels) == 0:
return bbox3d2result(aug_bboxes, aug_scores, aug_labels)
for class_id in range(torch.max(aug_labels).item() + 1):
class_inds = (aug_labels == class_id)
bboxes_i = aug_bboxes[class_inds]
bboxes_nms_i = aug_bboxes_for_nms[class_inds, :]
scores_i = aug_scores[class_inds]
labels_i = aug_labels[class_inds]
if len(bboxes_nms_i) == 0:
continue
selected = nms_func(bboxes_nms_i, scores_i, test_cfg.nms_thr)
merged_bboxes.append(bboxes_i[selected, :])
merged_scores.append(scores_i[selected])
merged_labels.append(labels_i[selected])
merged_bboxes = merged_bboxes[0].cat(merged_bboxes)
merged_scores = torch.cat(merged_scores, dim=0)
merged_labels = torch.cat(merged_labels, dim=0)
_, order = merged_scores.sort(0, descending=True)
num = min(test_cfg.max_num, len(aug_bboxes))
order = order[:num]
merged_bboxes = merged_bboxes[order]
merged_scores = merged_scores[order]
merged_labels = merged_labels[order]
return bbox3d2result(merged_bboxes, merged_scores, merged_labels) | [
"def",
"merge_aug_bboxes_3d",
"(",
"aug_results",
",",
"img_metas",
",",
"test_cfg",
")",
":",
"assert",
"len",
"(",
"aug_results",
")",
"==",
"len",
"(",
"img_metas",
")",
",",
"'\"aug_results\" should have the same length as \"img_metas\", got len('",
"f'aug_results)={len(aug_results)} and len(img_metas)={len(img_metas)}'",
"recovered_bboxes",
"=",
"[",
"]",
"recovered_scores",
"=",
"[",
"]",
"recovered_labels",
"=",
"[",
"]",
"for",
"bboxes",
",",
"img_info",
"in",
"zip",
"(",
"aug_results",
",",
"img_metas",
")",
":",
"scale_factor",
"=",
"img_info",
"[",
"0",
"]",
"[",
"'pcd_scale_factor'",
"]",
"pcd_horizontal_flip",
"=",
"img_info",
"[",
"0",
"]",
"[",
"'pcd_horizontal_flip'",
"]",
"pcd_vertical_flip",
"=",
"img_info",
"[",
"0",
"]",
"[",
"'pcd_vertical_flip'",
"]",
"recovered_scores",
".",
"append",
"(",
"bboxes",
"[",
"'scores_3d'",
"]",
")",
"recovered_labels",
".",
"append",
"(",
"bboxes",
"[",
"'labels_3d'",
"]",
")",
"bboxes",
"=",
"bbox3d_mapping_back",
"(",
"bboxes",
"[",
"'boxes_3d'",
"]",
",",
"scale_factor",
",",
"pcd_horizontal_flip",
",",
"pcd_vertical_flip",
")",
"recovered_bboxes",
".",
"append",
"(",
"bboxes",
")",
"aug_bboxes",
"=",
"recovered_bboxes",
"[",
"0",
"]",
".",
"cat",
"(",
"recovered_bboxes",
")",
"aug_bboxes_for_nms",
"=",
"xywhr2xyxyr",
"(",
"aug_bboxes",
".",
"bev",
")",
"aug_scores",
"=",
"torch",
".",
"cat",
"(",
"recovered_scores",
",",
"dim",
"=",
"0",
")",
"aug_labels",
"=",
"torch",
".",
"cat",
"(",
"recovered_labels",
",",
"dim",
"=",
"0",
")",
"# TODO: use a more elegent way to deal with nms",
"if",
"test_cfg",
".",
"use_rotate_nms",
":",
"nms_func",
"=",
"nms_gpu",
"else",
":",
"nms_func",
"=",
"nms_normal_gpu",
"merged_bboxes",
"=",
"[",
"]",
"merged_scores",
"=",
"[",
"]",
"merged_labels",
"=",
"[",
"]",
"# Apply multi-class nms when merge bboxes",
"if",
"len",
"(",
"aug_labels",
")",
"==",
"0",
":",
"return",
"bbox3d2result",
"(",
"aug_bboxes",
",",
"aug_scores",
",",
"aug_labels",
")",
"for",
"class_id",
"in",
"range",
"(",
"torch",
".",
"max",
"(",
"aug_labels",
")",
".",
"item",
"(",
")",
"+",
"1",
")",
":",
"class_inds",
"=",
"(",
"aug_labels",
"==",
"class_id",
")",
"bboxes_i",
"=",
"aug_bboxes",
"[",
"class_inds",
"]",
"bboxes_nms_i",
"=",
"aug_bboxes_for_nms",
"[",
"class_inds",
",",
":",
"]",
"scores_i",
"=",
"aug_scores",
"[",
"class_inds",
"]",
"labels_i",
"=",
"aug_labels",
"[",
"class_inds",
"]",
"if",
"len",
"(",
"bboxes_nms_i",
")",
"==",
"0",
":",
"continue",
"selected",
"=",
"nms_func",
"(",
"bboxes_nms_i",
",",
"scores_i",
",",
"test_cfg",
".",
"nms_thr",
")",
"merged_bboxes",
".",
"append",
"(",
"bboxes_i",
"[",
"selected",
",",
":",
"]",
")",
"merged_scores",
".",
"append",
"(",
"scores_i",
"[",
"selected",
"]",
")",
"merged_labels",
".",
"append",
"(",
"labels_i",
"[",
"selected",
"]",
")",
"merged_bboxes",
"=",
"merged_bboxes",
"[",
"0",
"]",
".",
"cat",
"(",
"merged_bboxes",
")",
"merged_scores",
"=",
"torch",
".",
"cat",
"(",
"merged_scores",
",",
"dim",
"=",
"0",
")",
"merged_labels",
"=",
"torch",
".",
"cat",
"(",
"merged_labels",
",",
"dim",
"=",
"0",
")",
"_",
",",
"order",
"=",
"merged_scores",
".",
"sort",
"(",
"0",
",",
"descending",
"=",
"True",
")",
"num",
"=",
"min",
"(",
"test_cfg",
".",
"max_num",
",",
"len",
"(",
"aug_bboxes",
")",
")",
"order",
"=",
"order",
"[",
":",
"num",
"]",
"merged_bboxes",
"=",
"merged_bboxes",
"[",
"order",
"]",
"merged_scores",
"=",
"merged_scores",
"[",
"order",
"]",
"merged_labels",
"=",
"merged_labels",
"[",
"order",
"]",
"return",
"bbox3d2result",
"(",
"merged_bboxes",
",",
"merged_scores",
",",
"merged_labels",
")"
] | [
6,
0
] | [
90,
69
] | python | en | ['en', 'en', 'en'] | True |
Scattermapbox.below | (self) |
Determines if this scattermapbox trace's layers are to be
inserted before the layer with the specified ID. By default,
scattermapbox layers are inserted above all the base layers. To
place the scattermapbox layers above every other layer, set
`below` to "''".
The 'below' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Determines if this scattermapbox trace's layers are to be
inserted before the layer with the specified ID. By default,
scattermapbox layers are inserted above all the base layers. To
place the scattermapbox layers above every other layer, set
`below` to "''".
The 'below' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def below(self):
"""
Determines if this scattermapbox trace's layers are to be
inserted before the layer with the specified ID. By default,
scattermapbox layers are inserted above all the base layers. To
place the scattermapbox layers above every other layer, set
`below` to "''".
The 'below' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["below"] | [
"def",
"below",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"below\"",
"]"
] | [
59,
4
] | [
75,
28
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.connectgaps | (self) |
Determines whether or not gaps (i.e. {nan} or missing values)
in the provided data arrays are connected.
The 'connectgaps' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not gaps (i.e. {nan} or missing values)
in the provided data arrays are connected.
The 'connectgaps' property must be specified as a bool
(either True, or False) | def connectgaps(self):
"""
Determines whether or not gaps (i.e. {nan} or missing values)
in the provided data arrays are connected.
The 'connectgaps' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["connectgaps"] | [
"def",
"connectgaps",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"connectgaps\"",
"]"
] | [
84,
4
] | [
96,
34
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.customdata | (self) |
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def customdata(self):
"""
Assigns extra data each datum. This may be useful when
listening to hover, click and selection events. Note that,
"scatter" traces also appends customdata items in the markers
DOM elements
The 'customdata' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["customdata"] | [
"def",
"customdata",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdata\"",
"]"
] | [
105,
4
] | [
119,
33
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.customdatasrc | (self) |
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def customdatasrc(self):
"""
Sets the source reference on Chart Studio Cloud for customdata
.
The 'customdatasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["customdatasrc"] | [
"def",
"customdatasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"customdatasrc\"",
"]"
] | [
128,
4
] | [
140,
36
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.fill | (self) |
Sets the area to fill with a solid color. Use with `fillcolor`
if not "none". "toself" connects the endpoints of the trace (or
each segment of the trace if it has gaps) into a closed shape.
The 'fill' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'toself']
Returns
-------
Any
|
Sets the area to fill with a solid color. Use with `fillcolor`
if not "none". "toself" connects the endpoints of the trace (or
each segment of the trace if it has gaps) into a closed shape.
The 'fill' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'toself'] | def fill(self):
"""
Sets the area to fill with a solid color. Use with `fillcolor`
if not "none". "toself" connects the endpoints of the trace (or
each segment of the trace if it has gaps) into a closed shape.
The 'fill' property is an enumeration that may be specified as:
- One of the following enumeration values:
['none', 'toself']
Returns
-------
Any
"""
return self["fill"] | [
"def",
"fill",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"fill\"",
"]"
] | [
149,
4
] | [
163,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.fillcolor | (self) |
Sets the fill color. Defaults to a half-transparent variant of
the line color, marker color, or marker line color, whichever
is available.
The 'fillcolor' 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 fill color. Defaults to a half-transparent variant of
the line color, marker color, or marker line color, whichever
is available.
The 'fillcolor' 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 fillcolor(self):
"""
Sets the fill color. Defaults to a half-transparent variant of
the line color, marker color, or marker line color, whichever
is available.
The 'fillcolor' 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["fillcolor"] | [
"def",
"fillcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"fillcolor\"",
"]"
] | [
172,
4
] | [
224,
32
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hoverinfo | (self) |
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lon', 'lat', 'text', 'name'] joined with '+' characters
(e.g. 'lon+lat')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above
Returns
-------
Any|numpy.ndarray
|
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lon', 'lat', 'text', 'name'] joined with '+' characters
(e.g. 'lon+lat')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above | def hoverinfo(self):
"""
Determines which trace information appear on hover. If `none`
or `skip` are set, no information is displayed upon hovering.
But, if `none` is set, click and hover events are still fired.
The 'hoverinfo' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lon', 'lat', 'text', 'name'] joined with '+' characters
(e.g. 'lon+lat')
OR exactly one of ['all', 'none', 'skip'] (e.g. 'skip')
- A list or array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["hoverinfo"] | [
"def",
"hoverinfo",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverinfo\"",
"]"
] | [
233,
4
] | [
250,
32
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hoverinfosrc | (self) |
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def hoverinfosrc(self):
"""
Sets the source reference on Chart Studio Cloud for hoverinfo
.
The 'hoverinfosrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["hoverinfosrc"] | [
"def",
"hoverinfosrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverinfosrc\"",
"]"
] | [
259,
4
] | [
271,
35
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hoverlabel | (self) |
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength .
Returns
-------
plotly.graph_objs.scattermapbox.Hoverlabel
|
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength . | def hoverlabel(self):
"""
The 'hoverlabel' property is an instance of Hoverlabel
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Hoverlabel`
- A dict of string/value properties that will be passed
to the Hoverlabel constructor
Supported dict properties:
align
Sets the horizontal alignment of the text
content within hover label box. Has an effect
only if the hover label text spans more two or
more lines
alignsrc
Sets the source reference on Chart Studio Cloud
for align .
bgcolor
Sets the background color of the hover labels
for this trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud
for bgcolor .
bordercolor
Sets the border color of the hover labels for
this trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud
for bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of
characters) of the trace name in the hover
labels for all traces. -1 shows the whole name
regardless of length. 0-3 shows the first 0-3
characters, and an integer >3 will show the
whole name if it is less than that many
characters, but if it is longer, will truncate
to `namelength - 3` characters and add an
ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud
for namelength .
Returns
-------
plotly.graph_objs.scattermapbox.Hoverlabel
"""
return self["hoverlabel"] | [
"def",
"hoverlabel",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hoverlabel\"",
"]"
] | [
280,
4
] | [
330,
33
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hovertemplate | (self) |
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. The variables available in
`hovertemplate` are the ones emitted as event data described at
this link https://plotly.com/javascript/plotlyjs-events/#event-
data. Additionally, every attributes that can be specified per-
point (the ones that are `arrayOk: true`) are available.
Anything contained in tag `<extra>` is displayed in the
secondary box, for example "<extra>{fullData.name}</extra>". To
hide the secondary box completely, use an empty tag
`<extra></extra>`.
The 'hovertemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. The variables available in
`hovertemplate` are the ones emitted as event data described at
this link https://plotly.com/javascript/plotlyjs-events/#event-
data. Additionally, every attributes that can be specified per-
point (the ones that are `arrayOk: true`) are available.
Anything contained in tag `<extra>` is displayed in the
secondary box, for example "<extra>{fullData.name}</extra>". To
hide the secondary box completely, use an empty tag
`<extra></extra>`.
The 'hovertemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def hovertemplate(self):
"""
Template string used for rendering the information that appear
on hover box. Note that this will override `hoverinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. The variables available in
`hovertemplate` are the ones emitted as event data described at
this link https://plotly.com/javascript/plotlyjs-events/#event-
data. Additionally, every attributes that can be specified per-
point (the ones that are `arrayOk: true`) are available.
Anything contained in tag `<extra>` is displayed in the
secondary box, for example "<extra>{fullData.name}</extra>". To
hide the secondary box completely, use an empty tag
`<extra></extra>`.
The 'hovertemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["hovertemplate"] | [
"def",
"hovertemplate",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertemplate\"",
"]"
] | [
339,
4
] | [
371,
36
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hovertemplatesrc | (self) |
Sets the source reference on Chart Studio Cloud for
hovertemplate .
The 'hovertemplatesrc' 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
hovertemplate .
The 'hovertemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def hovertemplatesrc(self):
"""
Sets the source reference on Chart Studio Cloud for
hovertemplate .
The 'hovertemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["hovertemplatesrc"] | [
"def",
"hovertemplatesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertemplatesrc\"",
"]"
] | [
380,
4
] | [
392,
39
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hovertext | (self) |
Sets hover text elements associated with each (lon,lat) pair If
a single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. To be seen, trace
`hoverinfo` must contain a "text" flag.
The 'hovertext' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Sets hover text elements associated with each (lon,lat) pair If
a single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. To be seen, trace
`hoverinfo` must contain a "text" flag.
The 'hovertext' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def hovertext(self):
"""
Sets hover text elements associated with each (lon,lat) pair If
a single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. To be seen, trace
`hoverinfo` must contain a "text" flag.
The 'hovertext' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["hovertext"] | [
"def",
"hovertext",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertext\"",
"]"
] | [
401,
4
] | [
418,
32
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.hovertextsrc | (self) |
Sets the source reference on Chart Studio Cloud for hovertext
.
The 'hovertextsrc' 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 hovertext
.
The 'hovertextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def hovertextsrc(self):
"""
Sets the source reference on Chart Studio Cloud for hovertext
.
The 'hovertextsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["hovertextsrc"] | [
"def",
"hovertextsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"hovertextsrc\"",
"]"
] | [
427,
4
] | [
439,
35
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.ids | (self) |
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def ids(self):
"""
Assigns id labels to each datum. These ids for object constancy
of data points during animation. Should be an array of strings,
not numbers or any other type.
The 'ids' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["ids"] | [
"def",
"ids",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"ids\"",
"]"
] | [
448,
4
] | [
461,
26
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.idssrc | (self) |
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def idssrc(self):
"""
Sets the source reference on Chart Studio Cloud for ids .
The 'idssrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["idssrc"] | [
"def",
"idssrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"idssrc\"",
"]"
] | [
470,
4
] | [
481,
29
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.lat | (self) |
Sets the latitude coordinates (in degrees North).
The 'lat' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the latitude coordinates (in degrees North).
The 'lat' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def lat(self):
"""
Sets the latitude coordinates (in degrees North).
The 'lat' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["lat"] | [
"def",
"lat",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"lat\"",
"]"
] | [
490,
4
] | [
501,
26
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.latsrc | (self) |
Sets the source reference on Chart Studio Cloud for lat .
The 'latsrc' 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 lat .
The 'latsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def latsrc(self):
"""
Sets the source reference on Chart Studio Cloud for lat .
The 'latsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["latsrc"] | [
"def",
"latsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"latsrc\"",
"]"
] | [
510,
4
] | [
521,
29
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.legendgroup | (self) |
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def legendgroup(self):
"""
Sets the legend group for this trace. Traces part of the same
legend group hide/show at the same time when toggling legend
items.
The 'legendgroup' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["legendgroup"] | [
"def",
"legendgroup",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"legendgroup\"",
"]"
] | [
530,
4
] | [
544,
34
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
color
Sets the line color.
width
Sets the line width (in px).
Returns
-------
plotly.graph_objs.scattermapbox.Line
|
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
color
Sets the line color.
width
Sets the line width (in px). | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
color
Sets the line color.
width
Sets the line width (in px).
Returns
-------
plotly.graph_objs.scattermapbox.Line
"""
return self["line"] | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
553,
4
] | [
572,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.lon | (self) |
Sets the longitude coordinates (in degrees East).
The 'lon' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the longitude coordinates (in degrees East).
The 'lon' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def lon(self):
"""
Sets the longitude coordinates (in degrees East).
The 'lon' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["lon"] | [
"def",
"lon",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"lon\"",
"]"
] | [
581,
4
] | [
592,
26
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.lonsrc | (self) |
Sets the source reference on Chart Studio Cloud for lon .
The 'lonsrc' 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 lon .
The 'lonsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def lonsrc(self):
"""
Sets the source reference on Chart Studio Cloud for lon .
The 'lonsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["lonsrc"] | [
"def",
"lonsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"lonsrc\"",
"]"
] | [
601,
4
] | [
612,
29
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.marker | (self) |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
allowoverlap
Flag to draw all symbols, even if they overlap.
angle
Sets the marker orientation from true North, in
degrees clockwise. When using the "auto"
default, no rotation would be applied in
perspective views which is different from using
a zero angle.
anglesrc
Sets the source reference on Chart Studio Cloud
for angle .
autocolorscale
Determines whether the colorscale is a default
palette (`autocolorscale: true`) or the palette
determined by `marker.colorscale`. Has an
effect only if in `marker.color`is set to a
numerical array. In case `colorscale` is
unspecified or `autocolorscale` is true, the
default palette will be chosen according to
whether numbers in the `color` array are all
positive, all negative or mixed.
cauto
Determines whether or not the color domain is
computed with respect to the input data (here
in `marker.color`) or the bounds set in
`marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical
array. Defaults to `false` when `marker.cmin`
and `marker.cmax` are set by the user.
cmax
Sets the upper bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmin` must be set as well.
cmid
Sets the mid-point of the color domain by
scaling `marker.cmin` and/or `marker.cmax` to
be equidistant to this point. Has an effect
only if in `marker.color`is set to a numerical
array. Value should have the same units as in
`marker.color`. Has no effect when
`marker.cauto` is `false`.
cmin
Sets the lower bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmax` must be set as well.
color
Sets themarkercolor. It accepts either a
specific color or an array of numbers that are
mapped to the colorscale relative to the max
and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
coloraxis
Sets a reference to a shared color axis.
References to these shared color axes are
"coloraxis", "coloraxis2", "coloraxis3", etc.
Settings for these shared color axes are set in
the layout, under `layout.coloraxis`,
`layout.coloraxis2`, etc. Note that multiple
color scales can be linked to the same color
axis.
colorbar
:class:`plotly.graph_objects.scattermapbox.mark
er.ColorBar` instance or dict with compatible
properties
colorscale
Sets the colorscale. Has an effect only if in
`marker.color`is set to a numerical array. The
colorscale must be an array containing arrays
mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At
minimum, a mapping for the lowest (0) and
highest (1) values are required. For example,
`[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`.
To control the bounds of the colorscale in
color space, use`marker.cmin` and
`marker.cmax`. Alternatively, `colorscale` may
be a palette name string of the following list:
Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Bl
ues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,E
arth,Electric,Viridis,Cividis.
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
opacity
Sets the marker opacity.
opacitysrc
Sets the source reference on Chart Studio Cloud
for opacity .
reversescale
Reverses the color mapping if true. Has an
effect only if in `marker.color`is set to a
numerical array. If true, `marker.cmin` will
correspond to the last color in the array and
`marker.cmax` will correspond to the first
color.
showscale
Determines whether or not a colorbar is
displayed for this trace. Has an effect only if
in `marker.color`is set to a numerical array.
size
Sets the marker size (in px).
sizemin
Has an effect only if `marker.size` is set to a
numerical array. Sets the minimum size (in px)
of the rendered marker points.
sizemode
Has an effect only if `marker.size` is set to a
numerical array. Sets the rule for which the
data in `size` is converted to pixels.
sizeref
Has an effect only if `marker.size` is set to a
numerical array. Sets the scale factor used to
determine the rendered size of marker points.
Use with `sizemin` and `sizemode`.
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
symbol
Sets the marker symbol. Full list:
https://www.mapbox.com/maki-icons/ Note that
the array `marker.color` and `marker.size` are
only available for "circle" symbols.
symbolsrc
Sets the source reference on Chart Studio Cloud
for symbol .
Returns
-------
plotly.graph_objs.scattermapbox.Marker
|
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
allowoverlap
Flag to draw all symbols, even if they overlap.
angle
Sets the marker orientation from true North, in
degrees clockwise. When using the "auto"
default, no rotation would be applied in
perspective views which is different from using
a zero angle.
anglesrc
Sets the source reference on Chart Studio Cloud
for angle .
autocolorscale
Determines whether the colorscale is a default
palette (`autocolorscale: true`) or the palette
determined by `marker.colorscale`. Has an
effect only if in `marker.color`is set to a
numerical array. In case `colorscale` is
unspecified or `autocolorscale` is true, the
default palette will be chosen according to
whether numbers in the `color` array are all
positive, all negative or mixed.
cauto
Determines whether or not the color domain is
computed with respect to the input data (here
in `marker.color`) or the bounds set in
`marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical
array. Defaults to `false` when `marker.cmin`
and `marker.cmax` are set by the user.
cmax
Sets the upper bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmin` must be set as well.
cmid
Sets the mid-point of the color domain by
scaling `marker.cmin` and/or `marker.cmax` to
be equidistant to this point. Has an effect
only if in `marker.color`is set to a numerical
array. Value should have the same units as in
`marker.color`. Has no effect when
`marker.cauto` is `false`.
cmin
Sets the lower bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmax` must be set as well.
color
Sets themarkercolor. It accepts either a
specific color or an array of numbers that are
mapped to the colorscale relative to the max
and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
coloraxis
Sets a reference to a shared color axis.
References to these shared color axes are
"coloraxis", "coloraxis2", "coloraxis3", etc.
Settings for these shared color axes are set in
the layout, under `layout.coloraxis`,
`layout.coloraxis2`, etc. Note that multiple
color scales can be linked to the same color
axis.
colorbar
:class:`plotly.graph_objects.scattermapbox.mark
er.ColorBar` instance or dict with compatible
properties
colorscale
Sets the colorscale. Has an effect only if in
`marker.color`is set to a numerical array. The
colorscale must be an array containing arrays
mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At
minimum, a mapping for the lowest (0) and
highest (1) values are required. For example,
`[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`.
To control the bounds of the colorscale in
color space, use`marker.cmin` and
`marker.cmax`. Alternatively, `colorscale` may
be a palette name string of the following list:
Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Bl
ues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,E
arth,Electric,Viridis,Cividis.
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
opacity
Sets the marker opacity.
opacitysrc
Sets the source reference on Chart Studio Cloud
for opacity .
reversescale
Reverses the color mapping if true. Has an
effect only if in `marker.color`is set to a
numerical array. If true, `marker.cmin` will
correspond to the last color in the array and
`marker.cmax` will correspond to the first
color.
showscale
Determines whether or not a colorbar is
displayed for this trace. Has an effect only if
in `marker.color`is set to a numerical array.
size
Sets the marker size (in px).
sizemin
Has an effect only if `marker.size` is set to a
numerical array. Sets the minimum size (in px)
of the rendered marker points.
sizemode
Has an effect only if `marker.size` is set to a
numerical array. Sets the rule for which the
data in `size` is converted to pixels.
sizeref
Has an effect only if `marker.size` is set to a
numerical array. Sets the scale factor used to
determine the rendered size of marker points.
Use with `sizemin` and `sizemode`.
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
symbol
Sets the marker symbol. Full list:
https://www.mapbox.com/maki-icons/ Note that
the array `marker.color` and `marker.size` are
only available for "circle" symbols.
symbolsrc
Sets the source reference on Chart Studio Cloud
for symbol . | def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
allowoverlap
Flag to draw all symbols, even if they overlap.
angle
Sets the marker orientation from true North, in
degrees clockwise. When using the "auto"
default, no rotation would be applied in
perspective views which is different from using
a zero angle.
anglesrc
Sets the source reference on Chart Studio Cloud
for angle .
autocolorscale
Determines whether the colorscale is a default
palette (`autocolorscale: true`) or the palette
determined by `marker.colorscale`. Has an
effect only if in `marker.color`is set to a
numerical array. In case `colorscale` is
unspecified or `autocolorscale` is true, the
default palette will be chosen according to
whether numbers in the `color` array are all
positive, all negative or mixed.
cauto
Determines whether or not the color domain is
computed with respect to the input data (here
in `marker.color`) or the bounds set in
`marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical
array. Defaults to `false` when `marker.cmin`
and `marker.cmax` are set by the user.
cmax
Sets the upper bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmin` must be set as well.
cmid
Sets the mid-point of the color domain by
scaling `marker.cmin` and/or `marker.cmax` to
be equidistant to this point. Has an effect
only if in `marker.color`is set to a numerical
array. Value should have the same units as in
`marker.color`. Has no effect when
`marker.cauto` is `false`.
cmin
Sets the lower bound of the color domain. Has
an effect only if in `marker.color`is set to a
numerical array. Value should have the same
units as in `marker.color` and if set,
`marker.cmax` must be set as well.
color
Sets themarkercolor. It accepts either a
specific color or an array of numbers that are
mapped to the colorscale relative to the max
and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
coloraxis
Sets a reference to a shared color axis.
References to these shared color axes are
"coloraxis", "coloraxis2", "coloraxis3", etc.
Settings for these shared color axes are set in
the layout, under `layout.coloraxis`,
`layout.coloraxis2`, etc. Note that multiple
color scales can be linked to the same color
axis.
colorbar
:class:`plotly.graph_objects.scattermapbox.mark
er.ColorBar` instance or dict with compatible
properties
colorscale
Sets the colorscale. Has an effect only if in
`marker.color`is set to a numerical array. The
colorscale must be an array containing arrays
mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At
minimum, a mapping for the lowest (0) and
highest (1) values are required. For example,
`[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`.
To control the bounds of the colorscale in
color space, use`marker.cmin` and
`marker.cmax`. Alternatively, `colorscale` may
be a palette name string of the following list:
Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Bl
ues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,E
arth,Electric,Viridis,Cividis.
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
opacity
Sets the marker opacity.
opacitysrc
Sets the source reference on Chart Studio Cloud
for opacity .
reversescale
Reverses the color mapping if true. Has an
effect only if in `marker.color`is set to a
numerical array. If true, `marker.cmin` will
correspond to the last color in the array and
`marker.cmax` will correspond to the first
color.
showscale
Determines whether or not a colorbar is
displayed for this trace. Has an effect only if
in `marker.color`is set to a numerical array.
size
Sets the marker size (in px).
sizemin
Has an effect only if `marker.size` is set to a
numerical array. Sets the minimum size (in px)
of the rendered marker points.
sizemode
Has an effect only if `marker.size` is set to a
numerical array. Sets the rule for which the
data in `size` is converted to pixels.
sizeref
Has an effect only if `marker.size` is set to a
numerical array. Sets the scale factor used to
determine the rendered size of marker points.
Use with `sizemin` and `sizemode`.
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
symbol
Sets the marker symbol. Full list:
https://www.mapbox.com/maki-icons/ Note that
the array `marker.color` and `marker.size` are
only available for "circle" symbols.
symbolsrc
Sets the source reference on Chart Studio Cloud
for symbol .
Returns
-------
plotly.graph_objs.scattermapbox.Marker
"""
return self["marker"] | [
"def",
"marker",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"marker\"",
"]"
] | [
621,
4
] | [
765,
29
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.meta | (self) |
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type
Returns
-------
Any|numpy.ndarray
|
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type | def meta(self):
"""
Assigns extra meta information associated with this trace that
can be used in various text attributes. Attributes such as
trace `name`, graph, axis and colorbar `title.text`, annotation
`text` `rangeselector`, `updatemenues` and `sliders` `label`
text all support `meta`. To access the trace `meta` values in
an attribute in the same trace, simply use `%{meta[i]}` where
`i` is the index or key of the `meta` item in question. To
access trace `meta` in layout attributes, use
`%{data[n[.meta[i]}` where `i` is the index or key of the
`meta` and `n` is the trace index.
The 'meta' property accepts values of any type
Returns
-------
Any|numpy.ndarray
"""
return self["meta"] | [
"def",
"meta",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"meta\"",
"]"
] | [
774,
4
] | [
793,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.metasrc | (self) |
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def metasrc(self):
"""
Sets the source reference on Chart Studio Cloud for meta .
The 'metasrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["metasrc"] | [
"def",
"metasrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"metasrc\"",
"]"
] | [
802,
4
] | [
813,
30
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.mode | (self) |
Determines the drawing mode for this scatter trace. If the
provided `mode` includes "text" then the `text` elements appear
at the coordinates. Otherwise, the `text` elements appear on
hover.
The 'mode' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lines', 'markers', 'text'] joined with '+' characters
(e.g. 'lines+markers')
OR exactly one of ['none'] (e.g. 'none')
Returns
-------
Any
|
Determines the drawing mode for this scatter trace. If the
provided `mode` includes "text" then the `text` elements appear
at the coordinates. Otherwise, the `text` elements appear on
hover.
The 'mode' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lines', 'markers', 'text'] joined with '+' characters
(e.g. 'lines+markers')
OR exactly one of ['none'] (e.g. 'none') | def mode(self):
"""
Determines the drawing mode for this scatter trace. If the
provided `mode` includes "text" then the `text` elements appear
at the coordinates. Otherwise, the `text` elements appear on
hover.
The 'mode' property is a flaglist and may be specified
as a string containing:
- Any combination of ['lines', 'markers', 'text'] joined with '+' characters
(e.g. 'lines+markers')
OR exactly one of ['none'] (e.g. 'none')
Returns
-------
Any
"""
return self["mode"] | [
"def",
"mode",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"mode\"",
"]"
] | [
822,
4
] | [
839,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.name | (self) |
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def name(self):
"""
Sets the trace name. The trace name appear as the legend item
and on hover.
The 'name' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["name"] | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"name\"",
"]"
] | [
848,
4
] | [
861,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.opacity | (self) |
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def opacity(self):
"""
Sets the opacity of the trace.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["opacity"] | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
870,
4
] | [
881,
30
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.selected | (self) |
The 'selected' property is an instance of Selected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Selected`
- A dict of string/value properties that will be passed
to the Selected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.sele
cted.Marker` instance or dict with compatible
properties
Returns
-------
plotly.graph_objs.scattermapbox.Selected
|
The 'selected' property is an instance of Selected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Selected`
- A dict of string/value properties that will be passed
to the Selected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.sele
cted.Marker` instance or dict with compatible
properties | def selected(self):
"""
The 'selected' property is an instance of Selected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Selected`
- A dict of string/value properties that will be passed
to the Selected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.sele
cted.Marker` instance or dict with compatible
properties
Returns
-------
plotly.graph_objs.scattermapbox.Selected
"""
return self["selected"] | [
"def",
"selected",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"selected\"",
"]"
] | [
890,
4
] | [
909,
31
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.selectedpoints | (self) |
Array containing integer indices of selected points. Has an
effect only for traces that support selections. Note that an
empty array means an empty selection where the `unselected` are
turned on for all points, whereas, any other non-array values
means no selection all where the `selected` and `unselected`
styles have no effect.
The 'selectedpoints' property accepts values of any type
Returns
-------
Any
|
Array containing integer indices of selected points. Has an
effect only for traces that support selections. Note that an
empty array means an empty selection where the `unselected` are
turned on for all points, whereas, any other non-array values
means no selection all where the `selected` and `unselected`
styles have no effect.
The 'selectedpoints' property accepts values of any type | def selectedpoints(self):
"""
Array containing integer indices of selected points. Has an
effect only for traces that support selections. Note that an
empty array means an empty selection where the `unselected` are
turned on for all points, whereas, any other non-array values
means no selection all where the `selected` and `unselected`
styles have no effect.
The 'selectedpoints' property accepts values of any type
Returns
-------
Any
"""
return self["selectedpoints"] | [
"def",
"selectedpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"selectedpoints\"",
"]"
] | [
918,
4
] | [
933,
37
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.showlegend | (self) |
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False) | def showlegend(self):
"""
Determines whether or not an item corresponding to this trace
is shown in the legend.
The 'showlegend' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["showlegend"] | [
"def",
"showlegend",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showlegend\"",
"]"
] | [
942,
4
] | [
954,
33
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.stream | (self) |
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.scattermapbox.Stream
|
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details. | def stream(self):
"""
The 'stream' property is an instance of Stream
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Stream`
- A dict of string/value properties that will be passed
to the Stream constructor
Supported dict properties:
maxpoints
Sets the maximum number of points to keep on
the plots from an incoming stream. If
`maxpoints` is set to 50, only the newest 50
points will be displayed on the plot.
token
The stream id number links a data trace on a
plot with a stream. See https://chart-
studio.plotly.com/settings for more details.
Returns
-------
plotly.graph_objs.scattermapbox.Stream
"""
return self["stream"] | [
"def",
"stream",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"stream\"",
"]"
] | [
963,
4
] | [
987,
29
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.subplot | (self) |
Sets a reference between this trace's data coordinates and a
mapbox subplot. If "mapbox" (the default value), the data refer
to `layout.mapbox`. If "mapbox2", the data refer to
`layout.mapbox2`, and so on.
The 'subplot' property is an identifier of a particular
subplot, of type 'mapbox', that may be specified as the string 'mapbox'
optionally followed by an integer >= 1
(e.g. 'mapbox', 'mapbox1', 'mapbox2', 'mapbox3', etc.)
Returns
-------
str
|
Sets a reference between this trace's data coordinates and a
mapbox subplot. If "mapbox" (the default value), the data refer
to `layout.mapbox`. If "mapbox2", the data refer to
`layout.mapbox2`, and so on.
The 'subplot' property is an identifier of a particular
subplot, of type 'mapbox', that may be specified as the string 'mapbox'
optionally followed by an integer >= 1
(e.g. 'mapbox', 'mapbox1', 'mapbox2', 'mapbox3', etc.) | def subplot(self):
"""
Sets a reference between this trace's data coordinates and a
mapbox subplot. If "mapbox" (the default value), the data refer
to `layout.mapbox`. If "mapbox2", the data refer to
`layout.mapbox2`, and so on.
The 'subplot' property is an identifier of a particular
subplot, of type 'mapbox', that may be specified as the string 'mapbox'
optionally followed by an integer >= 1
(e.g. 'mapbox', 'mapbox1', 'mapbox2', 'mapbox3', etc.)
Returns
-------
str
"""
return self["subplot"] | [
"def",
"subplot",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"subplot\"",
"]"
] | [
996,
4
] | [
1012,
30
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.text | (self) |
Sets text elements associated with each (lon,lat) pair If a
single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. If trace `hoverinfo`
contains a "text" flag and "hovertext" is not set, these
elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Sets text elements associated with each (lon,lat) pair If a
single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. If trace `hoverinfo`
contains a "text" flag and "hovertext" is not set, these
elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def text(self):
"""
Sets text elements associated with each (lon,lat) pair If a
single string, the same string appears over all the data
points. If an array of string, the items are mapped in order to
the this trace's (lon,lat) coordinates. If trace `hoverinfo`
contains a "text" flag and "hovertext" is not set, these
elements will be seen in the hover labels.
The 'text' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["text"] | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
1021,
4
] | [
1039,
27
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.textfont | (self) |
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol".
The 'textfont' property is an instance of Textfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Textfont`
- A dict of string/value properties that will be passed
to the Textfont 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.scattermapbox.Textfont
|
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol".
The 'textfont' property is an instance of Textfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Textfont`
- A dict of string/value properties that will be passed
to the Textfont 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 textfont(self):
"""
Sets the icon text font (color=mapbox.layer.paint.text-color,
size=mapbox.layer.layout.text-size). Has an effect only when
`type` is set to "symbol".
The 'textfont' property is an instance of Textfont
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Textfont`
- A dict of string/value properties that will be passed
to the Textfont 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.scattermapbox.Textfont
"""
return self["textfont"] | [
"def",
"textfont",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"textfont\"",
"]"
] | [
1048,
4
] | [
1087,
31
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.textposition | (self) |
Sets the positions of the `text` elements with respects to the
(x,y) coordinates.
The 'textposition' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top left', 'top center', 'top right', 'middle left',
'middle center', 'middle right', 'bottom left', 'bottom
center', 'bottom right']
Returns
-------
Any
|
Sets the positions of the `text` elements with respects to the
(x,y) coordinates.
The 'textposition' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top left', 'top center', 'top right', 'middle left',
'middle center', 'middle right', 'bottom left', 'bottom
center', 'bottom right'] | def textposition(self):
"""
Sets the positions of the `text` elements with respects to the
(x,y) coordinates.
The 'textposition' property is an enumeration that may be specified as:
- One of the following enumeration values:
['top left', 'top center', 'top right', 'middle left',
'middle center', 'middle right', 'bottom left', 'bottom
center', 'bottom right']
Returns
-------
Any
"""
return self["textposition"] | [
"def",
"textposition",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"textposition\"",
"]"
] | [
1096,
4
] | [
1111,
35
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.textsrc | (self) |
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def textsrc(self):
"""
Sets the source reference on Chart Studio Cloud for text .
The 'textsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["textsrc"] | [
"def",
"textsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"textsrc\"",
"]"
] | [
1120,
4
] | [
1131,
30
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.texttemplate | (self) |
Template string used for rendering the information text that
appear on points. Note that this will override `textinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. Every attributes that can be
specified per-point (the ones that are `arrayOk: true`) are
available. variables `lat`, `lon` and `text`.
The 'texttemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
Template string used for rendering the information text that
appear on points. Note that this will override `textinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. Every attributes that can be
specified per-point (the ones that are `arrayOk: true`) are
available. variables `lat`, `lon` and `text`.
The 'texttemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above | def texttemplate(self):
"""
Template string used for rendering the information text that
appear on points. Note that this will override `textinfo`.
Variables are inserted using %{variable}, for example "y:
%{y}". Numbers are formatted using d3-format's syntax
%{variable:d3-format}, for example "Price: %{y:$.2f}".
https://github.com/d3/d3-3.x-api-
reference/blob/master/Formatting.md#d3_format for details on
the formatting syntax. Dates are formatted using d3-time-
format's syntax %{variable|d3-time-format}, for example "Day:
%{2019-01-01|%A}". https://github.com/d3/d3-3.x-api-
reference/blob/master/Time-Formatting.md#format for details on
the date formatting syntax. Every attributes that can be
specified per-point (the ones that are `arrayOk: true`) are
available. variables `lat`, `lon` and `text`.
The 'texttemplate' property is a string and must be specified as:
- A string
- A number that will be converted to a string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["texttemplate"] | [
"def",
"texttemplate",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"texttemplate\"",
"]"
] | [
1140,
4
] | [
1166,
35
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.texttemplatesrc | (self) |
Sets the source reference on Chart Studio Cloud for
texttemplate .
The 'texttemplatesrc' 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
texttemplate .
The 'texttemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def texttemplatesrc(self):
"""
Sets the source reference on Chart Studio Cloud for
texttemplate .
The 'texttemplatesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["texttemplatesrc"] | [
"def",
"texttemplatesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"texttemplatesrc\"",
"]"
] | [
1175,
4
] | [
1187,
38
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.uid | (self) |
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"""
return self["uid"] | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | [
1196,
4
] | [
1209,
26
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.uirevision | (self) |
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
|
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type | def uirevision(self):
"""
Controls persistence of some user-driven changes to the trace:
`constraintrange` in `parcoords` traces, as well as some
`editable: true` modifications such as `name` and
`colorbar.title`. Defaults to `layout.uirevision`. Note that
other user-driven trace attribute changes are controlled by
`layout` attributes: `trace.visible` is controlled by
`layout.legend.uirevision`, `selectedpoints` is controlled by
`layout.selectionrevision`, and `colorbar.(x|y)` (accessible
with `config: {editable: true}`) is controlled by
`layout.editrevision`. Trace changes are tracked by `uid`,
which only falls back on trace index if no `uid` is provided.
So if your app can add/remove traces before the end of the
`data` array, such that the same trace has a different index,
you can still preserve user-driven changes if you give each
trace a `uid` that stays with it as it moves.
The 'uirevision' property accepts values of any type
Returns
-------
Any
"""
return self["uirevision"] | [
"def",
"uirevision",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uirevision\"",
"]"
] | [
1218,
4
] | [
1242,
33
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.unselected | (self) |
The 'unselected' property is an instance of Unselected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Unselected`
- A dict of string/value properties that will be passed
to the Unselected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.unse
lected.Marker` instance or dict with compatible
properties
Returns
-------
plotly.graph_objs.scattermapbox.Unselected
|
The 'unselected' property is an instance of Unselected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Unselected`
- A dict of string/value properties that will be passed
to the Unselected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.unse
lected.Marker` instance or dict with compatible
properties | def unselected(self):
"""
The 'unselected' property is an instance of Unselected
that may be specified as:
- An instance of :class:`plotly.graph_objs.scattermapbox.Unselected`
- A dict of string/value properties that will be passed
to the Unselected constructor
Supported dict properties:
marker
:class:`plotly.graph_objects.scattermapbox.unse
lected.Marker` instance or dict with compatible
properties
Returns
-------
plotly.graph_objs.scattermapbox.Unselected
"""
return self["unselected"] | [
"def",
"unselected",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"unselected\"",
"]"
] | [
1251,
4
] | [
1270,
33
] | python | en | ['en', 'error', 'th'] | False |
Scattermapbox.visible | (self) |
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
|
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly'] | def visible(self):
"""
Determines whether or not this trace is visible. If
"legendonly", the trace is not drawn, but can appear as a
legend item (provided that the legend itself is visible).
The 'visible' property is an enumeration that may be specified as:
- One of the following enumeration values:
[True, False, 'legendonly']
Returns
-------
Any
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
1279,
4
] | [
1293,
30
] | 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.