Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Line.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
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:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
64,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
73,
4
] | [
84,
31
] | python | en | ['en', 'error', 'th'] | False |
Line.width | (self) |
The 'width' property is a number and may be specified as:
- An int or float
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
The 'width' property is a number and may be specified as:
- An int or float
- A tuple, list, or one-dimensional numpy array of the above | def width(self):
"""
The 'width' property is a number and may be specified as:
- An int or float
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
"""
return self["width"] | [
"def",
"width",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"width\"",
"]"
] | [
93,
4
] | [
103,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.widthsrc | (self) |
Sets the source reference on Chart Studio Cloud for width .
The 'widthsrc' 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 width .
The 'widthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def widthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for width .
The 'widthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["widthsrc"] | [
"def",
"widthsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"widthsrc\"",
"]"
] | [
112,
4
] | [
123,
31
] | python | en | ['en', 'error', 'th'] | False |
Line.__init__ | (
self, arg=None, color=None, colorsrc=None, width=None, widthsrc=None, **kwargs
) |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.header.Line`
color
colorsrc
Sets the source reference on ... |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.header.Line`
color | def __init__(
self, arg=None, color=None, colorsrc=None, width=None, widthsrc=None, **kwargs
):
"""
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"width",
"=",
"None",
",",
"widthsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Line",
",",
"self",
")",
... | [
146,
4
] | [
225,
34
] | python | en | ['en', 'error', 'th'] | False |
create | (body) | Create a dash app item. | Create a dash app item. | def create(body):
"""Create a dash app item."""
url = build_url(RESOURCE)
return request("post", url, json=body) | [
"def",
"create",
"(",
"body",
")",
":",
"url",
"=",
"build_url",
"(",
"RESOURCE",
")",
"return",
"request",
"(",
"\"post\"",
",",
"url",
",",
"json",
"=",
"body",
")"
] | [
10,
0
] | [
13,
42
] | python | en | ['en', 'la', 'en'] | True |
retrieve | (fid) | Retrieve a dash app from Plotly. | Retrieve a dash app from Plotly. | def retrieve(fid):
"""Retrieve a dash app from Plotly."""
url = build_url(RESOURCE, id=fid)
return request("get", url) | [
"def",
"retrieve",
"(",
"fid",
")",
":",
"url",
"=",
"build_url",
"(",
"RESOURCE",
",",
"id",
"=",
"fid",
")",
"return",
"request",
"(",
"\"get\"",
",",
"url",
")"
] | [
16,
0
] | [
19,
30
] | python | en | ['en', 'ga', 'en'] | True |
update | (fid, content) | Completely update the writable. | Completely update the writable. | def update(fid, content):
"""Completely update the writable."""
url = build_url(RESOURCE, id=fid)
return request("put", url, json=content) | [
"def",
"update",
"(",
"fid",
",",
"content",
")",
":",
"url",
"=",
"build_url",
"(",
"RESOURCE",
",",
"id",
"=",
"fid",
")",
"return",
"request",
"(",
"\"put\"",
",",
"url",
",",
"json",
"=",
"content",
")"
] | [
22,
0
] | [
25,
44
] | python | en | ['en', 'en', 'en'] | True |
PresentationAck.__init__ | (self, status: str = None, **kwargs) |
Initialize an explicit ack message instance.
Args:
status: Status (default OK)
|
Initialize an explicit ack message instance. | def __init__(self, status: str = None, **kwargs):
"""
Initialize an explicit ack message instance.
Args:
status: Status (default OK)
"""
super().__init__(status, **kwargs) | [
"def",
"__init__",
"(",
"self",
",",
"status",
":",
"str",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"status",
",",
"*",
"*",
"kwargs",
")"
] | [
21,
4
] | [
29,
42
] | python | en | ['en', 'error', 'th'] | False |
Totals.marker | (self) |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.totals.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... |
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.totals.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Supported dict properties:
... | def marker(self):
"""
The 'marker' property is an instance of Marker
that may be specified as:
- An instance of :class:`plotly.graph_objs.waterfall.totals.Marker`
- A dict of string/value properties that will be passed
to the Marker constructor
Su... | [
"def",
"marker",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"marker\"",
"]"
] | [
15,
4
] | [
37,
29
] | python | en | ['en', 'error', 'th'] | False |
Totals.__init__ | (self, arg=None, marker=None, **kwargs) |
Construct a new Totals object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Totals`
marker
:class:`plotly.graph_objects.waterfall.totals... |
Construct a new Totals object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Totals`
marker
:class:`plotly.graph_objects.waterfall.totals... | def __init__(self, arg=None, marker=None, **kwargs):
"""
Construct a new Totals object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.waterfall.Totals`
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Totals",
",",
"self",
")",
".",
"__init__",
"(",
"\"totals\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"se... | [
53,
4
] | [
111,
34
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.num_total_accounts | (self) |
Get total number of accounts.
Returns:
count (int): The total number of registered accounts.
|
Get total number of accounts. | def num_total_accounts(self):
"""
Get total number of accounts.
Returns:
count (int): The total number of registered accounts.
"""
return self.count() | [
"def",
"num_total_accounts",
"(",
"self",
")",
":",
"return",
"self",
".",
"count",
"(",
")"
] | [
40,
4
] | [
48,
27
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_connected_accounts | (self) |
Get all currently connected accounts.
Returns:
count (list): Account objects with currently
connected sessions.
|
Get all currently connected accounts. | def get_connected_accounts(self):
"""
Get all currently connected accounts.
Returns:
count (list): Account objects with currently
connected sessions.
"""
return self.filter(db_is_connected=True) | [
"def",
"get_connected_accounts",
"(",
"self",
")",
":",
"return",
"self",
".",
"filter",
"(",
"db_is_connected",
"=",
"True",
")"
] | [
50,
4
] | [
59,
48
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_recently_created_accounts | (self, days=7) |
Get accounts recently created.
Args:
days (int, optional): How many days in the past "recently" means.
Returns:
accounts (list): The Accounts created the last `days` interval.
|
Get accounts recently created. | def get_recently_created_accounts(self, days=7):
"""
Get accounts recently created.
Args:
days (int, optional): How many days in the past "recently" means.
Returns:
accounts (list): The Accounts created the last `days` interval.
"""
end_date = t... | [
"def",
"get_recently_created_accounts",
"(",
"self",
",",
"days",
"=",
"7",
")",
":",
"end_date",
"=",
"timezone",
".",
"now",
"(",
")",
"tdelta",
"=",
"datetime",
".",
"timedelta",
"(",
"days",
")",
"start_date",
"=",
"end_date",
"-",
"tdelta",
"return",
... | [
61,
4
] | [
75,
69
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_recently_connected_accounts | (self, days=7) |
Get accounts recently connected to the game.
Args:
days (int, optional): Number of days backwards to check
Returns:
accounts (list): The Accounts connected to the game in the
last `days` interval.
|
Get accounts recently connected to the game. | def get_recently_connected_accounts(self, days=7):
"""
Get accounts recently connected to the game.
Args:
days (int, optional): Number of days backwards to check
Returns:
accounts (list): The Accounts connected to the game in the
last `days` inte... | [
"def",
"get_recently_connected_accounts",
"(",
"self",
",",
"days",
"=",
"7",
")",
":",
"end_date",
"=",
"timezone",
".",
"now",
"(",
")",
"tdelta",
"=",
"datetime",
".",
"timedelta",
"(",
"days",
")",
"start_date",
"=",
"end_date",
"-",
"tdelta",
"return"... | [
77,
4
] | [
93,
58
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_account_from_email | (self, uemail) |
Search account by
Returns an account object based on email address.
Args:
uemail (str): An email address to search for.
Returns:
account (Account): A found account, if found.
|
Search account by
Returns an account object based on email address. | def get_account_from_email(self, uemail):
"""
Search account by
Returns an account object based on email address.
Args:
uemail (str): An email address to search for.
Returns:
account (Account): A found account, if found.
"""
return self.... | [
"def",
"get_account_from_email",
"(",
"self",
",",
"uemail",
")",
":",
"return",
"self",
".",
"filter",
"(",
"email__iexact",
"=",
"uemail",
")"
] | [
95,
4
] | [
107,
48
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_account_from_uid | (self, uid) |
Get an account by id.
Args:
uid (int): Account database id.
Returns:
account (Account): The result.
|
Get an account by id. | def get_account_from_uid(self, uid):
"""
Get an account by id.
Args:
uid (int): Account database id.
Returns:
account (Account): The result.
"""
try:
return self.get(id=uid)
except self.model.DoesNotExist:
return ... | [
"def",
"get_account_from_uid",
"(",
"self",
",",
"uid",
")",
":",
"try",
":",
"return",
"self",
".",
"get",
"(",
"id",
"=",
"uid",
")",
"except",
"self",
".",
"model",
".",
"DoesNotExist",
":",
"return",
"None"
] | [
109,
4
] | [
123,
23
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.get_account_from_name | (self, uname) |
Get account object based on name.
Args:
uname (str): The Account name to search for.
Returns:
account (Account): The found account.
|
Get account object based on name. | def get_account_from_name(self, uname):
"""
Get account object based on name.
Args:
uname (str): The Account name to search for.
Returns:
account (Account): The found account.
"""
try:
return self.get(username__iexact=uname)
... | [
"def",
"get_account_from_name",
"(",
"self",
",",
"uname",
")",
":",
"try",
":",
"return",
"self",
".",
"get",
"(",
"username__iexact",
"=",
"uname",
")",
"except",
"self",
".",
"model",
".",
"DoesNotExist",
":",
"return",
"None"
] | [
125,
4
] | [
139,
23
] | python | en | ['en', 'error', 'th'] | False |
AccountDBManager.search_account | (self, ostring, exact=True, typeclass=None) |
Searches for a particular account by name or
database id.
Args:
ostring (str or int): A key string or database id.
exact (bool, optional): Only valid for string matches. If
`True`, requires exact (non-case-sensitive) match,
otherwise also... |
Searches for a particular account by name or
database id. | def search_account(self, ostring, exact=True, typeclass=None):
"""
Searches for a particular account by name or
database id.
Args:
ostring (str or int): A key string or database id.
exact (bool, optional): Only valid for string matches. If
`True`,... | [
"def",
"search_account",
"(",
"self",
",",
"ostring",
",",
"exact",
"=",
"True",
",",
"typeclass",
"=",
"None",
")",
":",
"dbref",
"=",
"self",
".",
"dbref",
"(",
"ostring",
")",
"if",
"dbref",
"or",
"dbref",
"==",
"0",
":",
"# bref search is always exac... | [
141,
4
] | [
173,
39
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
... |
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:
... | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A name... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
64,
28
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
73,
4
] | [
84,
31
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts ... |
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 ... | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
prefer... | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
93,
4
] | [
116,
29
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.familysrc | (self) |
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def familysrc(self):
"""
Sets the source reference on Chart Studio Cloud for family .
The 'familysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["familysrc"] | [
"def",
"familysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"familysrc\"",
"]"
] | [
125,
4
] | [
136,
32
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
"""
return self["size"... | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
145,
4
] | [
155,
27
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.sizesrc | (self) |
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def sizesrc(self):
"""
Sets the source reference on Chart Studio Cloud for size .
The 'sizesrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["sizesrc"] | [
"def",
"sizesrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizesrc\"",
"]"
] | [
164,
4
] | [
175,
30
] | python | en | ['en', 'error', 'th'] | False |
Outsidetextfont.__init__ | (
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
) |
Construct a new Outsidetextfont object
Sets the font used for `textinfo` lying outside the sector.
This option refers to the root of the hierarchy presented at
the center of a sunburst graph. Please note that if a hierarchy
has multiple root nodes, this option won't hav... |
Construct a new Outsidetextfont object
Sets the font used for `textinfo` lying outside the sector.
This option refers to the root of the hierarchy presented at
the center of a sunburst graph. Please note that if a hierarchy
has multiple root nodes, this option won't hav... | def __init__(
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
):
"""
Construct a new Outsidetextfont object
Sets the font used for `textinfo` lying outsi... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"family",
"=",
"None",
",",
"familysrc",
"=",
"None",
",",
"size",
"=",
"None",
",",
"sizesrc",
"=",
"None",
",",
"*",
"*",
"kw... | [
215,
4
] | [
333,
34
] | python | en | ['en', 'error', 'th'] | False |
Marker.autocolorscale | (self) |
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 pal... |
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 pal... | def autocolorscale(self):
"""
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 `auto... | [
"def",
"autocolorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"autocolorscale\"",
"]"
] | [
31,
4
] | [
48,
37
] | python | en | ['en', 'error', 'th'] | False |
Marker.cauto | (self) |
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 `ma... |
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 `ma... | def cauto(self):
"""
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... | [
"def",
"cauto",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cauto\"",
"]"
] | [
57,
4
] | [
73,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmax | (self) |
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.
The 'cmax' property is a number and may be specified as:
... |
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.
The 'cmax' property is a number and may be specified as:
... | def cmax(self):
"""
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.
The 'cmax' property is a number and ... | [
"def",
"cmax",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmax\"",
"]"
] | [
82,
4
] | [
96,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmid | (self) |
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 `... |
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 `... | def cmid(self):
"""
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
effe... | [
"def",
"cmid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmid\"",
"]"
] | [
105,
4
] | [
120,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmin | (self) |
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.
The 'cmin' property is a number and may be specified as:
... |
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.
The 'cmin' property is a number and may be specified as:
... | def cmin(self):
"""
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.
The 'cmin' property is a number and ... | [
"def",
"cmin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmin\"",
"]"
] | [
129,
4
] | [
143,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.color | (self) |
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.
The 'color' property is a color and may be specified as:
... |
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.
The 'color' property is a color and may be specified as:
... | def color(self):
"""
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.
The 'color' property is a colo... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
152,
4
] | [
208,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.coloraxis | (self) |
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... |
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... | def coloraxis(self):
"""
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 t... | [
"def",
"coloraxis",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"coloraxis\"",
"]"
] | [
217,
4
] | [
235,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorbar | (self) |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict properties:
... |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict properties:
... | def colorbar(self):
"""
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
... | [
"def",
"colorbar",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorbar\"",
"]"
] | [
244,
4
] | [
470,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorscale | (self) |
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) v... |
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) v... | def colorscale(self):
"""
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
... | [
"def",
"colorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorscale\"",
"]"
] | [
479,
4
] | [
523,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
532,
4
] | [
543,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.bar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict pro... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
552,
4
] | [
655,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above | def opacity(self):
"""
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
664,
4
] | [
676,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacitysrc | (self) |
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' 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 opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def opacitysrc(self):
"""
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["opacitysrc"] | [
"def",
"opacitysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacitysrc\"",
"]"
] | [
685,
4
] | [
696,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.reversescale | (self) |
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.
The 'reversescale' property must be specified ... |
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.
The 'reversescale' property must be specified ... | def reversescale(self):
"""
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.
The 'revers... | [
"def",
"reversescale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"reversescale\"",
"]"
] | [
705,
4
] | [
719,
35
] | python | en | ['en', 'error', 'th'] | False |
Marker.showscale | (self) |
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.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False) | def showscale(self):
"""
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
------... | [
"def",
"showscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showscale\"",
"]"
] | [
728,
4
] | [
741,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
line=None,
opacity=None,
opacitysrc=None,... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.bar.Marker`
autocolorscale
Determines whether the colorscale is a default palette
... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.bar.Marker`
autocolorscale
Determines whether the colorscale is a default palette
... | def __init__(
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
line=None,
opacity=None,
opac... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"autocolorscale",
"=",
"None",
",",
"cauto",
"=",
"None",
",",
"cmax",
"=",
"None",
",",
"cmid",
"=",
"None",
",",
"cmin",
"=",
"None",
",",
"color",
"=",
"None",
",",
"coloraxis",
"=",
... | [
838,
4
] | [
1051,
34
] | python | en | ['en', 'error', 'th'] | False |
Line.color | (self) |
Sets the line color.
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%)')
- ... |
Sets the line color.
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%)')
- ... | def color(self):
"""
Sets the line color.
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... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
65,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.dash | (self) |
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
- One of the following da... |
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
- One of the following da... | def dash(self):
"""
Sets the dash style of lines. Set to a dash type string
("solid", "dot", "dash", "longdash", "dashdot", or
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is an enumeration that may be specified as:
... | [
"def",
"dash",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dash\"",
"]"
] | [
74,
4
] | [
91,
27
] | python | en | ['en', 'error', 'th'] | False |
Line.width | (self) |
Sets the line width (in px).
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the line width (in px).
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def width(self):
"""
Sets the line width (in px).
The 'width' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["width"] | [
"def",
"width",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"width\"",
"]"
] | [
100,
4
] | [
111,
28
] | python | en | ['en', 'error', 'th'] | False |
Line.__init__ | (self, arg=None, color=None, dash=None, width=None, **kwargs) |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.ohlc.increasing.Line`
color
Sets the line color.
dash
... |
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.ohlc.increasing.Line`
color
Sets the line color.
dash
... | def __init__(self, arg=None, color=None, dash=None, width=None, **kwargs):
"""
Construct a new Line object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.ohlc.i... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"dash",
"=",
"None",
",",
"width",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Line",
",",
"self",
")",
".",
"__init__",
"(",
"\"line\"",
... | [
133,
4
] | [
205,
34
] | python | en | ['en', 'error', 'th'] | False |
Domain.x | (self) |
Sets the horizontal domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'x' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The ... |
Sets the horizontal domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'x' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The ... | def x(self):
"""
Sets the horizontal domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'x' property is an info array that may be specified as:
* a list or tuple of 2 elem... | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | [
15,
4
] | [
33,
24
] | python | en | ['en', 'error', 'th'] | False |
Domain.y | (self) |
Sets the vertical domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'y' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'y... |
Sets the vertical domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'y' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'y... | def y(self):
"""
Sets the vertical domain of this grid subplot (in plot
fraction). The first and last cells end exactly at the domain
edges, with no grout around the edges.
The 'y' property is an info array that may be specified as:
* a list or tuple of 2 elemen... | [
"def",
"y",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"y\"",
"]"
] | [
42,
4
] | [
60,
24
] | python | en | ['en', 'error', 'th'] | False |
Domain.__init__ | (self, arg=None, x=None, y=None, **kwargs) |
Construct a new Domain object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.grid.Domain`
x
Sets the horizontal domain of this grid subplot ... |
Construct a new Domain object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.grid.Domain`
x
Sets the horizontal domain of this grid subplot ... | def __init__(self, arg=None, x=None, y=None, **kwargs):
"""
Construct a new Domain object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.layout.grid.Domain`
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"x",
"=",
"None",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Domain",
",",
"self",
")",
".",
"__init__",
"(",
"\"domain\"",
")",
"if",
"\"_parent\"",
"in"... | [
81,
4
] | [
148,
34
] | python | en | ['en', 'error', 'th'] | False |
Marker.autocolorscale | (self) |
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 pal... |
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 pal... | def autocolorscale(self):
"""
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 `auto... | [
"def",
"autocolorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"autocolorscale\"",
"]"
] | [
31,
4
] | [
48,
37
] | python | en | ['en', 'error', 'th'] | False |
Marker.cauto | (self) |
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 `ma... |
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 `ma... | def cauto(self):
"""
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... | [
"def",
"cauto",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cauto\"",
"]"
] | [
57,
4
] | [
73,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmax | (self) |
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.
The 'cmax' property is a number and may be specified as:
... |
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.
The 'cmax' property is a number and may be specified as:
... | def cmax(self):
"""
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.
The 'cmax' property is a number and ... | [
"def",
"cmax",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmax\"",
"]"
] | [
82,
4
] | [
96,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmid | (self) |
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 `... |
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 `... | def cmid(self):
"""
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
effe... | [
"def",
"cmid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmid\"",
"]"
] | [
105,
4
] | [
120,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmin | (self) |
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.
The 'cmin' property is a number and may be specified as:
... |
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.
The 'cmin' property is a number and may be specified as:
... | def cmin(self):
"""
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.
The 'cmin' property is a number and ... | [
"def",
"cmin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmin\"",
"]"
] | [
129,
4
] | [
143,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.color | (self) |
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.
The 'color' property is a color and may be specified as:
... |
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.
The 'color' property is a color and may be specified as:
... | def color(self):
"""
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.
The 'color' property is a colo... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
152,
4
] | [
208,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.coloraxis | (self) |
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... |
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... | def coloraxis(self):
"""
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 t... | [
"def",
"coloraxis",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"coloraxis\"",
"]"
] | [
217,
4
] | [
235,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorbar | (self) |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict properti... |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict properti... | def colorbar(self):
"""
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
... | [
"def",
"colorbar",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorbar\"",
"]"
] | [
244,
4
] | [
471,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorscale | (self) |
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) v... |
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) v... | def colorscale(self):
"""
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
... | [
"def",
"colorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorscale\"",
"]"
] | [
480,
4
] | [
524,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
533,
4
] | [
544,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.histogram.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported di... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
553,
4
] | [
656,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above | def opacity(self):
"""
Sets the opacity of the bars.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
665,
4
] | [
677,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacitysrc | (self) |
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' 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 opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def opacitysrc(self):
"""
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["opacitysrc"] | [
"def",
"opacitysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacitysrc\"",
"]"
] | [
686,
4
] | [
697,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.reversescale | (self) |
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.
The 'reversescale' property must be specified ... |
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.
The 'reversescale' property must be specified ... | def reversescale(self):
"""
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.
The 'revers... | [
"def",
"reversescale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"reversescale\"",
"]"
] | [
706,
4
] | [
720,
35
] | python | en | ['en', 'error', 'th'] | False |
Marker.showscale | (self) |
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.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False) | def showscale(self):
"""
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
------... | [
"def",
"showscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showscale\"",
"]"
] | [
729,
4
] | [
742,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
line=None,
opacity=None,
opacitysrc=None,... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram.Marker`
autocolorscale
Determines whether the colorscale is ... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.histogram.Marker`
autocolorscale
Determines whether the colorscale is ... | def __init__(
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
line=None,
opacity=None,
opac... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"autocolorscale",
"=",
"None",
",",
"cauto",
"=",
"None",
",",
"cmax",
"=",
"None",
",",
"cmid",
"=",
"None",
",",
"cmin",
"=",
"None",
",",
"color",
"=",
"None",
",",
"coloraxis",
"=",
... | [
839,
4
] | [
1053,
34
] | python | en | ['en', 'error', 'th'] | False |
main | (opt) |
Extracts training data for the negative response classifier (NRC) from Mturk logs.
input: file of logs (in ParlaiDialog format) from Mturk task 1 with turn-by-turn
quality ratings 1-5
output: file of episodes (self-feeding format) w/ +1/-1 ratings indicating
positive/negative example
|
Extracts training data for the negative response classifier (NRC) from Mturk logs. | def main(opt):
"""
Extracts training data for the negative response classifier (NRC) from Mturk logs.
input: file of logs (in ParlaiDialog format) from Mturk task 1 with turn-by-turn
quality ratings 1-5
output: file of episodes (self-feeding format) w/ +1/-1 ratings indicating
positive/... | [
"def",
"main",
"(",
"opt",
")",
":",
"examples",
"=",
"[",
"]",
"num_episodes",
"=",
"0",
"num_parleys",
"=",
"0",
"for",
"episode",
"in",
"extract_parlai_episodes",
"(",
"opt",
"[",
"'infile'",
"]",
")",
":",
"num_episodes",
"+=",
"1",
"history",
"=",
... | [
70,
0
] | [
166,
5
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.add_cmdline_args | (
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) |
Add command-line arguments specifically for this agent.
|
Add command-line arguments specifically for this agent.
| def add_cmdline_args(
cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None
) -> ParlaiParser:
"""
Add command-line arguments specifically for this agent.
"""
agent = parser.add_argument_group('ControllableSeq2seqAgent Arguments')
agent.add_argument(
... | [
"def",
"add_cmdline_args",
"(",
"cls",
",",
"parser",
":",
"ParlaiParser",
",",
"partial_opt",
":",
"Optional",
"[",
"Opt",
"]",
"=",
"None",
")",
"->",
"ParlaiParser",
":",
"agent",
"=",
"parser",
".",
"add_argument_group",
"(",
"'ControllableSeq2seqAgent Argum... | [
62,
4
] | [
265,
20
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.__init__ | (self, opt, shared=None) |
Set up model.
|
Set up model.
| def __init__(self, opt, shared=None):
"""
Set up model.
"""
init_model = None
if not shared: # only do this on first setup
initialize_control_information(opt)
# first check load path in case we need to override paths
if opt.get('init_model') a... | [
"def",
"__init__",
"(",
"self",
",",
"opt",
",",
"shared",
"=",
"None",
")",
":",
"init_model",
"=",
"None",
"if",
"not",
"shared",
":",
"# only do this on first setup",
"initialize_control_information",
"(",
"opt",
")",
"# first check load path in case we need to ove... | [
267,
4
] | [
365,
18
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.build_model | (self, states=None) |
Initialize model, override to change model setup.
|
Initialize model, override to change model setup.
| def build_model(self, states=None):
"""
Initialize model, override to change model setup.
"""
opt = self.opt
kwargs = opt_to_kwargs(opt)
model = Seq2seq(
len(self.dict),
opt['embeddingsize'],
opt['hiddensize'],
padding_idx=... | [
"def",
"build_model",
"(",
"self",
",",
"states",
"=",
"None",
")",
":",
"opt",
"=",
"self",
".",
"opt",
"kwargs",
"=",
"opt_to_kwargs",
"(",
"opt",
")",
"model",
"=",
"Seq2seq",
"(",
"len",
"(",
"self",
".",
"dict",
")",
",",
"opt",
"[",
"'embeddi... | [
392,
4
] | [
436,
20
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent._init_controls | (self) |
Initialize controls.
Sets the following:
self.control_vars: list of strings. The CT controls sorted alphabetically.
self.control_settings: a dictionary containing info about the CT controls.
Each control name maps to a dictionary that contains:
'embsize'... |
Initialize controls. | def _init_controls(self):
"""
Initialize controls.
Sets the following:
self.control_vars: list of strings. The CT controls sorted alphabetically.
self.control_settings: a dictionary containing info about the CT controls.
Each control name maps to a dictionary t... | [
"def",
"_init_controls",
"(",
"self",
")",
":",
"# Set self.control_vars, a list of the CT control vars in alphabetical order",
"self",
".",
"control_vars",
"=",
"(",
"sorted",
"(",
"self",
".",
"opt",
"[",
"'control_vars'",
"]",
".",
"split",
"(",
"','",
")",
")",
... | [
438,
4
] | [
554,
50
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent._v2t | (self, vec) |
Convert token indices to string of tokens.
|
Convert token indices to string of tokens.
| def _v2t(self, vec):
"""
Convert token indices to string of tokens.
"""
new_vec = []
if hasattr(vec, 'cpu'):
vec = vec.cpu()
for i in vec:
if i == self.END_IDX:
break
elif i != self.START_IDX:
new_vec.app... | [
"def",
"_v2t",
"(",
"self",
",",
"vec",
")",
":",
"new_vec",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"vec",
",",
"'cpu'",
")",
":",
"vec",
"=",
"vec",
".",
"cpu",
"(",
")",
"for",
"i",
"in",
"vec",
":",
"if",
"i",
"==",
"self",
".",
"END_IDX",
... | [
556,
4
] | [
568,
41
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.zero_grad | (self) |
Zero out optimizer.
|
Zero out optimizer.
| def zero_grad(self):
"""
Zero out optimizer.
"""
self.optimizer.zero_grad() | [
"def",
"zero_grad",
"(",
"self",
")",
":",
"self",
".",
"optimizer",
".",
"zero_grad",
"(",
")"
] | [
570,
4
] | [
574,
34
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.update_params | (self) |
Do one optimization step.
|
Do one optimization step.
| def update_params(self):
"""
Do one optimization step.
"""
if self.opt['gradient_clip'] > 0:
torch.nn.utils.clip_grad_norm_(
self.model.parameters(), self.opt['gradient_clip']
)
self.optimizer.step() | [
"def",
"update_params",
"(",
"self",
")",
":",
"if",
"self",
".",
"opt",
"[",
"'gradient_clip'",
"]",
">",
"0",
":",
"torch",
".",
"nn",
".",
"utils",
".",
"clip_grad_norm_",
"(",
"self",
".",
"model",
".",
"parameters",
"(",
")",
",",
"self",
".",
... | [
576,
4
] | [
584,
29
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.reset_metrics | (self) |
Reset metrics for reporting loss and perplexity.
|
Reset metrics for reporting loss and perplexity.
| def reset_metrics(self):
"""
Reset metrics for reporting loss and perplexity.
"""
super().reset_metrics()
self.metrics['loss'] = 0.0
self.metrics['num_tokens'] = 0
self.metrics['correct_tokens'] = 0 | [
"def",
"reset_metrics",
"(",
"self",
")",
":",
"super",
"(",
")",
".",
"reset_metrics",
"(",
")",
"self",
".",
"metrics",
"[",
"'loss'",
"]",
"=",
"0.0",
"self",
".",
"metrics",
"[",
"'num_tokens'",
"]",
"=",
"0",
"self",
".",
"metrics",
"[",
"'corre... | [
586,
4
] | [
593,
42
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.report | (self) |
Report loss and perplexity from model's perspective.
Note that this includes predicting __END__ and __UNK__ tokens and may differ
from a truly independent measurement.
|
Report loss and perplexity from model's perspective. | def report(self):
"""
Report loss and perplexity from model's perspective.
Note that this includes predicting __END__ and __UNK__ tokens and may differ
from a truly independent measurement.
"""
m = {}
num_tok = self.metrics['num_tokens']
if num_tok > 0:
... | [
"def",
"report",
"(",
"self",
")",
":",
"m",
"=",
"{",
"}",
"num_tok",
"=",
"self",
".",
"metrics",
"[",
"'num_tokens'",
"]",
"if",
"num_tok",
">",
"0",
":",
"if",
"self",
".",
"metrics",
"[",
"'correct_tokens'",
"]",
">",
"0",
":",
"m",
"[",
"'t... | [
595,
4
] | [
617,
16
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.share | (self) |
Share internal states between parent and child instances.
|
Share internal states between parent and child instances.
| def share(self):
"""
Share internal states between parent and child instances.
"""
shared = super().share()
shared['model'] = self.model
shared['metrics'] = self.metrics
if self.beam_dot_log is True:
shared['beam_dot_dir'] = self.beam_dot_dir
r... | [
"def",
"share",
"(",
"self",
")",
":",
"shared",
"=",
"super",
"(",
")",
".",
"share",
"(",
")",
"shared",
"[",
"'model'",
"]",
"=",
"self",
".",
"model",
"shared",
"[",
"'metrics'",
"]",
"=",
"self",
".",
"metrics",
"if",
"self",
".",
"beam_dot_lo... | [
619,
4
] | [
628,
21
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.vectorize | (self, *args, **kwargs) |
Override vectorize for seq2seq.
|
Override vectorize for seq2seq.
| def vectorize(self, *args, **kwargs):
"""
Override vectorize for seq2seq.
"""
kwargs['add_start'] = False # model does this in module code
kwargs['add_end'] = True # we do want this
return super().vectorize(*args, **kwargs) | [
"def",
"vectorize",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'add_start'",
"]",
"=",
"False",
"# model does this in module code",
"kwargs",
"[",
"'add_end'",
"]",
"=",
"True",
"# we do want this",
"return",
"super",
"... | [
630,
4
] | [
636,
49
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.batchify | (self, *args, **kwargs) |
Override batchify options for seq2seq.
|
Override batchify options for seq2seq.
| def batchify(self, *args, **kwargs):
"""
Override batchify options for seq2seq.
"""
kwargs['sort'] = True # need sorted for pack_padded
batch = super().batchify(*args, **kwargs)
# Get some args needed for batchify
obs_batch = args[0]
sort = kwargs['sort'... | [
"def",
"batchify",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'sort'",
"]",
"=",
"True",
"# need sorted for pack_padded",
"batch",
"=",
"super",
"(",
")",
".",
"batchify",
"(",
"*",
"args",
",",
"*",
"*",
"kwarg... | [
638,
4
] | [
692,
20
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent._init_cuda_buffer | (self, model, criterion, batchsize, maxlen) |
Pre-initialize CUDA buffer by doing fake forward pass.
|
Pre-initialize CUDA buffer by doing fake forward pass.
| def _init_cuda_buffer(self, model, criterion, batchsize, maxlen):
"""
Pre-initialize CUDA buffer by doing fake forward pass.
"""
if self.use_cuda and not hasattr(self, 'buffer_initialized'):
try:
print('preinitializing pytorch cuda buffer')
dum... | [
"def",
"_init_cuda_buffer",
"(",
"self",
",",
"model",
",",
"criterion",
",",
"batchsize",
",",
"maxlen",
")",
":",
"if",
"self",
".",
"use_cuda",
"and",
"not",
"hasattr",
"(",
"self",
",",
"'buffer_initialized'",
")",
":",
"try",
":",
"print",
"(",
"'pr... | [
694,
4
] | [
722,
27
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.train_step | (self, batch) |
Train on a single batch of examples.
|
Train on a single batch of examples.
| def train_step(self, batch):
"""
Train on a single batch of examples.
"""
batchsize = batch.text_vec.size(0)
if self.multigpu and batchsize % 2 != 0:
# throw out one training example
batch = self.truncate_input(batch)
# helps with memory usage
... | [
"def",
"train_step",
"(",
"self",
",",
"batch",
")",
":",
"batchsize",
"=",
"batch",
".",
"text_vec",
".",
"size",
"(",
"0",
")",
"if",
"self",
".",
"multigpu",
"and",
"batchsize",
"%",
"2",
"!=",
"0",
":",
"# throw out one training example",
"batch",
"=... | [
724,
4
] | [
771,
23
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.greedy_search | (self, batch) |
Perform greedy search.
|
Perform greedy search.
| def greedy_search(self, batch):
"""
Perform greedy search.
"""
cand_params = self._build_cands(batch)
seq_len = None if not self.multigpu else batch.text_vec.size(1)
out = self.model(
batch.text_vec,
batch.ctrl_vec,
ys=None,
... | [
"def",
"greedy_search",
"(",
"self",
",",
"batch",
")",
":",
"cand_params",
"=",
"self",
".",
"_build_cands",
"(",
"batch",
")",
"seq_len",
"=",
"None",
"if",
"not",
"self",
".",
"multigpu",
"else",
"batch",
".",
"text_vec",
".",
"size",
"(",
"1",
")",... | [
795,
4
] | [
808,
31
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.beam_search | (
model,
batch,
beam_size,
dictionary,
start=1,
end=2,
pad=0,
min_length=3,
min_n_best=5,
max_ts=40,
block_ngram=0,
wd_features=None,
wd_wts=None,
) |
Beam search given the model and Batch.
This function uses model with the following reqs:
- model.encoder takes input returns tuple (enc_out, enc_hidden, attn_mask)
- model.decoder takes decoder params and returns decoder outputs after attn
- model.output takes decoder outputs ... |
Beam search given the model and Batch. | def beam_search(
model,
batch,
beam_size,
dictionary,
start=1,
end=2,
pad=0,
min_length=3,
min_n_best=5,
max_ts=40,
block_ngram=0,
wd_features=None,
wd_wts=None,
):
"""
Beam search given the model... | [
"def",
"beam_search",
"(",
"model",
",",
"batch",
",",
"beam_size",
",",
"dictionary",
",",
"start",
"=",
"1",
",",
"end",
"=",
"2",
",",
"pad",
"=",
"0",
",",
"min_length",
"=",
"3",
",",
"min_n_best",
"=",
"5",
",",
"max_ts",
"=",
"40",
",",
"b... | [
811,
4
] | [
1016,
65
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.extend_input | (self, batch) |
Extend the input.
|
Extend the input.
| def extend_input(self, batch):
"""
Extend the input.
"""
# add pad tensor to text vec
pad_tensor = torch.zeros(1, batch.text_vec.size(1)).long().cuda()
text_vec = torch.cat([batch.text_vec, pad_tensor], 0)
batch = batch._replace(text_vec=text_vec)
if batch... | [
"def",
"extend_input",
"(",
"self",
",",
"batch",
")",
":",
"# add pad tensor to text vec",
"pad_tensor",
"=",
"torch",
".",
"zeros",
"(",
"1",
",",
"batch",
".",
"text_vec",
".",
"size",
"(",
"1",
")",
")",
".",
"long",
"(",
")",
".",
"cuda",
"(",
"... | [
1018,
4
] | [
1040,
20
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.truncate_input | (self, batch) |
Truncate the input.
|
Truncate the input.
| def truncate_input(self, batch):
"""
Truncate the input.
"""
# truncate batch for multigpu
text_vec = batch.text_vec[:-1]
batch = batch._replace(text_vec=text_vec)
if batch.label_vec is not None:
label_vec = batch.label_vec[:-1]
batch = bat... | [
"def",
"truncate_input",
"(",
"self",
",",
"batch",
")",
":",
"# truncate batch for multigpu",
"text_vec",
"=",
"batch",
".",
"text_vec",
"[",
":",
"-",
"1",
"]",
"batch",
"=",
"batch",
".",
"_replace",
"(",
"text_vec",
"=",
"text_vec",
")",
"if",
"batch",... | [
1042,
4
] | [
1052,
20
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.truncate_output | (self, out) |
Truncate the output.
|
Truncate the output.
| def truncate_output(self, out):
"""
Truncate the output.
"""
new_out_0 = out[0][:-1]
new_out_1 = None if out[1] is None else out[1][:-1]
new_out_2 = [vec[:-1] for vec in out[2]]
return tuple([new_out_0, new_out_1, new_out_2]) | [
"def",
"truncate_output",
"(",
"self",
",",
"out",
")",
":",
"new_out_0",
"=",
"out",
"[",
"0",
"]",
"[",
":",
"-",
"1",
"]",
"new_out_1",
"=",
"None",
"if",
"out",
"[",
"1",
"]",
"is",
"None",
"else",
"out",
"[",
"1",
"]",
"[",
":",
"-",
"1"... | [
1054,
4
] | [
1061,
55
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.eval_step | (self, batch) |
Evaluate a single batch of examples.
|
Evaluate a single batch of examples.
| def eval_step(self, batch):
"""
Evaluate a single batch of examples.
"""
if batch.text_vec is None:
return
orig_batch = batch # save for evaluation
needs_truncation = self.multigpu and batch.text_vec.size(0) % 2 != 0
if needs_truncation:
#... | [
"def",
"eval_step",
"(",
"self",
",",
"batch",
")",
":",
"if",
"batch",
".",
"text_vec",
"is",
"None",
":",
"return",
"orig_batch",
"=",
"batch",
"# save for evaluation",
"needs_truncation",
"=",
"self",
".",
"multigpu",
"and",
"batch",
".",
"text_vec",
".",... | [
1063,
4
] | [
1162,
41
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.save | (self, path=None) |
Save model parameters if model_file is set.
|
Save model parameters if model_file is set.
| def save(self, path=None):
"""
Save model parameters if model_file is set.
"""
path = self.opt.get('model_file', None) if path is None else path
if path and hasattr(self, 'model'):
model = {}
model['model'] = self.model.state_dict()
model['lon... | [
"def",
"save",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"path",
"=",
"self",
".",
"opt",
".",
"get",
"(",
"'model_file'",
",",
"None",
")",
"if",
"path",
"is",
"None",
"else",
"path",
"if",
"path",
"and",
"hasattr",
"(",
"self",
",",
"'mo... | [
1164,
4
] | [
1182,
43
] | python | en | ['en', 'error', 'th'] | False |
ControllableSeq2seqAgent.load | (self, path) |
Return opt and model states.
|
Return opt and model states.
| def load(self, path):
"""
Return opt and model states.
"""
with PathManager.open(path, 'rb') as f:
states = torch.load(f, map_location=lambda cpu, _: cpu)
# check opt file for multigpu
with PathManager.open(path + ".opt", 'r') as handle:
saved_opt... | [
"def",
"load",
"(",
"self",
",",
"path",
")",
":",
"with",
"PathManager",
".",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"f",
":",
"states",
"=",
"torch",
".",
"load",
"(",
"f",
",",
"map_location",
"=",
"lambda",
"cpu",
",",
"_",
":",
"cpu",
... | [
1184,
4
] | [
1205,
21
] | python | en | ['en', 'error', 'th'] | False |
Beam.__init__ | (
self,
beam_size,
min_length=3,
padding_token=0,
bos_token=1,
eos_token=2,
min_n_best=3,
cuda='cpu',
block_ngram=0,
) |
Instantiate Beam object.
:param beam_size:
number of hypothesis in the beam
:param min_length:
minimum length of the predicted sequence
:param padding_token:
Set to 0 as usual in ParlAI
:param bos_token:
Set to 1 as usual in ParlA... |
Instantiate Beam object. | def __init__(
self,
beam_size,
min_length=3,
padding_token=0,
bos_token=1,
eos_token=2,
min_n_best=3,
cuda='cpu',
block_ngram=0,
):
"""
Instantiate Beam object.
:param beam_size:
number of hypothesis in the ... | [
"def",
"__init__",
"(",
"self",
",",
"beam_size",
",",
"min_length",
"=",
"3",
",",
"padding_token",
"=",
"0",
",",
"bos_token",
"=",
"1",
",",
"eos_token",
"=",
"2",
",",
"min_n_best",
"=",
"3",
",",
"cuda",
"=",
"'cpu'",
",",
"block_ngram",
"=",
"0... | [
1215,
4
] | [
1271,
66
] | python | en | ['en', 'error', 'th'] | False |
Beam.find_ngrams | (input_list, n) |
Get list of ngrams with context length n-1.
|
Get list of ngrams with context length n-1.
| def find_ngrams(input_list, n):
"""
Get list of ngrams with context length n-1.
"""
return list(zip(*[input_list[i:] for i in range(n)])) | [
"def",
"find_ngrams",
"(",
"input_list",
",",
"n",
")",
":",
"return",
"list",
"(",
"zip",
"(",
"*",
"[",
"input_list",
"[",
"i",
":",
"]",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
")",
")"
] | [
1274,
4
] | [
1278,
61
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_output_from_current_step | (self) |
Get the outputput at the current step.
|
Get the outputput at the current step.
| def get_output_from_current_step(self):
"""
Get the outputput at the current step.
"""
return self.outputs[-1] | [
"def",
"get_output_from_current_step",
"(",
"self",
")",
":",
"return",
"self",
".",
"outputs",
"[",
"-",
"1",
"]"
] | [
1280,
4
] | [
1284,
31
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_backtrack_from_current_step | (self) |
Get the backtrack at the current step.
|
Get the backtrack at the current step.
| def get_backtrack_from_current_step(self):
"""
Get the backtrack at the current step.
"""
return self.bookkeep[-1] | [
"def",
"get_backtrack_from_current_step",
"(",
"self",
")",
":",
"return",
"self",
".",
"bookkeep",
"[",
"-",
"1",
"]"
] | [
1286,
4
] | [
1290,
32
] | python | en | ['en', 'error', 'th'] | False |
Beam.advance | (self, softmax_probs) |
Advance the beam one step.
|
Advance the beam one step.
| def advance(self, softmax_probs):
"""
Advance the beam one step.
"""
voc_size = softmax_probs.size(-1)
current_length = len(self.all_scores) - 1
if current_length < self.min_length:
# penalize all eos probs to make it decode longer
for hyp_id in ra... | [
"def",
"advance",
"(",
"self",
",",
"softmax_probs",
")",
":",
"voc_size",
"=",
"softmax_probs",
".",
"size",
"(",
"-",
"1",
")",
"current_length",
"=",
"len",
"(",
"self",
".",
"all_scores",
")",
"-",
"1",
"if",
"current_length",
"<",
"self",
".",
"mi... | [
1292,
4
] | [
1367,
55
] | python | en | ['en', 'error', 'th'] | False |
Beam.done | (self) |
Return whether beam search is complete.
|
Return whether beam search is complete.
| def done(self):
"""
Return whether beam search is complete.
"""
return self.eos_top and self.n_best_counter >= self.min_n_best | [
"def",
"done",
"(",
"self",
")",
":",
"return",
"self",
".",
"eos_top",
"and",
"self",
".",
"n_best_counter",
">=",
"self",
".",
"min_n_best"
] | [
1369,
4
] | [
1373,
70
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_top_hyp | (self) |
Get single best hypothesis.
:return: hypothesis sequence and the final score
|
Get single best hypothesis. | def get_top_hyp(self):
"""
Get single best hypothesis.
:return: hypothesis sequence and the final score
"""
top_hypothesis_tail = self.get_rescored_finished(n_best=1)[0]
return (
self.get_hyp_from_finished(top_hypothesis_tail),
top_hypothesis_tail... | [
"def",
"get_top_hyp",
"(",
"self",
")",
":",
"top_hypothesis_tail",
"=",
"self",
".",
"get_rescored_finished",
"(",
"n_best",
"=",
"1",
")",
"[",
"0",
"]",
"return",
"(",
"self",
".",
"get_hyp_from_finished",
"(",
"top_hypothesis_tail",
")",
",",
"top_hypothes... | [
1375,
4
] | [
1385,
9
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_hyp_from_finished | (self, hypothesis_tail) |
Extract hypothesis ending with EOS at timestep with hyp_id.
:param timestep:
timestep with range up to len(self.outputs)-1
:param hyp_id:
id with range up to beam_size-1
:return:
hypothesis sequence
|
Extract hypothesis ending with EOS at timestep with hyp_id. | def get_hyp_from_finished(self, hypothesis_tail):
"""
Extract hypothesis ending with EOS at timestep with hyp_id.
:param timestep:
timestep with range up to len(self.outputs)-1
:param hyp_id:
id with range up to beam_size-1
:return:
hypothesis... | [
"def",
"get_hyp_from_finished",
"(",
"self",
",",
"hypothesis_tail",
")",
":",
"assert",
"self",
".",
"outputs",
"[",
"hypothesis_tail",
".",
"timestep",
"]",
"[",
"hypothesis_tail",
".",
"hypid",
"]",
"==",
"self",
".",
"eos",
"assert",
"hypothesis_tail",
"."... | [
1387,
4
] | [
1413,
22
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_pretty_hypothesis | (list_of_hypotails) |
Return prettier version of the hypotheses.
|
Return prettier version of the hypotheses.
| def get_pretty_hypothesis(list_of_hypotails):
"""
Return prettier version of the hypotheses.
"""
hypothesis = []
for i in list_of_hypotails:
hypothesis.append(i.tokenid)
hypothesis = torch.stack(list(reversed(hypothesis)))
return hypothesis | [
"def",
"get_pretty_hypothesis",
"(",
"list_of_hypotails",
")",
":",
"hypothesis",
"=",
"[",
"]",
"for",
"i",
"in",
"list_of_hypotails",
":",
"hypothesis",
".",
"append",
"(",
"i",
".",
"tokenid",
")",
"hypothesis",
"=",
"torch",
".",
"stack",
"(",
"list",
... | [
1416,
4
] | [
1426,
25
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_rescored_finished | (self, n_best=None) |
Return finished hypotheses in rescored order.
:param n_best:
how many n best hypothesis to return
:return:
list with hypothesis
|
Return finished hypotheses in rescored order. | def get_rescored_finished(self, n_best=None):
"""
Return finished hypotheses in rescored order.
:param n_best:
how many n best hypothesis to return
:return:
list with hypothesis
"""
rescored_finished = []
for finished_item in self.finished... | [
"def",
"get_rescored_finished",
"(",
"self",
",",
"n_best",
"=",
"None",
")",
":",
"rescored_finished",
"=",
"[",
"]",
"for",
"finished_item",
"in",
"self",
".",
"finished",
":",
"current_length",
"=",
"finished_item",
".",
"timestep",
"+",
"1",
"# these weigh... | [
1428,
4
] | [
1456,
20
] | python | en | ['en', 'error', 'th'] | False |
Beam.check_finished | (self) |
Check if self.finished is empty and add hyptail in that case.
This will be suboptimal hypothesis since the model did not get any EOS
|
Check if self.finished is empty and add hyptail in that case. | def check_finished(self):
"""
Check if self.finished is empty and add hyptail in that case.
This will be suboptimal hypothesis since the model did not get any EOS
"""
if len(self.finished) == 0:
# we change output because we want outputs to have eos
# to ... | [
"def",
"check_finished",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"finished",
")",
"==",
"0",
":",
"# we change output because we want outputs to have eos",
"# to pass assert in L102, it is ok since empty self.finished",
"# means junk prediction anyway",
"self",
... | [
1458,
4
] | [
1476,
41
] | python | en | ['en', 'error', 'th'] | False |
Beam.get_beam_dot | (self, dictionary=None, n_best=None) |
Create pydot graph representation of the beam.
:param outputs:
self.outputs from the beam
:param dictionary:
tok 2 word dict to save words in the tree nodes
:returns:
pydot graph
|
Create pydot graph representation of the beam. | def get_beam_dot(self, dictionary=None, n_best=None):
"""
Create pydot graph representation of the beam.
:param outputs:
self.outputs from the beam
:param dictionary:
tok 2 word dict to save words in the tree nodes
:returns:
pydot graph
... | [
"def",
"get_beam_dot",
"(",
"self",
",",
"dictionary",
"=",
"None",
",",
"n_best",
"=",
"None",
")",
":",
"try",
":",
"import",
"pydot",
"except",
"ImportError",
":",
"print",
"(",
"\"Please install pydot package to dump beam visualization\"",
")",
"graph",
"=",
... | [
1478,
4
] | [
1573,
20
] | 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.