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 |
---|---|---|---|---|---|---|---|---|---|---|---|
TestCredentialIssue.test_deserialize | (self, mock_credential_issue_schema_load) |
Test deserialize
|
Test deserialize
| def test_deserialize(self, mock_credential_issue_schema_load):
"""
Test deserialize
"""
obj = self.cred_issue
credential_issue = CredentialIssue.deserialize(obj)
mock_credential_issue_schema_load.assert_called_once_with(obj)
assert credential_issue is mock_credential_issue_schema_load.return_value | [
"def",
"test_deserialize",
"(",
"self",
",",
"mock_credential_issue_schema_load",
")",
":",
"obj",
"=",
"self",
".",
"cred_issue",
"credential_issue",
"=",
"CredentialIssue",
".",
"deserialize",
"(",
"obj",
")",
"mock_credential_issue_schema_load",
".",
"assert_called_once_with",
"(",
"obj",
")",
"assert",
"credential_issue",
"is",
"mock_credential_issue_schema_load",
".",
"return_value"
] | [
106,
4
] | [
115,
81
] | python | en | ['en', 'error', 'th'] | False |
TestCredentialIssue.test_serialize | (self, mock_credential_issue_schema_dump) |
Test serialization.
|
Test serialization.
| def test_serialize(self, mock_credential_issue_schema_dump):
"""
Test serialization.
"""
obj = self.cred_issue
credential_issue_dict = obj.serialize()
mock_credential_issue_schema_dump.assert_called_once_with(obj)
assert credential_issue_dict is mock_credential_issue_schema_dump.return_value | [
"def",
"test_serialize",
"(",
"self",
",",
"mock_credential_issue_schema_dump",
")",
":",
"obj",
"=",
"self",
".",
"cred_issue",
"credential_issue_dict",
"=",
"obj",
".",
"serialize",
"(",
")",
"mock_credential_issue_schema_dump",
".",
"assert_called_once_with",
"(",
"obj",
")",
"assert",
"credential_issue_dict",
"is",
"mock_credential_issue_schema_dump",
".",
"return_value"
] | [
120,
4
] | [
129,
86
] | python | en | ['en', 'error', 'th'] | False |
TestCredentialIssueSchema.test_make_model | (self) | Test making model. | Test making model. | def test_make_model(self):
"""Test making model."""
data = self.credential_issue.serialize()
model_instance = CredentialIssue.deserialize(data)
assert isinstance(model_instance, CredentialIssue) | [
"def",
"test_make_model",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"credential_issue",
".",
"serialize",
"(",
")",
"model_instance",
"=",
"CredentialIssue",
".",
"deserialize",
"(",
"data",
")",
"assert",
"isinstance",
"(",
"model_instance",
",",
"CredentialIssue",
")"
] | [
140,
4
] | [
144,
58
] | python | en | ['en', 'no', 'en'] | True |
compare_opts | (opt_path_1: str, opt_path_2: str, load_raw: bool = False) |
Super simple script to compare the contents of two .opt files.
Return the formatted text comparing the two .opts, for printing.
|
Super simple script to compare the contents of two .opt files. | def compare_opts(opt_path_1: str, opt_path_2: str, load_raw: bool = False) -> str:
"""
Super simple script to compare the contents of two .opt files.
Return the formatted text comparing the two .opts, for printing.
"""
# Loading opt files
if load_raw:
with open(opt_path_1) as f1:
opt1 = json.load(f1)
with open(opt_path_2) as f2:
opt2 = json.load(f2)
else:
opt1 = Opt.load(opt_path_1)
opt2 = Opt.load(opt_path_2)
outputs = list()
outputs.append('\nArgs only found in opt 1:')
opt1_only_keys = sorted([k for k in opt1.keys() if k not in opt2.keys()])
for key in opt1_only_keys:
outputs.append(f'{key}: {opt1[key]}')
outputs.append('\nArgs only found in opt 2:')
opt2_only_keys = sorted([k for k in opt2.keys() if k not in opt1.keys()])
for key in opt2_only_keys:
outputs.append(f'{key}: {opt2[key]}')
outputs.append('\nArgs that are different in both opts:')
keys_with_conflicting_values = sorted(
[k for k, v in opt1.items() if k in opt2.keys() and v != opt2[k]]
)
for key in keys_with_conflicting_values:
if isinstance(opt1[key], dict) and isinstance(opt2[key], dict):
outputs.append(f'{key} (printing only non-matching values in each dict):')
all_inner_keys = sorted(
list(set(opt1[key].keys()).union(set(opt2[key].keys())))
)
for inner_key in all_inner_keys:
if (
inner_key not in opt1[key]
or inner_key not in opt2[key]
or opt1[key][inner_key] != opt2[key][inner_key]
):
outputs.append(f'\t{inner_key}:')
outputs.append(
f'\t\tIn opt 1: {opt1[key].get(inner_key, "<MISSING>")}'
)
outputs.append(
f'\t\tIn opt 2: {opt2[key].get(inner_key, "<MISSING>")}'
)
else:
outputs.append(f'{key}:')
outputs.append(f'\tIn opt 1: {opt1[key]}')
outputs.append(f'\tIn opt 2: {opt2[key]}')
return '\n'.join(outputs) | [
"def",
"compare_opts",
"(",
"opt_path_1",
":",
"str",
",",
"opt_path_2",
":",
"str",
",",
"load_raw",
":",
"bool",
"=",
"False",
")",
"->",
"str",
":",
"# Loading opt files",
"if",
"load_raw",
":",
"with",
"open",
"(",
"opt_path_1",
")",
"as",
"f1",
":",
"opt1",
"=",
"json",
".",
"load",
"(",
"f1",
")",
"with",
"open",
"(",
"opt_path_2",
")",
"as",
"f2",
":",
"opt2",
"=",
"json",
".",
"load",
"(",
"f2",
")",
"else",
":",
"opt1",
"=",
"Opt",
".",
"load",
"(",
"opt_path_1",
")",
"opt2",
"=",
"Opt",
".",
"load",
"(",
"opt_path_2",
")",
"outputs",
"=",
"list",
"(",
")",
"outputs",
".",
"append",
"(",
"'\\nArgs only found in opt 1:'",
")",
"opt1_only_keys",
"=",
"sorted",
"(",
"[",
"k",
"for",
"k",
"in",
"opt1",
".",
"keys",
"(",
")",
"if",
"k",
"not",
"in",
"opt2",
".",
"keys",
"(",
")",
"]",
")",
"for",
"key",
"in",
"opt1_only_keys",
":",
"outputs",
".",
"append",
"(",
"f'{key}: {opt1[key]}'",
")",
"outputs",
".",
"append",
"(",
"'\\nArgs only found in opt 2:'",
")",
"opt2_only_keys",
"=",
"sorted",
"(",
"[",
"k",
"for",
"k",
"in",
"opt2",
".",
"keys",
"(",
")",
"if",
"k",
"not",
"in",
"opt1",
".",
"keys",
"(",
")",
"]",
")",
"for",
"key",
"in",
"opt2_only_keys",
":",
"outputs",
".",
"append",
"(",
"f'{key}: {opt2[key]}'",
")",
"outputs",
".",
"append",
"(",
"'\\nArgs that are different in both opts:'",
")",
"keys_with_conflicting_values",
"=",
"sorted",
"(",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"opt1",
".",
"items",
"(",
")",
"if",
"k",
"in",
"opt2",
".",
"keys",
"(",
")",
"and",
"v",
"!=",
"opt2",
"[",
"k",
"]",
"]",
")",
"for",
"key",
"in",
"keys_with_conflicting_values",
":",
"if",
"isinstance",
"(",
"opt1",
"[",
"key",
"]",
",",
"dict",
")",
"and",
"isinstance",
"(",
"opt2",
"[",
"key",
"]",
",",
"dict",
")",
":",
"outputs",
".",
"append",
"(",
"f'{key} (printing only non-matching values in each dict):'",
")",
"all_inner_keys",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"opt1",
"[",
"key",
"]",
".",
"keys",
"(",
")",
")",
".",
"union",
"(",
"set",
"(",
"opt2",
"[",
"key",
"]",
".",
"keys",
"(",
")",
")",
")",
")",
")",
"for",
"inner_key",
"in",
"all_inner_keys",
":",
"if",
"(",
"inner_key",
"not",
"in",
"opt1",
"[",
"key",
"]",
"or",
"inner_key",
"not",
"in",
"opt2",
"[",
"key",
"]",
"or",
"opt1",
"[",
"key",
"]",
"[",
"inner_key",
"]",
"!=",
"opt2",
"[",
"key",
"]",
"[",
"inner_key",
"]",
")",
":",
"outputs",
".",
"append",
"(",
"f'\\t{inner_key}:'",
")",
"outputs",
".",
"append",
"(",
"f'\\t\\tIn opt 1: {opt1[key].get(inner_key, \"<MISSING>\")}'",
")",
"outputs",
".",
"append",
"(",
"f'\\t\\tIn opt 2: {opt2[key].get(inner_key, \"<MISSING>\")}'",
")",
"else",
":",
"outputs",
".",
"append",
"(",
"f'{key}:'",
")",
"outputs",
".",
"append",
"(",
"f'\\tIn opt 1: {opt1[key]}'",
")",
"outputs",
".",
"append",
"(",
"f'\\tIn opt 2: {opt2[key]}'",
")",
"return",
"'\\n'",
".",
"join",
"(",
"outputs",
")"
] | [
12,
0
] | [
69,
29
] | python | en | ['en', 'error', 'th'] | False |
retrieve | (sha1, **kwargs) |
Retrieve the most up-to-date copy of the plot-schema wrt the given hash.
:param (str) sha1: The last-known hash of the plot-schema (or '').
:returns: (requests.Response) Returns response directly from requests.
|
Retrieve the most up-to-date copy of the plot-schema wrt the given hash. | def retrieve(sha1, **kwargs):
"""
Retrieve the most up-to-date copy of the plot-schema wrt the given hash.
:param (str) sha1: The last-known hash of the plot-schema (or '').
:returns: (requests.Response) Returns response directly from requests.
"""
url = build_url(RESOURCE)
params = make_params(sha1=sha1)
return request("get", url, params=params, **kwargs) | [
"def",
"retrieve",
"(",
"sha1",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"build_url",
"(",
"RESOURCE",
")",
"params",
"=",
"make_params",
"(",
"sha1",
"=",
"sha1",
")",
"return",
"request",
"(",
"\"get\"",
",",
"url",
",",
"params",
"=",
"params",
",",
"*",
"*",
"kwargs",
")"
] | [
8,
0
] | [
18,
55
] | python | en | ['en', 'error', 'th'] | False |
Textfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
64,
28
] | python | en | ['en', 'error', 'th'] | False |
Textfont.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 |
Textfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
|
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
str|numpy.ndarray
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
93,
4
] | [
116,
29
] | python | en | ['en', 'error', 'th'] | False |
Textfont.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 |
Textfont.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 |
Textfont.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 |
Textfont.__init__ | (
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
) |
Construct a new Textfont object
Sets the font used for `textinfo`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.treemap.Textfont`
color
colorsrc
Sets the source reference on Chart Studio Cloud for
color .
family
HTML font family - the typeface that will be applied by
the web browser. The web browser will only be able to
apply a font if it is available on the system which it
operates. Provide multiple font families, separated by
commas, to indicate the preference in which to apply
fonts if they aren't available on the system. The Chart
Studio Cloud (at https://chart-studio.plotly.com or on-
premise) generates images on a server, where only a
select number of fonts are installed and supported.
These include "Arial", "Balto", "Courier New", "Droid
Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT
Sans Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud for
family .
size
sizesrc
Sets the source reference on Chart Studio Cloud for
size .
Returns
-------
Textfont
|
Construct a new Textfont object
Sets the font used for `textinfo`. | def __init__(
self,
arg=None,
color=None,
colorsrc=None,
family=None,
familysrc=None,
size=None,
sizesrc=None,
**kwargs
):
"""
Construct a new Textfont object
Sets the font used for `textinfo`.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.treemap.Textfont`
color
colorsrc
Sets the source reference on Chart Studio Cloud for
color .
family
HTML font family - the typeface that will be applied by
the web browser. The web browser will only be able to
apply a font if it is available on the system which it
operates. Provide multiple font families, separated by
commas, to indicate the preference in which to apply
fonts if they aren't available on the system. The Chart
Studio Cloud (at https://chart-studio.plotly.com or on-
premise) generates images on a server, where only a
select number of fonts are installed and supported.
These include "Arial", "Balto", "Courier New", "Droid
Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT
Sans Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud for
family .
size
sizesrc
Sets the source reference on Chart Studio Cloud for
size .
Returns
-------
Textfont
"""
super(Textfont, self).__init__("textfont")
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.treemap.Textfont
constructor must be a dict or
an instance of :class:`plotly.graph_objs.treemap.Textfont`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("colorsrc", None)
_v = colorsrc if colorsrc is not None else _v
if _v is not None:
self["colorsrc"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("familysrc", None)
_v = familysrc if familysrc is not None else _v
if _v is not None:
self["familysrc"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
_v = arg.pop("sizesrc", None)
_v = sizesrc if sizesrc is not None else _v
if _v is not None:
self["sizesrc"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"family",
"=",
"None",
",",
"familysrc",
"=",
"None",
",",
"size",
"=",
"None",
",",
"sizesrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Textfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"textfont\"",
")",
"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.treemap.Textfont \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.treemap.Textfont`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"colorsrc\"",
",",
"None",
")",
"_v",
"=",
"colorsrc",
"if",
"colorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"colorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"familysrc\"",
",",
"None",
")",
"_v",
"=",
"familysrc",
"if",
"familysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"familysrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"sizesrc\"",
",",
"None",
")",
"_v",
"=",
"sizesrc",
"if",
"sizesrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"sizesrc\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
215,
4
] | [
329,
34
] | python | en | ['en', 'error', 'th'] | False |
_compare_figures | (go_trace, px_fig) | Compare a figure created with a go trace and a figure created with
a px function call. Check that all values inside the go Figure are the
same in the px figure (which sets more parameters).
| Compare a figure created with a go trace and a figure created with
a px function call. Check that all values inside the go Figure are the
same in the px figure (which sets more parameters).
| def _compare_figures(go_trace, px_fig):
"""Compare a figure created with a go trace and a figure created with
a px function call. Check that all values inside the go Figure are the
same in the px figure (which sets more parameters).
"""
go_fig = go.Figure(go_trace)
go_fig = go_fig.to_plotly_json()
px_fig = px_fig.to_plotly_json()
del go_fig["layout"]["template"]
del px_fig["layout"]["template"]
for key in go_fig["data"][0]:
assert_array_equal(go_fig["data"][0][key], px_fig["data"][0][key])
for key in go_fig["layout"]:
assert go_fig["layout"][key] == px_fig["layout"][key] | [
"def",
"_compare_figures",
"(",
"go_trace",
",",
"px_fig",
")",
":",
"go_fig",
"=",
"go",
".",
"Figure",
"(",
"go_trace",
")",
"go_fig",
"=",
"go_fig",
".",
"to_plotly_json",
"(",
")",
"px_fig",
"=",
"px_fig",
".",
"to_plotly_json",
"(",
")",
"del",
"go_fig",
"[",
"\"layout\"",
"]",
"[",
"\"template\"",
"]",
"del",
"px_fig",
"[",
"\"layout\"",
"]",
"[",
"\"template\"",
"]",
"for",
"key",
"in",
"go_fig",
"[",
"\"data\"",
"]",
"[",
"0",
"]",
":",
"assert_array_equal",
"(",
"go_fig",
"[",
"\"data\"",
"]",
"[",
"0",
"]",
"[",
"key",
"]",
",",
"px_fig",
"[",
"\"data\"",
"]",
"[",
"0",
"]",
"[",
"key",
"]",
")",
"for",
"key",
"in",
"go_fig",
"[",
"\"layout\"",
"]",
":",
"assert",
"go_fig",
"[",
"\"layout\"",
"]",
"[",
"key",
"]",
"==",
"px_fig",
"[",
"\"layout\"",
"]",
"[",
"key",
"]"
] | [
8,
0
] | [
21,
61
] | python | en | ['en', 'en', 'en'] | True |
KPCNN.loss | (self, outputs, labels) |
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
|
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
| def loss(self, outputs, labels):
"""
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
"""
# Cross entropy loss
self.output_loss = self.criterion(outputs, labels)
# Regularization of deformable offsets
if self.deform_fitting_mode == 'point2point':
self.reg_loss = p2p_fitting_regularizer(self)
elif self.deform_fitting_mode == 'point2plane':
raise ValueError('point2plane fitting mode not implemented yet.')
else:
raise ValueError('Unknown fitting mode: ' + self.deform_fitting_mode)
# Combined loss
return self.output_loss + self.reg_loss | [
"def",
"loss",
"(",
"self",
",",
"outputs",
",",
"labels",
")",
":",
"# Cross entropy loss",
"self",
".",
"output_loss",
"=",
"self",
".",
"criterion",
"(",
"outputs",
",",
"labels",
")",
"# Regularization of deformable offsets",
"if",
"self",
".",
"deform_fitting_mode",
"==",
"'point2point'",
":",
"self",
".",
"reg_loss",
"=",
"p2p_fitting_regularizer",
"(",
"self",
")",
"elif",
"self",
".",
"deform_fitting_mode",
"==",
"'point2plane'",
":",
"raise",
"ValueError",
"(",
"'point2plane fitting mode not implemented yet.'",
")",
"else",
":",
"raise",
"ValueError",
"(",
"'Unknown fitting mode: '",
"+",
"self",
".",
"deform_fitting_mode",
")",
"# Combined loss",
"return",
"self",
".",
"output_loss",
"+",
"self",
".",
"reg_loss"
] | [
150,
4
] | [
170,
47
] | python | en | ['en', 'error', 'th'] | False |
KPCNN.accuracy | (outputs, labels) |
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
|
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
| def accuracy(outputs, labels):
"""
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
"""
predicted = torch.argmax(outputs.data, dim=1)
total = labels.size(0)
correct = (predicted == labels).sum().item()
return correct / total | [
"def",
"accuracy",
"(",
"outputs",
",",
"labels",
")",
":",
"predicted",
"=",
"torch",
".",
"argmax",
"(",
"outputs",
".",
"data",
",",
"dim",
"=",
"1",
")",
"total",
"=",
"labels",
".",
"size",
"(",
"0",
")",
"correct",
"=",
"(",
"predicted",
"==",
"labels",
")",
".",
"sum",
"(",
")",
".",
"item",
"(",
")",
"return",
"correct",
"/",
"total"
] | [
173,
4
] | [
185,
30
] | python | en | ['en', 'error', 'th'] | False |
KPFCNN.loss | (self, outputs, labels) |
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
|
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
| def loss(self, outputs, labels):
"""
Runs the loss on outputs of the model
:param outputs: logits
:param labels: labels
:return: loss
"""
# Set all ignored labels to -1 and correct the other label to be in [0, C-1] range
target = - torch.ones_like(labels)
for i, c in enumerate(self.valid_labels):
target[labels == c] = i
# Reshape to have a minibatch size of 1
outputs = torch.transpose(outputs, 0, 1)
outputs = outputs.unsqueeze(0)
target = target.unsqueeze(0)
# Cross entropy loss
self.output_loss = self.criterion(outputs, target)
# Regularization of deformable offsets
if self.deform_fitting_mode == 'point2point':
self.reg_loss = p2p_fitting_regularizer(self)
elif self.deform_fitting_mode == 'point2plane':
raise ValueError('point2plane fitting mode not implemented yet.')
else:
raise ValueError('Unknown fitting mode: ' + self.deform_fitting_mode)
# Combined loss
return self.output_loss + self.reg_loss | [
"def",
"loss",
"(",
"self",
",",
"outputs",
",",
"labels",
")",
":",
"# Set all ignored labels to -1 and correct the other label to be in [0, C-1] range",
"target",
"=",
"-",
"torch",
".",
"ones_like",
"(",
"labels",
")",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"self",
".",
"valid_labels",
")",
":",
"target",
"[",
"labels",
"==",
"c",
"]",
"=",
"i",
"# Reshape to have a minibatch size of 1",
"outputs",
"=",
"torch",
".",
"transpose",
"(",
"outputs",
",",
"0",
",",
"1",
")",
"outputs",
"=",
"outputs",
".",
"unsqueeze",
"(",
"0",
")",
"target",
"=",
"target",
".",
"unsqueeze",
"(",
"0",
")",
"# Cross entropy loss",
"self",
".",
"output_loss",
"=",
"self",
".",
"criterion",
"(",
"outputs",
",",
"target",
")",
"# Regularization of deformable offsets",
"if",
"self",
".",
"deform_fitting_mode",
"==",
"'point2point'",
":",
"self",
".",
"reg_loss",
"=",
"p2p_fitting_regularizer",
"(",
"self",
")",
"elif",
"self",
".",
"deform_fitting_mode",
"==",
"'point2plane'",
":",
"raise",
"ValueError",
"(",
"'point2plane fitting mode not implemented yet.'",
")",
"else",
":",
"raise",
"ValueError",
"(",
"'Unknown fitting mode: '",
"+",
"self",
".",
"deform_fitting_mode",
")",
"# Combined loss",
"return",
"self",
".",
"output_loss",
"+",
"self",
".",
"reg_loss"
] | [
344,
4
] | [
374,
47
] | python | en | ['en', 'error', 'th'] | False |
KPFCNN.accuracy | (self, outputs, labels) |
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
|
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
| def accuracy(self, outputs, labels):
"""
Computes accuracy of the current batch
:param outputs: logits predicted by the network
:param labels: labels
:return: accuracy value
"""
# Set all ignored labels to -1 and correct the other label to be in [0, C-1] range
target = - torch.ones_like(labels)
for i, c in enumerate(self.valid_labels):
target[labels == c] = i
predicted = torch.argmax(outputs.data, dim=1)
total = target.size(0)
correct = (predicted == target).sum().item()
return correct / total | [
"def",
"accuracy",
"(",
"self",
",",
"outputs",
",",
"labels",
")",
":",
"# Set all ignored labels to -1 and correct the other label to be in [0, C-1] range",
"target",
"=",
"-",
"torch",
".",
"ones_like",
"(",
"labels",
")",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"self",
".",
"valid_labels",
")",
":",
"target",
"[",
"labels",
"==",
"c",
"]",
"=",
"i",
"predicted",
"=",
"torch",
".",
"argmax",
"(",
"outputs",
".",
"data",
",",
"dim",
"=",
"1",
")",
"total",
"=",
"target",
".",
"size",
"(",
"0",
")",
"correct",
"=",
"(",
"predicted",
"==",
"target",
")",
".",
"sum",
"(",
")",
".",
"item",
"(",
")",
"return",
"correct",
"/",
"total"
] | [
376,
4
] | [
393,
30
] | python | en | ['en', 'error', 'th'] | False |
obfuscate_language | (text, level=0.0, language="default") |
Main access method for the language parser.
Args:
text (str): Text to obfuscate.
level (real, optional): A value from 0.0-1.0 determining
the level of obfuscation where 0 means no jobfuscation
(string returned unchanged) and 1.0 means the entire
string is obfuscated.
language (str, optional): The identifier of a language
the system understands.
Returns:
translated (str): The translated text.
|
Main access method for the language parser. | def obfuscate_language(text, level=0.0, language="default"):
"""
Main access method for the language parser.
Args:
text (str): Text to obfuscate.
level (real, optional): A value from 0.0-1.0 determining
the level of obfuscation where 0 means no jobfuscation
(string returned unchanged) and 1.0 means the entire
string is obfuscated.
language (str, optional): The identifier of a language
the system understands.
Returns:
translated (str): The translated text.
"""
# initialize the language handler and cache it
global _LANGUAGE_HANDLER
if not _LANGUAGE_HANDLER:
try:
_LANGUAGE_HANDLER = LanguageHandler.objects.get(db_key="language_handler")
except LanguageHandler.DoesNotExist:
if not _LANGUAGE_HANDLER:
from evennia import create_script
_LANGUAGE_HANDLER = create_script(LanguageHandler)
return _LANGUAGE_HANDLER.translate(text, level=level, language=language) | [
"def",
"obfuscate_language",
"(",
"text",
",",
"level",
"=",
"0.0",
",",
"language",
"=",
"\"default\"",
")",
":",
"# initialize the language handler and cache it",
"global",
"_LANGUAGE_HANDLER",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"try",
":",
"_LANGUAGE_HANDLER",
"=",
"LanguageHandler",
".",
"objects",
".",
"get",
"(",
"db_key",
"=",
"\"language_handler\"",
")",
"except",
"LanguageHandler",
".",
"DoesNotExist",
":",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"from",
"evennia",
"import",
"create_script",
"_LANGUAGE_HANDLER",
"=",
"create_script",
"(",
"LanguageHandler",
")",
"return",
"_LANGUAGE_HANDLER",
".",
"translate",
"(",
"text",
",",
"level",
"=",
"level",
",",
"language",
"=",
"language",
")"
] | [
406,
0
] | [
432,
76
] | python | en | ['en', 'error', 'th'] | False |
add_language | (**kwargs) |
Access function to creating a new language. See the docstring of
`LanguageHandler.add` for list of keyword arguments.
|
Access function to creating a new language. See the docstring of
`LanguageHandler.add` for list of keyword arguments. | def add_language(**kwargs):
"""
Access function to creating a new language. See the docstring of
`LanguageHandler.add` for list of keyword arguments.
"""
global _LANGUAGE_HANDLER
if not _LANGUAGE_HANDLER:
try:
_LANGUAGE_HANDLER = LanguageHandler.objects.get(db_key="language_handler")
except LanguageHandler.DoesNotExist:
if not _LANGUAGE_HANDLER:
from evennia import create_script
_LANGUAGE_HANDLER = create_script(LanguageHandler)
_LANGUAGE_HANDLER.add(**kwargs) | [
"def",
"add_language",
"(",
"*",
"*",
"kwargs",
")",
":",
"global",
"_LANGUAGE_HANDLER",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"try",
":",
"_LANGUAGE_HANDLER",
"=",
"LanguageHandler",
".",
"objects",
".",
"get",
"(",
"db_key",
"=",
"\"language_handler\"",
")",
"except",
"LanguageHandler",
".",
"DoesNotExist",
":",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"from",
"evennia",
"import",
"create_script",
"_LANGUAGE_HANDLER",
"=",
"create_script",
"(",
"LanguageHandler",
")",
"_LANGUAGE_HANDLER",
".",
"add",
"(",
"*",
"*",
"kwargs",
")"
] | [
435,
0
] | [
449,
35
] | python | en | ['en', 'error', 'th'] | False |
available_languages | () |
Returns all available language keys.
Returns:
languages (list): List of key strings of all available
languages.
|
Returns all available language keys. | def available_languages():
"""
Returns all available language keys.
Returns:
languages (list): List of key strings of all available
languages.
"""
global _LANGUAGE_HANDLER
if not _LANGUAGE_HANDLER:
try:
_LANGUAGE_HANDLER = LanguageHandler.objects.get(db_key="language_handler")
except LanguageHandler.DoesNotExist:
if not _LANGUAGE_HANDLER:
from evennia import create_script
_LANGUAGE_HANDLER = create_script(LanguageHandler)
return list(_LANGUAGE_HANDLER.attributes.get("language_storage", {})) | [
"def",
"available_languages",
"(",
")",
":",
"global",
"_LANGUAGE_HANDLER",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"try",
":",
"_LANGUAGE_HANDLER",
"=",
"LanguageHandler",
".",
"objects",
".",
"get",
"(",
"db_key",
"=",
"\"language_handler\"",
")",
"except",
"LanguageHandler",
".",
"DoesNotExist",
":",
"if",
"not",
"_LANGUAGE_HANDLER",
":",
"from",
"evennia",
"import",
"create_script",
"_LANGUAGE_HANDLER",
"=",
"create_script",
"(",
"LanguageHandler",
")",
"return",
"list",
"(",
"_LANGUAGE_HANDLER",
".",
"attributes",
".",
"get",
"(",
"\"language_storage\"",
",",
"{",
"}",
")",
")"
] | [
452,
0
] | [
468,
73
] | python | en | ['en', 'error', 'th'] | False |
obfuscate_whisper | (whisper, level=0.0) |
Obfuscate whisper depending on a pre-calculated level
(that may depend on distance, listening skill etc)
Args:
whisper (str): The whisper string to obscure. The
entire string will be considered in the obscuration.
level (real, optional): This is a value 0-1, where 0
means not obscured (whisper returned unchanged) and 1
means fully obscured.
|
Obfuscate whisper depending on a pre-calculated level
(that may depend on distance, listening skill etc) | def obfuscate_whisper(whisper, level=0.0):
"""
Obfuscate whisper depending on a pre-calculated level
(that may depend on distance, listening skill etc)
Args:
whisper (str): The whisper string to obscure. The
entire string will be considered in the obscuration.
level (real, optional): This is a value 0-1, where 0
means not obscured (whisper returned unchanged) and 1
means fully obscured.
"""
level = min(max(0.0, level), 1.0)
olevel = int(13.0 * level)
return _RE_WHISPER_OBSCURE[olevel].sub('...' if olevel == 13.0 else '-', whisper) | [
"def",
"obfuscate_whisper",
"(",
"whisper",
",",
"level",
"=",
"0.0",
")",
":",
"level",
"=",
"min",
"(",
"max",
"(",
"0.0",
",",
"level",
")",
",",
"1.0",
")",
"olevel",
"=",
"int",
"(",
"13.0",
"*",
"level",
")",
"return",
"_RE_WHISPER_OBSCURE",
"[",
"olevel",
"]",
".",
"sub",
"(",
"'...'",
"if",
"olevel",
"==",
"13.0",
"else",
"'-'",
",",
"whisper",
")"
] | [
503,
0
] | [
518,
85
] | python | en | ['en', 'error', 'th'] | False |
LanguageHandler.at_script_creation | (self) | Called when script is first started | Called when script is first started | def at_script_creation(self):
"Called when script is first started"
self.key = "language_handler"
self.persistent = True
self.db.language_storage = {} | [
"def",
"at_script_creation",
"(",
"self",
")",
":",
"self",
".",
"key",
"=",
"\"language_handler\"",
"self",
".",
"persistent",
"=",
"True",
"self",
".",
"db",
".",
"language_storage",
"=",
"{",
"}"
] | [
157,
4
] | [
161,
37
] | python | en | ['en', 'en', 'en'] | True |
LanguageHandler.add | (self, key="default", phonemes=_PHONEMES,
grammar=_GRAMMAR, word_length_variance=0,
noun_translate=False,
noun_prefix="",
noun_postfix="",
vowels=_VOWELS, manual_translations=None,
auto_translations=None, force=False) |
Add a new language. Note that you generally only need to do
this once per language and that adding an existing language
will re-initialize all the random components to new permanent
values.
Args:
key (str, optional): The name of the language. This
will be used as an identifier for the language so it
should be short and unique.
phonemes (str, optional): Space-separated string of all allowed
phonemes in this language. If either of the base phonemes
(c, v, cc, vv) are present in the grammar, the phoneme list must
at least include one example of each.
grammar (str): All allowed consonant (c) and vowel (v) combinations
allowed to build up words. Grammars are broken into the base phonemes
(c, v, cc, vv) prioritizing the longer bases. So cvv would be a
the c + vv (would allow for a word like 'die' whereas
cvcvccc would be c+v+c+v+cc+c (a word like 'galosch').
word_length_variance (real): The variation of length of words.
0 means a minimal variance, higher variance may mean words
have wildly varying length; this strongly affects how the
language "looks".
noun_translate (bool, optional): If a proper noun, identified as a
capitalized word, should be translated or not. By default they
will not, allowing for e.g. the names of characters to be understandable.
noun_prefix (str, optional): A prefix to go before every noun
in this language (if any).
noun_postfix (str, optuonal): A postfix to go after every noun
in this language (if any, usually best to avoid combining
with `noun_prefix` or language becomes very wordy).
vowels (str, optional): Every vowel allowed in this language.
manual_translations (dict, optional): This allows for custom-setting
certain words in the language to mean the same thing. It is
on the form `{real_word: fictional_word}`, for example
`{"the", "y'e"}` .
auto_translations (str or list, optional): These are lists
words that should be auto-translated with a random, but
fixed, translation. If a path to a file, this file should
contain a list of words to produce translations for, one
word per line. If a list, the list's elements should be
the words to translate. The `manual_translations` will
always override overlapping translations created
automatically.
force (bool, optional): Unless true, will not allow the addition
of a language that is already created.
Raises:
LanguageExistsError: Raised if trying to adding a language
with a key that already exists, without `force` being set.
Notes:
The `word_file` is for example a word-frequency list for
the N most common words in the host language. The
translations will be random, but will be stored
persistently to always be the same. This allows for
building a quick, decently-sounding fictive language that
tend to produce the same "translation" (mostly) with the
same input sentence.
|
Add a new language. Note that you generally only need to do
this once per language and that adding an existing language
will re-initialize all the random components to new permanent
values. | def add(self, key="default", phonemes=_PHONEMES,
grammar=_GRAMMAR, word_length_variance=0,
noun_translate=False,
noun_prefix="",
noun_postfix="",
vowels=_VOWELS, manual_translations=None,
auto_translations=None, force=False):
"""
Add a new language. Note that you generally only need to do
this once per language and that adding an existing language
will re-initialize all the random components to new permanent
values.
Args:
key (str, optional): The name of the language. This
will be used as an identifier for the language so it
should be short and unique.
phonemes (str, optional): Space-separated string of all allowed
phonemes in this language. If either of the base phonemes
(c, v, cc, vv) are present in the grammar, the phoneme list must
at least include one example of each.
grammar (str): All allowed consonant (c) and vowel (v) combinations
allowed to build up words. Grammars are broken into the base phonemes
(c, v, cc, vv) prioritizing the longer bases. So cvv would be a
the c + vv (would allow for a word like 'die' whereas
cvcvccc would be c+v+c+v+cc+c (a word like 'galosch').
word_length_variance (real): The variation of length of words.
0 means a minimal variance, higher variance may mean words
have wildly varying length; this strongly affects how the
language "looks".
noun_translate (bool, optional): If a proper noun, identified as a
capitalized word, should be translated or not. By default they
will not, allowing for e.g. the names of characters to be understandable.
noun_prefix (str, optional): A prefix to go before every noun
in this language (if any).
noun_postfix (str, optuonal): A postfix to go after every noun
in this language (if any, usually best to avoid combining
with `noun_prefix` or language becomes very wordy).
vowels (str, optional): Every vowel allowed in this language.
manual_translations (dict, optional): This allows for custom-setting
certain words in the language to mean the same thing. It is
on the form `{real_word: fictional_word}`, for example
`{"the", "y'e"}` .
auto_translations (str or list, optional): These are lists
words that should be auto-translated with a random, but
fixed, translation. If a path to a file, this file should
contain a list of words to produce translations for, one
word per line. If a list, the list's elements should be
the words to translate. The `manual_translations` will
always override overlapping translations created
automatically.
force (bool, optional): Unless true, will not allow the addition
of a language that is already created.
Raises:
LanguageExistsError: Raised if trying to adding a language
with a key that already exists, without `force` being set.
Notes:
The `word_file` is for example a word-frequency list for
the N most common words in the host language. The
translations will be random, but will be stored
persistently to always be the same. This allows for
building a quick, decently-sounding fictive language that
tend to produce the same "translation" (mostly) with the
same input sentence.
"""
if key in self.db.language_storage and not force:
raise LanguageExistsError(
"Language is already created. Re-adding it will re-build"
" its dictionary map. Use 'force=True' keyword if you are sure.")
# create grammar_component->phoneme mapping
# {"vv": ["ea", "oh", ...], ...}
grammar2phonemes = defaultdict(list)
for phoneme in phonemes.split():
if re.search("\W", phoneme):
raise LanguageError("The phoneme '%s' contains an invalid character" % phoneme)
gram = "".join(["v" if char in vowels else "c" for char in phoneme])
grammar2phonemes[gram].append(phoneme)
# allowed grammar are grouped by length
gramdict = defaultdict(list)
for gram in grammar.split():
if re.search("\W|(!=[cv])", gram):
raise LanguageError("The grammar '%s' is invalid (only 'c' and 'v' are allowed)" % gram)
gramdict[len(gram)].append(gram)
grammar = dict(gramdict)
# create automatic translation
translation = {}
if auto_translations:
if isinstance(auto_translations, basestring):
# path to a file rather than a list
with open(auto_translations, 'r') as f:
auto_translations = f.readlines()
for word in auto_translations:
word = word.strip()
lword = len(word)
new_word = ""
wlen = max(0, lword + sum(randint(-1, 1) for i
in range(word_length_variance)))
if wlen not in grammar:
# always create a translation, use random length
structure = choice(grammar[choice(list(grammar))])
else:
# use the corresponding length
structure = choice(grammar[wlen])
for match in _RE_GRAMMAR.finditer(structure):
new_word += choice(grammar2phonemes[match.group()])
translation[word.lower()] = new_word.lower()
if manual_translations:
# update with manual translations
translation.update(dict((key.lower(), value.lower()) for key, value in manual_translations.items()))
# store data
storage = {"translation": translation,
"grammar": grammar,
"grammar2phonemes": dict(grammar2phonemes),
"word_length_variance": word_length_variance,
"noun_translate": noun_translate,
"noun_prefix": noun_prefix,
"noun_postfix": noun_postfix}
self.db.language_storage[key] = storage | [
"def",
"add",
"(",
"self",
",",
"key",
"=",
"\"default\"",
",",
"phonemes",
"=",
"_PHONEMES",
",",
"grammar",
"=",
"_GRAMMAR",
",",
"word_length_variance",
"=",
"0",
",",
"noun_translate",
"=",
"False",
",",
"noun_prefix",
"=",
"\"\"",
",",
"noun_postfix",
"=",
"\"\"",
",",
"vowels",
"=",
"_VOWELS",
",",
"manual_translations",
"=",
"None",
",",
"auto_translations",
"=",
"None",
",",
"force",
"=",
"False",
")",
":",
"if",
"key",
"in",
"self",
".",
"db",
".",
"language_storage",
"and",
"not",
"force",
":",
"raise",
"LanguageExistsError",
"(",
"\"Language is already created. Re-adding it will re-build\"",
"\" its dictionary map. Use 'force=True' keyword if you are sure.\"",
")",
"# create grammar_component->phoneme mapping",
"# {\"vv\": [\"ea\", \"oh\", ...], ...}",
"grammar2phonemes",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"phoneme",
"in",
"phonemes",
".",
"split",
"(",
")",
":",
"if",
"re",
".",
"search",
"(",
"\"\\W\"",
",",
"phoneme",
")",
":",
"raise",
"LanguageError",
"(",
"\"The phoneme '%s' contains an invalid character\"",
"%",
"phoneme",
")",
"gram",
"=",
"\"\"",
".",
"join",
"(",
"[",
"\"v\"",
"if",
"char",
"in",
"vowels",
"else",
"\"c\"",
"for",
"char",
"in",
"phoneme",
"]",
")",
"grammar2phonemes",
"[",
"gram",
"]",
".",
"append",
"(",
"phoneme",
")",
"# allowed grammar are grouped by length",
"gramdict",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"gram",
"in",
"grammar",
".",
"split",
"(",
")",
":",
"if",
"re",
".",
"search",
"(",
"\"\\W|(!=[cv])\"",
",",
"gram",
")",
":",
"raise",
"LanguageError",
"(",
"\"The grammar '%s' is invalid (only 'c' and 'v' are allowed)\"",
"%",
"gram",
")",
"gramdict",
"[",
"len",
"(",
"gram",
")",
"]",
".",
"append",
"(",
"gram",
")",
"grammar",
"=",
"dict",
"(",
"gramdict",
")",
"# create automatic translation",
"translation",
"=",
"{",
"}",
"if",
"auto_translations",
":",
"if",
"isinstance",
"(",
"auto_translations",
",",
"basestring",
")",
":",
"# path to a file rather than a list",
"with",
"open",
"(",
"auto_translations",
",",
"'r'",
")",
"as",
"f",
":",
"auto_translations",
"=",
"f",
".",
"readlines",
"(",
")",
"for",
"word",
"in",
"auto_translations",
":",
"word",
"=",
"word",
".",
"strip",
"(",
")",
"lword",
"=",
"len",
"(",
"word",
")",
"new_word",
"=",
"\"\"",
"wlen",
"=",
"max",
"(",
"0",
",",
"lword",
"+",
"sum",
"(",
"randint",
"(",
"-",
"1",
",",
"1",
")",
"for",
"i",
"in",
"range",
"(",
"word_length_variance",
")",
")",
")",
"if",
"wlen",
"not",
"in",
"grammar",
":",
"# always create a translation, use random length",
"structure",
"=",
"choice",
"(",
"grammar",
"[",
"choice",
"(",
"list",
"(",
"grammar",
")",
")",
"]",
")",
"else",
":",
"# use the corresponding length",
"structure",
"=",
"choice",
"(",
"grammar",
"[",
"wlen",
"]",
")",
"for",
"match",
"in",
"_RE_GRAMMAR",
".",
"finditer",
"(",
"structure",
")",
":",
"new_word",
"+=",
"choice",
"(",
"grammar2phonemes",
"[",
"match",
".",
"group",
"(",
")",
"]",
")",
"translation",
"[",
"word",
".",
"lower",
"(",
")",
"]",
"=",
"new_word",
".",
"lower",
"(",
")",
"if",
"manual_translations",
":",
"# update with manual translations",
"translation",
".",
"update",
"(",
"dict",
"(",
"(",
"key",
".",
"lower",
"(",
")",
",",
"value",
".",
"lower",
"(",
")",
")",
"for",
"key",
",",
"value",
"in",
"manual_translations",
".",
"items",
"(",
")",
")",
")",
"# store data",
"storage",
"=",
"{",
"\"translation\"",
":",
"translation",
",",
"\"grammar\"",
":",
"grammar",
",",
"\"grammar2phonemes\"",
":",
"dict",
"(",
"grammar2phonemes",
")",
",",
"\"word_length_variance\"",
":",
"word_length_variance",
",",
"\"noun_translate\"",
":",
"noun_translate",
",",
"\"noun_prefix\"",
":",
"noun_prefix",
",",
"\"noun_postfix\"",
":",
"noun_postfix",
"}",
"self",
".",
"db",
".",
"language_storage",
"[",
"key",
"]",
"=",
"storage"
] | [
163,
4
] | [
289,
47
] | python | en | ['en', 'error', 'th'] | False |
LanguageHandler._translate_sub | (self, match) |
Replacer method called by re.sub when
traversing the language string.
Args:
match (re.matchobj): Match object from regex.
Returns:
converted word.
Notes:
Assumes self.lastword and self.level is available
on the object.
|
Replacer method called by re.sub when
traversing the language string. | def _translate_sub(self, match):
"""
Replacer method called by re.sub when
traversing the language string.
Args:
match (re.matchobj): Match object from regex.
Returns:
converted word.
Notes:
Assumes self.lastword and self.level is available
on the object.
"""
word = match.group()
lword = len(word)
if len(word) <= self.level:
# below level. Don't translate
new_word = word
else:
# try to translate the word from dictionary
new_word = self.language["translation"].get(word.lower(), "")
if not new_word:
# no dictionary translation. Generate one
# find out what preceeded this word
wpos = match.start()
preceeding = match.string[:wpos].strip()
start_sentence = preceeding.endswith(".") or not preceeding
# make up translation on the fly. Length can
# vary from un-translated word.
wlen = max(0, lword + sum(randint(-1, 1) for i
in range(self.language["word_length_variance"])))
grammar = self.language["grammar"]
if wlen not in grammar:
if randint(0, 1) == 0:
# this word has no direct translation!
wlen = 0
new_word = ''
else:
# use random word length
wlen = choice(grammar.keys())
if wlen:
structure = choice(grammar[wlen])
grammar2phonemes = self.language["grammar2phonemes"]
for match in _RE_GRAMMAR.finditer(structure):
# there are only four combinations: vv,cc,c,v
try:
new_word += choice(grammar2phonemes[match.group()])
except KeyError:
logger.log_trace("You need to supply at least one example of each of "
"the four base phonemes (c, v, cc, vv)")
# abort translation here
new_word = ''
break
if word.istitle():
title_word = ''
if not start_sentence and not self.language.get("noun_translate", False):
# don't translate what we identify as proper nouns (names)
title_word = word
elif new_word:
title_word = new_word
if title_word:
# Regardless of if we translate or not, we will add the custom prefix/postfixes
new_word = "%s%s%s" % (self.language["noun_prefix"],
title_word.capitalize(),
self.language["noun_postfix"])
if len(word) > 1 and word.isupper():
# keep LOUD words loud also when translated
new_word = new_word.upper()
return new_word | [
"def",
"_translate_sub",
"(",
"self",
",",
"match",
")",
":",
"word",
"=",
"match",
".",
"group",
"(",
")",
"lword",
"=",
"len",
"(",
"word",
")",
"if",
"len",
"(",
"word",
")",
"<=",
"self",
".",
"level",
":",
"# below level. Don't translate",
"new_word",
"=",
"word",
"else",
":",
"# try to translate the word from dictionary",
"new_word",
"=",
"self",
".",
"language",
"[",
"\"translation\"",
"]",
".",
"get",
"(",
"word",
".",
"lower",
"(",
")",
",",
"\"\"",
")",
"if",
"not",
"new_word",
":",
"# no dictionary translation. Generate one",
"# find out what preceeded this word",
"wpos",
"=",
"match",
".",
"start",
"(",
")",
"preceeding",
"=",
"match",
".",
"string",
"[",
":",
"wpos",
"]",
".",
"strip",
"(",
")",
"start_sentence",
"=",
"preceeding",
".",
"endswith",
"(",
"\".\"",
")",
"or",
"not",
"preceeding",
"# make up translation on the fly. Length can",
"# vary from un-translated word.",
"wlen",
"=",
"max",
"(",
"0",
",",
"lword",
"+",
"sum",
"(",
"randint",
"(",
"-",
"1",
",",
"1",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"language",
"[",
"\"word_length_variance\"",
"]",
")",
")",
")",
"grammar",
"=",
"self",
".",
"language",
"[",
"\"grammar\"",
"]",
"if",
"wlen",
"not",
"in",
"grammar",
":",
"if",
"randint",
"(",
"0",
",",
"1",
")",
"==",
"0",
":",
"# this word has no direct translation!",
"wlen",
"=",
"0",
"new_word",
"=",
"''",
"else",
":",
"# use random word length",
"wlen",
"=",
"choice",
"(",
"grammar",
".",
"keys",
"(",
")",
")",
"if",
"wlen",
":",
"structure",
"=",
"choice",
"(",
"grammar",
"[",
"wlen",
"]",
")",
"grammar2phonemes",
"=",
"self",
".",
"language",
"[",
"\"grammar2phonemes\"",
"]",
"for",
"match",
"in",
"_RE_GRAMMAR",
".",
"finditer",
"(",
"structure",
")",
":",
"# there are only four combinations: vv,cc,c,v",
"try",
":",
"new_word",
"+=",
"choice",
"(",
"grammar2phonemes",
"[",
"match",
".",
"group",
"(",
")",
"]",
")",
"except",
"KeyError",
":",
"logger",
".",
"log_trace",
"(",
"\"You need to supply at least one example of each of \"",
"\"the four base phonemes (c, v, cc, vv)\"",
")",
"# abort translation here",
"new_word",
"=",
"''",
"break",
"if",
"word",
".",
"istitle",
"(",
")",
":",
"title_word",
"=",
"''",
"if",
"not",
"start_sentence",
"and",
"not",
"self",
".",
"language",
".",
"get",
"(",
"\"noun_translate\"",
",",
"False",
")",
":",
"# don't translate what we identify as proper nouns (names)",
"title_word",
"=",
"word",
"elif",
"new_word",
":",
"title_word",
"=",
"new_word",
"if",
"title_word",
":",
"# Regardless of if we translate or not, we will add the custom prefix/postfixes",
"new_word",
"=",
"\"%s%s%s\"",
"%",
"(",
"self",
".",
"language",
"[",
"\"noun_prefix\"",
"]",
",",
"title_word",
".",
"capitalize",
"(",
")",
",",
"self",
".",
"language",
"[",
"\"noun_postfix\"",
"]",
")",
"if",
"len",
"(",
"word",
")",
">",
"1",
"and",
"word",
".",
"isupper",
"(",
")",
":",
"# keep LOUD words loud also when translated",
"new_word",
"=",
"new_word",
".",
"upper",
"(",
")",
"return",
"new_word"
] | [
291,
4
] | [
368,
23
] | python | en | ['en', 'error', 'th'] | False |
LanguageHandler.translate | (self, text, level=0.0, language="default") |
Translate the text according to the given level.
Args:
text (str): The text to translate
level (real): Value between 0.0 and 1.0, where
0.0 means no obfuscation (text returned unchanged) and
1.0 means full conversion of every word. The closer to
1, the shorter words will be translated.
language (str): The language key identifier.
Returns:
text (str): A translated string.
|
Translate the text according to the given level. | def translate(self, text, level=0.0, language="default"):
"""
Translate the text according to the given level.
Args:
text (str): The text to translate
level (real): Value between 0.0 and 1.0, where
0.0 means no obfuscation (text returned unchanged) and
1.0 means full conversion of every word. The closer to
1, the shorter words will be translated.
language (str): The language key identifier.
Returns:
text (str): A translated string.
"""
if level == 0.0:
# no translation
return text
language = self.db.language_storage.get(language, None)
if not language:
return text
self.language = language
# configuring the translation
self.level = int(10 * (1.0 - max(0, min(level, 1.0))))
translation = _RE_WORD.sub(self._translate_sub, text)
# the substitution may create too long empty spaces, remove those
return _RE_EXTRA_CHARS.sub("", translation) | [
"def",
"translate",
"(",
"self",
",",
"text",
",",
"level",
"=",
"0.0",
",",
"language",
"=",
"\"default\"",
")",
":",
"if",
"level",
"==",
"0.0",
":",
"# no translation",
"return",
"text",
"language",
"=",
"self",
".",
"db",
".",
"language_storage",
".",
"get",
"(",
"language",
",",
"None",
")",
"if",
"not",
"language",
":",
"return",
"text",
"self",
".",
"language",
"=",
"language",
"# configuring the translation",
"self",
".",
"level",
"=",
"int",
"(",
"10",
"*",
"(",
"1.0",
"-",
"max",
"(",
"0",
",",
"min",
"(",
"level",
",",
"1.0",
")",
")",
")",
")",
"translation",
"=",
"_RE_WORD",
".",
"sub",
"(",
"self",
".",
"_translate_sub",
",",
"text",
")",
"# the substitution may create too long empty spaces, remove those",
"return",
"_RE_EXTRA_CHARS",
".",
"sub",
"(",
"\"\"",
",",
"translation",
")"
] | [
370,
4
] | [
398,
51
] | python | en | ['en', 'error', 'th'] | False |
buffer_carbohydrates_amount | (crop_states: CropStates, climate_states: ClimateStates) |
Equation 9.1
carbohydrate_amount_Buf = carbohydrate_flow_AirBuf − carbohydrate_flow_BufFruit
− carbohydrate_flow_BufLeaf − carbohydrate_flow_BufStem − carbohydrate_flow_BufAir
Returns: The evolution of the carbohydrates in the buffer [mg m^-2 s^-1]
|
Equation 9.1
carbohydrate_amount_Buf = carbohydrate_flow_AirBuf − carbohydrate_flow_BufFruit
− carbohydrate_flow_BufLeaf − carbohydrate_flow_BufStem − carbohydrate_flow_BufAir
Returns: The evolution of the carbohydrates in the buffer [mg m^-2 s^-1]
| def buffer_carbohydrates_amount(crop_states: CropStates, climate_states: ClimateStates):
"""
Equation 9.1
carbohydrate_amount_Buf = carbohydrate_flow_AirBuf − carbohydrate_flow_BufFruit
− carbohydrate_flow_BufLeaf − carbohydrate_flow_BufStem − carbohydrate_flow_BufAir
Returns: The evolution of the carbohydrates in the buffer [mg m^-2 s^-1]
"""
carbohydrate_flow_AirBuf = net_photosynthesis_rate(crop_states.carbohydrate_amount_Buf,
crop_states.carbohydrate_amount_Leaf, climate_states.co2_Air,
climate_states.t_Canopy,
climate_states.PAR_Canopy)
carbohydrate_flow_BufFruit = carbohydrate_flow_from_buffer_to_fruits(crop_states.carbohydrate_amount_Buf,
climate_states.t_Canopy,
crop_states.sum_canopy_t,
crop_states.last_24_canopy_t)
carbohydrate_flow_BufLeaf = carbohydrate_flow_from_buffer_to_leaves(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
carbohydrate_flow_BufStem = carbohydrate_flow_from_buffer_to_stem(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
carbohydrate_flow_BufAir = carbohydrate_flow_from_growth_respiration(crop_states.carbohydrate_amount_Buf,
climate_states.t_Canopy,
crop_states.sum_canopy_t,
crop_states.last_24_canopy_t)
return carbohydrate_flow_AirBuf - carbohydrate_flow_BufFruit \
- carbohydrate_flow_BufLeaf - carbohydrate_flow_BufStem - carbohydrate_flow_BufAir | [
"def",
"buffer_carbohydrates_amount",
"(",
"crop_states",
":",
"CropStates",
",",
"climate_states",
":",
"ClimateStates",
")",
":",
"carbohydrate_flow_AirBuf",
"=",
"net_photosynthesis_rate",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"carbohydrate_amount_Leaf",
",",
"climate_states",
".",
"co2_Air",
",",
"climate_states",
".",
"t_Canopy",
",",
"climate_states",
".",
"PAR_Canopy",
")",
"carbohydrate_flow_BufFruit",
"=",
"carbohydrate_flow_from_buffer_to_fruits",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"climate_states",
".",
"t_Canopy",
",",
"crop_states",
".",
"sum_canopy_t",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_BufLeaf",
"=",
"carbohydrate_flow_from_buffer_to_leaves",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_BufStem",
"=",
"carbohydrate_flow_from_buffer_to_stem",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_BufAir",
"=",
"carbohydrate_flow_from_growth_respiration",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"climate_states",
".",
"t_Canopy",
",",
"crop_states",
".",
"sum_canopy_t",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"return",
"carbohydrate_flow_AirBuf",
"-",
"carbohydrate_flow_BufFruit",
"-",
"carbohydrate_flow_BufLeaf",
"-",
"carbohydrate_flow_BufStem",
"-",
"carbohydrate_flow_BufAir"
] | [
6,
0
] | [
30,
93
] | python | en | ['en', 'error', 'th'] | False |
fruit_development_stored_carbohydrates_amount | (jth: int, crop_inputs: CropStates, climate_inputs: ClimateStates) |
Equation 9.2
carbohydrate_amount_Fruit_j = carbohydrate_flow_BufFruit_j + carbohydrate_flow_Fruit_jminus_Fruit_j
− carbohydrate_flow_Fruit_j_jplus - carbohydrate_flow_FruitAir_j
Returns: Carbohydrates are stored in the fruit development stage j [mg m^-2 s^-1]
|
Equation 9.2
carbohydrate_amount_Fruit_j = carbohydrate_flow_BufFruit_j + carbohydrate_flow_Fruit_jminus_Fruit_j
− carbohydrate_flow_Fruit_j_jplus - carbohydrate_flow_FruitAir_j
Returns: Carbohydrates are stored in the fruit development stage j [mg m^-2 s^-1]
| def fruit_development_stored_carbohydrates_amount(jth: int, crop_inputs: CropStates, climate_inputs: ClimateStates):
"""
Equation 9.2
carbohydrate_amount_Fruit_j = carbohydrate_flow_BufFruit_j + carbohydrate_flow_Fruit_jminus_Fruit_j
− carbohydrate_flow_Fruit_j_jplus - carbohydrate_flow_FruitAir_j
Returns: Carbohydrates are stored in the fruit development stage j [mg m^-2 s^-1]
"""
carbohydrate_flow_BufFruit_j = carbohydrate_flow_from_buffer_to_fruit_stages(jth,
crop_inputs.carbohydrate_amount_Buf,
crop_inputs.number_Fruits,
climate_inputs.t_Canopy,
crop_inputs.sum_canopy_t,
crop_inputs.last_24_canopy_t)
carbohydrate_flow_Fruit_jminus_Fruit_j = carbohydrate_flow_through_fruit_stages(jth - 1,
crop_inputs.carbohydrate_amount_Fruits,
crop_inputs.last_24_canopy_t)
carbohydrate_flow_Fruit_j_Fruit_jplus = carbohydrate_flow_through_fruit_stages(jth,
crop_inputs.carbohydrate_amount_Fruits,
crop_inputs.last_24_canopy_t)
carbohydrate_flow_FruitAir_j = carbohydrate_flow_from_fruit_maintenance_respiration(
crop_inputs.carbohydrate_amount_Fruits[jth],
crop_inputs.last_24_canopy_t)
return carbohydrate_flow_BufFruit_j + carbohydrate_flow_Fruit_jminus_Fruit_j \
- carbohydrate_flow_Fruit_j_Fruit_jplus - carbohydrate_flow_FruitAir_j | [
"def",
"fruit_development_stored_carbohydrates_amount",
"(",
"jth",
":",
"int",
",",
"crop_inputs",
":",
"CropStates",
",",
"climate_inputs",
":",
"ClimateStates",
")",
":",
"carbohydrate_flow_BufFruit_j",
"=",
"carbohydrate_flow_from_buffer_to_fruit_stages",
"(",
"jth",
",",
"crop_inputs",
".",
"carbohydrate_amount_Buf",
",",
"crop_inputs",
".",
"number_Fruits",
",",
"climate_inputs",
".",
"t_Canopy",
",",
"crop_inputs",
".",
"sum_canopy_t",
",",
"crop_inputs",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_Fruit_jminus_Fruit_j",
"=",
"carbohydrate_flow_through_fruit_stages",
"(",
"jth",
"-",
"1",
",",
"crop_inputs",
".",
"carbohydrate_amount_Fruits",
",",
"crop_inputs",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_Fruit_j_Fruit_jplus",
"=",
"carbohydrate_flow_through_fruit_stages",
"(",
"jth",
",",
"crop_inputs",
".",
"carbohydrate_amount_Fruits",
",",
"crop_inputs",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_FruitAir_j",
"=",
"carbohydrate_flow_from_fruit_maintenance_respiration",
"(",
"crop_inputs",
".",
"carbohydrate_amount_Fruits",
"[",
"jth",
"]",
",",
"crop_inputs",
".",
"last_24_canopy_t",
")",
"return",
"carbohydrate_flow_BufFruit_j",
"+",
"carbohydrate_flow_Fruit_jminus_Fruit_j",
"-",
"carbohydrate_flow_Fruit_j_Fruit_jplus",
"-",
"carbohydrate_flow_FruitAir_j"
] | [
33,
0
] | [
56,
81
] | python | en | ['en', 'error', 'th'] | False |
number_of_fruits | (jth: int, crop_states: CropStates) |
Equation 9.3
number_Fruit_j = number_flow_Fruit_jminus_Fruit_j - number_flow_Fruit_j_Fruit_jplus
Returns: The number of fruits in the fruit development stage j [fruits m^-2 s^-1]
Args:
crop_states:
|
Equation 9.3
number_Fruit_j = number_flow_Fruit_jminus_Fruit_j - number_flow_Fruit_j_Fruit_jplus
Returns: The number of fruits in the fruit development stage j [fruits m^-2 s^-1] | def number_of_fruits(jth: int, crop_states: CropStates):
"""
Equation 9.3
number_Fruit_j = number_flow_Fruit_jminus_Fruit_j - number_flow_Fruit_j_Fruit_jplus
Returns: The number of fruits in the fruit development stage j [fruits m^-2 s^-1]
Args:
crop_states:
"""
number_flow_Fruit_jminus_Fruit_j = fruit_flow_through_fruit_development_stage(jth - 1, crop_states.number_Fruits,
crop_states.sum_canopy_t,
crop_states.last_24_canopy_t)
number_flow_Fruit_j_Fruit_jplus = fruit_flow_through_fruit_development_stage(jth, crop_states.number_Fruits,
crop_states.sum_canopy_t,
crop_states.last_24_canopy_t)
return number_flow_Fruit_jminus_Fruit_j - number_flow_Fruit_j_Fruit_jplus | [
"def",
"number_of_fruits",
"(",
"jth",
":",
"int",
",",
"crop_states",
":",
"CropStates",
")",
":",
"number_flow_Fruit_jminus_Fruit_j",
"=",
"fruit_flow_through_fruit_development_stage",
"(",
"jth",
"-",
"1",
",",
"crop_states",
".",
"number_Fruits",
",",
"crop_states",
".",
"sum_canopy_t",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"number_flow_Fruit_j_Fruit_jplus",
"=",
"fruit_flow_through_fruit_development_stage",
"(",
"jth",
",",
"crop_states",
".",
"number_Fruits",
",",
"crop_states",
".",
"sum_canopy_t",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"return",
"number_flow_Fruit_jminus_Fruit_j",
"-",
"number_flow_Fruit_j_Fruit_jplus"
] | [
59,
0
] | [
74,
77
] | python | en | ['en', 'error', 'th'] | False |
leaves_stored_carbohydrates_amount | (crop_states: CropStates) |
Equation 9.4
carbohydrate_amount_Leaf = carbohydrate_flow_BufLeaf - carbohydrate_flow_LeafAir - carbohydrate_flow_LeafHar
Returns: The carbohydrates stored in the leaves [mg m^-2 s^-1]
|
Equation 9.4
carbohydrate_amount_Leaf = carbohydrate_flow_BufLeaf - carbohydrate_flow_LeafAir - carbohydrate_flow_LeafHar
Returns: The carbohydrates stored in the leaves [mg m^-2 s^-1]
| def leaves_stored_carbohydrates_amount(crop_states: CropStates):
"""
Equation 9.4
carbohydrate_amount_Leaf = carbohydrate_flow_BufLeaf - carbohydrate_flow_LeafAir - carbohydrate_flow_LeafHar
Returns: The carbohydrates stored in the leaves [mg m^-2 s^-1]
"""
carbohydrate_flow_BufLeaf = carbohydrate_flow_from_buffer_to_leaves(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
carbohydrate_flow_LeafAir = carbohydrate_flow_from_leaf_maintenance_respiration(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
carbohydrate_flow_LeafHar = leaf_harvest_rate(crop_states.carbohydrate_amount_Leaf)
return carbohydrate_flow_BufLeaf - carbohydrate_flow_LeafAir - carbohydrate_flow_LeafHar | [
"def",
"leaves_stored_carbohydrates_amount",
"(",
"crop_states",
":",
"CropStates",
")",
":",
"carbohydrate_flow_BufLeaf",
"=",
"carbohydrate_flow_from_buffer_to_leaves",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_LeafAir",
"=",
"carbohydrate_flow_from_leaf_maintenance_respiration",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_LeafHar",
"=",
"leaf_harvest_rate",
"(",
"crop_states",
".",
"carbohydrate_amount_Leaf",
")",
"return",
"carbohydrate_flow_BufLeaf",
"-",
"carbohydrate_flow_LeafAir",
"-",
"carbohydrate_flow_LeafHar"
] | [
77,
0
] | [
88,
92
] | python | en | ['en', 'error', 'th'] | False |
stem_and_roots_stored_carbohydrates_amount | (crop_states: CropStates) |
Equation 9.6
carbohydrate_amount_Stem = carbohydrate_flow_BufStem - carbohydrate_flow_StemAir
Returns: The carbohydrates stored in the stem and roots [mg m^-2 s^-1]
|
Equation 9.6
carbohydrate_amount_Stem = carbohydrate_flow_BufStem - carbohydrate_flow_StemAir
Returns: The carbohydrates stored in the stem and roots [mg m^-2 s^-1]
| def stem_and_roots_stored_carbohydrates_amount(crop_states: CropStates):
"""
Equation 9.6
carbohydrate_amount_Stem = carbohydrate_flow_BufStem - carbohydrate_flow_StemAir
Returns: The carbohydrates stored in the stem and roots [mg m^-2 s^-1]
"""
carbohydrate_flow_BufStem = carbohydrate_flow_from_buffer_to_stem(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
carbohydrate_flow_StemAir = carbohydrate_flow_from_stem_maintenance_respiration(crop_states.carbohydrate_amount_Buf,
crop_states.last_24_canopy_t)
return carbohydrate_flow_BufStem - carbohydrate_flow_StemAir | [
"def",
"stem_and_roots_stored_carbohydrates_amount",
"(",
"crop_states",
":",
"CropStates",
")",
":",
"carbohydrate_flow_BufStem",
"=",
"carbohydrate_flow_from_buffer_to_stem",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"carbohydrate_flow_StemAir",
"=",
"carbohydrate_flow_from_stem_maintenance_respiration",
"(",
"crop_states",
".",
"carbohydrate_amount_Buf",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"return",
"carbohydrate_flow_BufStem",
"-",
"carbohydrate_flow_StemAir"
] | [
91,
0
] | [
101,
64
] | python | en | ['en', 'error', 'th'] | False |
accumulated_harvested_tomato_dry_matter | (crop_states: CropStates) |
Equation 9.7
dry_matter_Har = CARBOHYDRATE_TO_DRY_MATTER_CONVERSION * carbohydrate_flow_FruitHar
Returns: THe accumulated harvested tomato dry matter [mg {DM} m^-2 s^-1]
|
Equation 9.7
dry_matter_Har = CARBOHYDRATE_TO_DRY_MATTER_CONVERSION * carbohydrate_flow_FruitHar
Returns: THe accumulated harvested tomato dry matter [mg {DM} m^-2 s^-1]
| def accumulated_harvested_tomato_dry_matter(crop_states: CropStates):
"""
Equation 9.7
dry_matter_Har = CARBOHYDRATE_TO_DRY_MATTER_CONVERSION * carbohydrate_flow_FruitHar
Returns: THe accumulated harvested tomato dry matter [mg {DM} m^-2 s^-1]
"""
carbohydrate_flow_FruitHar = carbohydrate_flow_through_fruit_stages(FRUIT_DEVELOPMENT_STAGES_NUM,
crop_states.carbohydrate_amount_Fruits,
crop_states.last_24_canopy_t)
return CARBOHYDRATE_TO_DRY_MATTER_CONVERSION * carbohydrate_flow_FruitHar | [
"def",
"accumulated_harvested_tomato_dry_matter",
"(",
"crop_states",
":",
"CropStates",
")",
":",
"carbohydrate_flow_FruitHar",
"=",
"carbohydrate_flow_through_fruit_stages",
"(",
"FRUIT_DEVELOPMENT_STAGES_NUM",
",",
"crop_states",
".",
"carbohydrate_amount_Fruits",
",",
"crop_states",
".",
"last_24_canopy_t",
")",
"return",
"CARBOHYDRATE_TO_DRY_MATTER_CONVERSION",
"*",
"carbohydrate_flow_FruitHar"
] | [
104,
0
] | [
113,
77
] | python | en | ['en', 'error', 'th'] | False |
temperature_sum | (climate_states: ClimateStates) |
Equation 9.8
sum_canopy_t = t_Canopy/86400
Returns: The temperature sum [°C s^-1]
|
Equation 9.8
sum_canopy_t = t_Canopy/86400
Returns: The temperature sum [°C s^-1]
| def temperature_sum(climate_states: ClimateStates):
"""
Equation 9.8
sum_canopy_t = t_Canopy/86400
Returns: The temperature sum [°C s^-1]
"""
return climate_states.t_Canopy / 86400 | [
"def",
"temperature_sum",
"(",
"climate_states",
":",
"ClimateStates",
")",
":",
"return",
"climate_states",
".",
"t_Canopy",
"/",
"86400"
] | [
116,
0
] | [
122,
42
] | python | en | ['en', 'error', 'th'] | False |
_24_mean_temperature | (crop_states: CropStates, climate_states: ClimateStates) |
Equation 9.9
last_24_canopy_t = 1/DAY_MEAN_TEMP_TIME_CONSTANT * (PROCESS_GAIN * t_Canopy - last_24_canopy_t)
Returns: The 24 hour mean canopy temperature [°C s^-1]
|
Equation 9.9
last_24_canopy_t = 1/DAY_MEAN_TEMP_TIME_CONSTANT * (PROCESS_GAIN * t_Canopy - last_24_canopy_t)
Returns: The 24 hour mean canopy temperature [°C s^-1]
| def _24_mean_temperature(crop_states: CropStates, climate_states: ClimateStates):
"""
Equation 9.9
last_24_canopy_t = 1/DAY_MEAN_TEMP_TIME_CONSTANT * (PROCESS_GAIN * t_Canopy - last_24_canopy_t)
Returns: The 24 hour mean canopy temperature [°C s^-1]
"""
return 1 / DAY_MEAN_TEMP_TIME_CONSTANT * (PROCESS_GAIN * climate_states.t_Canopy - crop_states.last_24_canopy_t) | [
"def",
"_24_mean_temperature",
"(",
"crop_states",
":",
"CropStates",
",",
"climate_states",
":",
"ClimateStates",
")",
":",
"return",
"1",
"/",
"DAY_MEAN_TEMP_TIME_CONSTANT",
"*",
"(",
"PROCESS_GAIN",
"*",
"climate_states",
".",
"t_Canopy",
"-",
"crop_states",
".",
"last_24_canopy_t",
")"
] | [
125,
0
] | [
131,
116
] | python | en | ['en', 'error', 'th'] | False |
__init__ | (
self,
*,
signature_type: str = None,
signature: str = None,
sig_data: str = None,
signer: str = None,
) |
Initialize a FieldSignature instance.
Args:
signature_type: Type of signature
signature: The signature
sig_data: Signature data
signer: The verkey of the signer
|
Initialize a FieldSignature instance. | def __init__(
self,
*,
signature_type: str = None,
signature: str = None,
sig_data: str = None,
signer: str = None,
):
"""
Initialize a FieldSignature instance.
Args:
signature_type: Type of signature
signature: The signature
sig_data: Signature data
signer: The verkey of the signer
"""
self.signature_type = signature_type
self.signature = signature
self.sig_data = sig_data
self.signer = signer | [
"def",
"__init__",
"(",
"self",
",",
"*",
",",
"signature_type",
":",
"str",
"=",
"None",
",",
"signature",
":",
"str",
"=",
"None",
",",
"sig_data",
":",
"str",
"=",
"None",
",",
"signer",
":",
"str",
"=",
"None",
",",
")",
":",
"self",
".",
"signature_type",
"=",
"signature_type",
"self",
".",
"signature",
"=",
"signature",
"self",
".",
"sig_data",
"=",
"sig_data",
"self",
".",
"signer",
"=",
"signer"
] | [
28,
4
] | [
48,
28
] | python | en | ['en', 'error', 'th'] | False |
create | (
cls, value, signer: str, wallet: BaseWallet, timestamp=None
) |
Create a Signature.
Sign a field value and return a newly constructed `SignatureDecorator`
representing the resulting signature.
Args:
value: Value to sign
signer: Verkey of the signing party
wallet: The wallet to use for the signature
Returns:
The created `SignatureDecorator` object
|
Create a Signature. | async def create(
cls, value, signer: str, wallet: BaseWallet, timestamp=None
) -> "SignatureDecorator":
"""
Create a Signature.
Sign a field value and return a newly constructed `SignatureDecorator`
representing the resulting signature.
Args:
value: Value to sign
signer: Verkey of the signing party
wallet: The wallet to use for the signature
Returns:
The created `SignatureDecorator` object
"""
if not timestamp:
timestamp = time.time()
if isinstance(value, BaseModel):
value = value.serialize()
# 8 byte, big-endian encoded, unsigned int (long)
timestamp_bin = struct.pack("!Q", int(timestamp))
msg_combined_bin = timestamp_bin + json.dumps(value).encode("ascii")
signature_bin = await wallet.sign_message(msg_combined_bin, signer)
return SignatureDecorator(
signature_type=cls.TYPE_ED25519SHA512,
signature=bytes_to_b64(signature_bin, urlsafe=True),
sig_data=bytes_to_b64(msg_combined_bin, urlsafe=True),
signer=signer,
) | [
"async",
"def",
"create",
"(",
"cls",
",",
"value",
",",
"signer",
":",
"str",
",",
"wallet",
":",
"BaseWallet",
",",
"timestamp",
"=",
"None",
")",
"->",
"\"SignatureDecorator\"",
":",
"if",
"not",
"timestamp",
":",
"timestamp",
"=",
"time",
".",
"time",
"(",
")",
"if",
"isinstance",
"(",
"value",
",",
"BaseModel",
")",
":",
"value",
"=",
"value",
".",
"serialize",
"(",
")",
"# 8 byte, big-endian encoded, unsigned int (long)",
"timestamp_bin",
"=",
"struct",
".",
"pack",
"(",
"\"!Q\"",
",",
"int",
"(",
"timestamp",
")",
")",
"msg_combined_bin",
"=",
"timestamp_bin",
"+",
"json",
".",
"dumps",
"(",
"value",
")",
".",
"encode",
"(",
"\"ascii\"",
")",
"signature_bin",
"=",
"await",
"wallet",
".",
"sign_message",
"(",
"msg_combined_bin",
",",
"signer",
")",
"return",
"SignatureDecorator",
"(",
"signature_type",
"=",
"cls",
".",
"TYPE_ED25519SHA512",
",",
"signature",
"=",
"bytes_to_b64",
"(",
"signature_bin",
",",
"urlsafe",
"=",
"True",
")",
",",
"sig_data",
"=",
"bytes_to_b64",
"(",
"msg_combined_bin",
",",
"urlsafe",
"=",
"True",
")",
",",
"signer",
"=",
"signer",
",",
")"
] | [
51,
4
] | [
82,
9
] | python | en | ['en', 'error', 'th'] | False |
decode | (self) |
Decode the signature to its timestamp and value.
Returns:
A tuple of (decoded message, timestamp)
|
Decode the signature to its timestamp and value. | def decode(self) -> (object, int):
"""
Decode the signature to its timestamp and value.
Returns:
A tuple of (decoded message, timestamp)
"""
msg_bin = b64_to_bytes(self.sig_data, urlsafe=True)
timestamp, = struct.unpack_from("!Q", msg_bin, 0)
return json.loads(msg_bin[8:]), timestamp | [
"def",
"decode",
"(",
"self",
")",
"->",
"(",
"object",
",",
"int",
")",
":",
"msg_bin",
"=",
"b64_to_bytes",
"(",
"self",
".",
"sig_data",
",",
"urlsafe",
"=",
"True",
")",
"timestamp",
",",
"=",
"struct",
".",
"unpack_from",
"(",
"\"!Q\"",
",",
"msg_bin",
",",
"0",
")",
"return",
"json",
".",
"loads",
"(",
"msg_bin",
"[",
"8",
":",
"]",
")",
",",
"timestamp"
] | [
84,
4
] | [
94,
49
] | python | en | ['en', 'error', 'th'] | False |
verify | (self, wallet: BaseWallet) |
Verify the signature against the signer's public key.
Args:
wallet: Wallet to use to verify signature
Returns:
True if verification succeeds else False
|
Verify the signature against the signer's public key. | async def verify(self, wallet: BaseWallet) -> bool:
"""
Verify the signature against the signer's public key.
Args:
wallet: Wallet to use to verify signature
Returns:
True if verification succeeds else False
"""
if self.signature_type != self.TYPE_ED25519SHA512:
return False
msg_bin = b64_to_bytes(self.sig_data, urlsafe=True)
sig_bin = b64_to_bytes(self.signature, urlsafe=True)
return await wallet.verify_message(msg_bin, sig_bin, self.signer) | [
"async",
"def",
"verify",
"(",
"self",
",",
"wallet",
":",
"BaseWallet",
")",
"->",
"bool",
":",
"if",
"self",
".",
"signature_type",
"!=",
"self",
".",
"TYPE_ED25519SHA512",
":",
"return",
"False",
"msg_bin",
"=",
"b64_to_bytes",
"(",
"self",
".",
"sig_data",
",",
"urlsafe",
"=",
"True",
")",
"sig_bin",
"=",
"b64_to_bytes",
"(",
"self",
".",
"signature",
",",
"urlsafe",
"=",
"True",
")",
"return",
"await",
"wallet",
".",
"verify_message",
"(",
"msg_bin",
",",
"sig_bin",
",",
"self",
".",
"signer",
")"
] | [
96,
4
] | [
111,
73
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.array | (self) |
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def array(self):
"""
Sets the data corresponding the length of each error bar.
Values are plotted relative to the underlying data.
The 'array' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["array"] | [
"def",
"array",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"array\"",
"]"
] | [
31,
4
] | [
43,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.arrayminus | (self) |
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
|
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | def arrayminus(self):
"""
Sets the data corresponding the length of each error bar in the
bottom (left) direction for vertical (horizontal) bars Values
are plotted relative to the underlying data.
The 'arrayminus' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray
"""
return self["arrayminus"] | [
"def",
"arrayminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arrayminus\"",
"]"
] | [
52,
4
] | [
65,
33
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.arrayminussrc | (self) |
Sets the source reference on Chart Studio Cloud for arrayminus
.
The 'arrayminussrc' 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 arrayminus
.
The 'arrayminussrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def arrayminussrc(self):
"""
Sets the source reference on Chart Studio Cloud for arrayminus
.
The 'arrayminussrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["arrayminussrc"] | [
"def",
"arrayminussrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arrayminussrc\"",
"]"
] | [
74,
4
] | [
86,
36
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.arraysrc | (self) |
Sets the source reference on Chart Studio Cloud for array .
The 'arraysrc' 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 array .
The 'arraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def arraysrc(self):
"""
Sets the source reference on Chart Studio Cloud for array .
The 'arraysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["arraysrc"] | [
"def",
"arraysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"arraysrc\"",
"]"
] | [
95,
4
] | [
106,
31
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.color | (self) |
Sets the stoke color of the error bars.
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 stoke color of the error bars.
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 stoke color of the error bars.
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\"",
"]"
] | [
115,
4
] | [
165,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.copy_ystyle | (self) |
The 'copy_ystyle' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
The 'copy_ystyle' property must be specified as a bool
(either True, or False) | def copy_ystyle(self):
"""
The 'copy_ystyle' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["copy_ystyle"] | [
"def",
"copy_ystyle",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"copy_ystyle\"",
"]"
] | [
174,
4
] | [
183,
34
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.symmetric | (self) |
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False) | def symmetric(self):
"""
Determines whether or not the error bars have the same length
in both direction (top/bottom for vertical bars, left/right for
horizontal bars.
The 'symmetric' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["symmetric"] | [
"def",
"symmetric",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"symmetric\"",
"]"
] | [
192,
4
] | [
205,
32
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.thickness | (self) |
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def thickness(self):
"""
Sets the thickness (in px) of the error bars.
The 'thickness' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["thickness"] | [
"def",
"thickness",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"thickness\"",
"]"
] | [
214,
4
] | [
225,
32
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.traceref | (self) |
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
|
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | def traceref(self):
"""
The 'traceref' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
"""
return self["traceref"] | [
"def",
"traceref",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"traceref\"",
"]"
] | [
234,
4
] | [
244,
31
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.tracerefminus | (self) |
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
|
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807] | def tracerefminus(self):
"""
The 'tracerefminus' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [0, 9223372036854775807]
Returns
-------
int
"""
return self["tracerefminus"] | [
"def",
"tracerefminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tracerefminus\"",
"]"
] | [
253,
4
] | [
263,
36
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.type | (self) |
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "sqrt", the bar lengths correspond to the sqaure of
the underlying data. If "data", the bar lengths are set with
data set `array`.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['percent', 'constant', 'sqrt', 'data']
Returns
-------
Any
|
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "sqrt", the bar lengths correspond to the sqaure of
the underlying data. If "data", the bar lengths are set with
data set `array`.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['percent', 'constant', 'sqrt', 'data'] | def type(self):
"""
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value. Set this
constant in `value`. If "percent", the bar lengths correspond
to a percentage of underlying data. Set this percentage in
`value`. If "sqrt", the bar lengths correspond to the sqaure of
the underlying data. If "data", the bar lengths are set with
data set `array`.
The 'type' property is an enumeration that may be specified as:
- One of the following enumeration values:
['percent', 'constant', 'sqrt', 'data']
Returns
-------
Any
"""
return self["type"] | [
"def",
"type",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"type\"",
"]"
] | [
272,
4
] | [
290,
27
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.value | (self) |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def value(self):
"""
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars.
The 'value' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["value"] | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
299,
4
] | [
312,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.valueminus | (self) |
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valueminus' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valueminus' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def valueminus(self):
"""
Sets the value of either the percentage (if `type` is set to
"percent") or the constant (if `type` is set to "constant")
corresponding to the lengths of the error bars in the bottom
(left) direction for vertical (horizontal) bars
The 'valueminus' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
"""
return self["valueminus"] | [
"def",
"valueminus",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"valueminus\"",
"]"
] | [
321,
4
] | [
335,
33
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.visible | (self) |
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False) | def visible(self):
"""
Determines whether or not this set of error bars is visible.
The 'visible' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
return self["visible"] | [
"def",
"visible",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"visible\"",
"]"
] | [
344,
4
] | [
355,
30
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.width | (self) |
Sets the width (in px) of the cross-bar at both ends of the
error bars.
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 width (in px) of the cross-bar at both ends of the
error bars.
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 width (in px) of the cross-bar at both ends of the
error bars.
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\"",
"]"
] | [
364,
4
] | [
376,
28
] | python | en | ['en', 'error', 'th'] | False |
ErrorX.__init__ | (
self,
arg=None,
array=None,
arrayminus=None,
arrayminussrc=None,
arraysrc=None,
color=None,
copy_ystyle=None,
symmetric=None,
thickness=None,
traceref=None,
tracerefminus=None,
type=None,
value=None,
valueminus=None,
visible=None,
width=None,
**kwargs
) |
Construct a new ErrorX object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatter.ErrorX`
array
Sets the data corresponding the length of each error
bar. Values are plotted relative to the underlying
data.
arrayminus
Sets the data corresponding the length of each error
bar in the bottom (left) direction for vertical
(horizontal) bars Values are plotted relative to the
underlying data.
arrayminussrc
Sets the source reference on Chart Studio Cloud for
arrayminus .
arraysrc
Sets the source reference on Chart Studio Cloud for
array .
color
Sets the stoke color of the error bars.
copy_ystyle
symmetric
Determines whether or not the error bars have the same
length in both direction (top/bottom for vertical bars,
left/right for horizontal bars.
thickness
Sets the thickness (in px) of the error bars.
traceref
tracerefminus
type
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value.
Set this constant in `value`. If "percent", the bar
lengths correspond to a percentage of underlying data.
Set this percentage in `value`. If "sqrt", the bar
lengths correspond to the sqaure of the underlying
data. If "data", the bar lengths are set with data set
`array`.
value
Sets the value of either the percentage (if `type` is
set to "percent") or the constant (if `type` is set to
"constant") corresponding to the lengths of the error
bars.
valueminus
Sets the value of either the percentage (if `type` is
set to "percent") or the constant (if `type` is set to
"constant") corresponding to the lengths of the error
bars in the bottom (left) direction for vertical
(horizontal) bars
visible
Determines whether or not this set of error bars is
visible.
width
Sets the width (in px) of the cross-bar at both ends of
the error bars.
Returns
-------
ErrorX
|
Construct a new ErrorX object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatter.ErrorX`
array
Sets the data corresponding the length of each error
bar. Values are plotted relative to the underlying
data.
arrayminus
Sets the data corresponding the length of each error
bar in the bottom (left) direction for vertical
(horizontal) bars Values are plotted relative to the
underlying data.
arrayminussrc
Sets the source reference on Chart Studio Cloud for
arrayminus .
arraysrc
Sets the source reference on Chart Studio Cloud for
array .
color
Sets the stoke color of the error bars.
copy_ystyle | def __init__(
self,
arg=None,
array=None,
arrayminus=None,
arrayminussrc=None,
arraysrc=None,
color=None,
copy_ystyle=None,
symmetric=None,
thickness=None,
traceref=None,
tracerefminus=None,
type=None,
value=None,
valueminus=None,
visible=None,
width=None,
**kwargs
):
"""
Construct a new ErrorX object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatter.ErrorX`
array
Sets the data corresponding the length of each error
bar. Values are plotted relative to the underlying
data.
arrayminus
Sets the data corresponding the length of each error
bar in the bottom (left) direction for vertical
(horizontal) bars Values are plotted relative to the
underlying data.
arrayminussrc
Sets the source reference on Chart Studio Cloud for
arrayminus .
arraysrc
Sets the source reference on Chart Studio Cloud for
array .
color
Sets the stoke color of the error bars.
copy_ystyle
symmetric
Determines whether or not the error bars have the same
length in both direction (top/bottom for vertical bars,
left/right for horizontal bars.
thickness
Sets the thickness (in px) of the error bars.
traceref
tracerefminus
type
Determines the rule used to generate the error bars. If
*constant`, the bar lengths are of a constant value.
Set this constant in `value`. If "percent", the bar
lengths correspond to a percentage of underlying data.
Set this percentage in `value`. If "sqrt", the bar
lengths correspond to the sqaure of the underlying
data. If "data", the bar lengths are set with data set
`array`.
value
Sets the value of either the percentage (if `type` is
set to "percent") or the constant (if `type` is set to
"constant") corresponding to the lengths of the error
bars.
valueminus
Sets the value of either the percentage (if `type` is
set to "percent") or the constant (if `type` is set to
"constant") corresponding to the lengths of the error
bars in the bottom (left) direction for vertical
(horizontal) bars
visible
Determines whether or not this set of error bars is
visible.
width
Sets the width (in px) of the cross-bar at both ends of
the error bars.
Returns
-------
ErrorX
"""
super(ErrorX, self).__init__("error_x")
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.scatter.ErrorX
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scatter.ErrorX`"""
)
# 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("array", None)
_v = array if array is not None else _v
if _v is not None:
self["array"] = _v
_v = arg.pop("arrayminus", None)
_v = arrayminus if arrayminus is not None else _v
if _v is not None:
self["arrayminus"] = _v
_v = arg.pop("arrayminussrc", None)
_v = arrayminussrc if arrayminussrc is not None else _v
if _v is not None:
self["arrayminussrc"] = _v
_v = arg.pop("arraysrc", None)
_v = arraysrc if arraysrc is not None else _v
if _v is not None:
self["arraysrc"] = _v
_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("copy_ystyle", None)
_v = copy_ystyle if copy_ystyle is not None else _v
if _v is not None:
self["copy_ystyle"] = _v
_v = arg.pop("symmetric", None)
_v = symmetric if symmetric is not None else _v
if _v is not None:
self["symmetric"] = _v
_v = arg.pop("thickness", None)
_v = thickness if thickness is not None else _v
if _v is not None:
self["thickness"] = _v
_v = arg.pop("traceref", None)
_v = traceref if traceref is not None else _v
if _v is not None:
self["traceref"] = _v
_v = arg.pop("tracerefminus", None)
_v = tracerefminus if tracerefminus is not None else _v
if _v is not None:
self["tracerefminus"] = _v
_v = arg.pop("type", None)
_v = type if type is not None else _v
if _v is not None:
self["type"] = _v
_v = arg.pop("value", None)
_v = value if value is not None else _v
if _v is not None:
self["value"] = _v
_v = arg.pop("valueminus", None)
_v = valueminus if valueminus is not None else _v
if _v is not None:
self["valueminus"] = _v
_v = arg.pop("visible", None)
_v = visible if visible is not None else _v
if _v is not None:
self["visible"] = _v
_v = arg.pop("width", None)
_v = width if width is not None else _v
if _v is not None:
self["width"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"array",
"=",
"None",
",",
"arrayminus",
"=",
"None",
",",
"arrayminussrc",
"=",
"None",
",",
"arraysrc",
"=",
"None",
",",
"color",
"=",
"None",
",",
"copy_ystyle",
"=",
"None",
",",
"symmetric",
"=",
"None",
",",
"thickness",
"=",
"None",
",",
"traceref",
"=",
"None",
",",
"tracerefminus",
"=",
"None",
",",
"type",
"=",
"None",
",",
"value",
"=",
"None",
",",
"valueminus",
"=",
"None",
",",
"visible",
"=",
"None",
",",
"width",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"ErrorX",
",",
"self",
")",
".",
"__init__",
"(",
"\"error_x\"",
")",
"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.scatter.ErrorX \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.scatter.ErrorX`\"\"\"",
")",
"# 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",
"(",
"\"array\"",
",",
"None",
")",
"_v",
"=",
"array",
"if",
"array",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"array\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"arrayminus\"",
",",
"None",
")",
"_v",
"=",
"arrayminus",
"if",
"arrayminus",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"arrayminus\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"arrayminussrc\"",
",",
"None",
")",
"_v",
"=",
"arrayminussrc",
"if",
"arrayminussrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"arrayminussrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"arraysrc\"",
",",
"None",
")",
"_v",
"=",
"arraysrc",
"if",
"arraysrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"arraysrc\"",
"]",
"=",
"_v",
"_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",
"(",
"\"copy_ystyle\"",
",",
"None",
")",
"_v",
"=",
"copy_ystyle",
"if",
"copy_ystyle",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"copy_ystyle\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"symmetric\"",
",",
"None",
")",
"_v",
"=",
"symmetric",
"if",
"symmetric",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"symmetric\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"thickness\"",
",",
"None",
")",
"_v",
"=",
"thickness",
"if",
"thickness",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"thickness\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"traceref\"",
",",
"None",
")",
"_v",
"=",
"traceref",
"if",
"traceref",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"traceref\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"tracerefminus\"",
",",
"None",
")",
"_v",
"=",
"tracerefminus",
"if",
"tracerefminus",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"tracerefminus\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"type\"",
",",
"None",
")",
"_v",
"=",
"type",
"if",
"type",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"type\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"value\"",
",",
"None",
")",
"_v",
"=",
"value",
"if",
"value",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"value\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"valueminus\"",
",",
"None",
")",
"_v",
"=",
"valueminus",
"if",
"valueminus",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"valueminus\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"visible\"",
",",
"None",
")",
"_v",
"=",
"visible",
"if",
"visible",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"visible\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"width\"",
",",
"None",
")",
"_v",
"=",
"width",
"if",
"width",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"width\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
444,
4
] | [
629,
34
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the tick font.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.ternary
.caxis.Tickfont`
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
-------
Tickfont
|
Construct a new Tickfont object
Sets the tick font. | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the tick font.
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.ternary
.caxis.Tickfont`
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
-------
Tickfont
"""
super(Tickfont, self).__init__("tickfont")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.layout.ternary.caxis.Tickfont
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.ternary.caxis.Tickfont`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tickfont\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.layout.ternary.caxis.Tickfont \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.layout.ternary.caxis.Tickfont`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.marker.colorbar.Tickfont`
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
-------
Tickfont
|
Construct a new Tickfont object
Sets the color bar's tick label font | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.marker.colorbar.Tickfont`
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
-------
Tickfont
"""
super(Tickfont, self).__init__("tickfont")
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.scatterpolargl.marker.colorbar.Tickfont
constructor must be a dict or
an instance of :class:`plotly.graph_objs.scatterpolargl.marker.colorbar.Tickfont`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tickfont\"",
")",
"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.scatterpolargl.marker.colorbar.Tickfont \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.scatterpolargl.marker.colorbar.Tickfont`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.color | (self) |
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
|
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen | def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["color"] | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
63,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.family | (self) |
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string | def family(self):
"""
HTML font family - the typeface that will be applied by the web
browser. The web browser will only be able to apply a font if
it is available on the system which it operates. Provide
multiple font families, separated by commas, to indicate the
preference in which to apply fonts if they aren't available on
the system. The Chart Studio Cloud (at https://chart-
studio.plotly.com or on-premise) generates images on a server,
where only a select number of fonts are installed and
supported. These include "Arial", "Balto", "Courier New",
"Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas
One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
The 'family' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
"""
return self["family"] | [
"def",
"family",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"family\"",
"]"
] | [
72,
4
] | [
94,
29
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.size | (self) |
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
|
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
103,
4
] | [
112,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickfont.__init__ | (self, arg=None, color=None, family=None, size=None, **kwargs) |
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.indicator.gaug
e.axis.Tickfont`
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
-------
Tickfont
|
Construct a new Tickfont object
Sets the color bar's tick label font | def __init__(self, arg=None, color=None, family=None, size=None, **kwargs):
"""
Construct a new Tickfont object
Sets the color bar's tick label font
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.indicator.gaug
e.axis.Tickfont`
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
-------
Tickfont
"""
super(Tickfont, self).__init__("tickfont")
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.indicator.gauge.axis.Tickfont
constructor must be a dict or
an instance of :class:`plotly.graph_objs.indicator.gauge.axis.Tickfont`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("color", None)
_v = color if color is not None else _v
if _v is not None:
self["color"] = _v
_v = arg.pop("family", None)
_v = family if family is not None else _v
if _v is not None:
self["family"] = _v
_v = arg.pop("size", None)
_v = size if size is not None else _v
if _v is not None:
self["size"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"family",
"=",
"None",
",",
"size",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Tickfont",
",",
"self",
")",
".",
"__init__",
"(",
"\"tickfont\"",
")",
"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.indicator.gauge.axis.Tickfont \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.indicator.gauge.axis.Tickfont`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"color\"",
",",
"None",
")",
"_v",
"=",
"color",
"if",
"color",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"color\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"family\"",
",",
"None",
")",
"_v",
"=",
"family",
"if",
"family",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"family\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"size\"",
",",
"None",
")",
"_v",
"=",
"size",
"if",
"size",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"size\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
143,
4
] | [
226,
34
] | python | en | ['en', 'error', 'th'] | False |
set_recall_param | (proposal_nums, iou_thrs) | Check proposal_nums and iou_thrs and set correct format. | Check proposal_nums and iou_thrs and set correct format. | def set_recall_param(proposal_nums, iou_thrs):
"""Check proposal_nums and iou_thrs and set correct format."""
if isinstance(proposal_nums, Sequence):
_proposal_nums = np.array(proposal_nums)
elif isinstance(proposal_nums, int):
_proposal_nums = np.array([proposal_nums])
else:
_proposal_nums = proposal_nums
if iou_thrs is None:
_iou_thrs = np.array([0.5])
elif isinstance(iou_thrs, Sequence):
_iou_thrs = np.array(iou_thrs)
elif isinstance(iou_thrs, float):
_iou_thrs = np.array([iou_thrs])
else:
_iou_thrs = iou_thrs
return _proposal_nums, _iou_thrs | [
"def",
"set_recall_param",
"(",
"proposal_nums",
",",
"iou_thrs",
")",
":",
"if",
"isinstance",
"(",
"proposal_nums",
",",
"Sequence",
")",
":",
"_proposal_nums",
"=",
"np",
".",
"array",
"(",
"proposal_nums",
")",
"elif",
"isinstance",
"(",
"proposal_nums",
",",
"int",
")",
":",
"_proposal_nums",
"=",
"np",
".",
"array",
"(",
"[",
"proposal_nums",
"]",
")",
"else",
":",
"_proposal_nums",
"=",
"proposal_nums",
"if",
"iou_thrs",
"is",
"None",
":",
"_iou_thrs",
"=",
"np",
".",
"array",
"(",
"[",
"0.5",
"]",
")",
"elif",
"isinstance",
"(",
"iou_thrs",
",",
"Sequence",
")",
":",
"_iou_thrs",
"=",
"np",
".",
"array",
"(",
"iou_thrs",
")",
"elif",
"isinstance",
"(",
"iou_thrs",
",",
"float",
")",
":",
"_iou_thrs",
"=",
"np",
".",
"array",
"(",
"[",
"iou_thrs",
"]",
")",
"else",
":",
"_iou_thrs",
"=",
"iou_thrs",
"return",
"_proposal_nums",
",",
"_iou_thrs"
] | [
42,
0
] | [
60,
36
] | python | en | ['en', 'en', 'en'] | True |
eval_recalls | (gts,
proposals,
proposal_nums=None,
iou_thrs=0.5,
logger=None) | Calculate recalls.
Args:
gts (list[ndarray]): a list of arrays of shape (n, 4)
proposals (list[ndarray]): a list of arrays of shape (k, 4) or (k, 5)
proposal_nums (int | Sequence[int]): Top N proposals to be evaluated.
iou_thrs (float | Sequence[float]): IoU thresholds. Default: 0.5.
logger (logging.Logger | str | None): The way to print the recall
summary. See `mmdet.utils.print_log()` for details. Default: None.
Returns:
ndarray: recalls of different ious and proposal nums
| Calculate recalls. | def eval_recalls(gts,
proposals,
proposal_nums=None,
iou_thrs=0.5,
logger=None):
"""Calculate recalls.
Args:
gts (list[ndarray]): a list of arrays of shape (n, 4)
proposals (list[ndarray]): a list of arrays of shape (k, 4) or (k, 5)
proposal_nums (int | Sequence[int]): Top N proposals to be evaluated.
iou_thrs (float | Sequence[float]): IoU thresholds. Default: 0.5.
logger (logging.Logger | str | None): The way to print the recall
summary. See `mmdet.utils.print_log()` for details. Default: None.
Returns:
ndarray: recalls of different ious and proposal nums
"""
img_num = len(gts)
assert img_num == len(proposals)
proposal_nums, iou_thrs = set_recall_param(proposal_nums, iou_thrs)
all_ious = []
for i in range(img_num):
if proposals[i].ndim == 2 and proposals[i].shape[1] == 5:
scores = proposals[i][:, 4]
sort_idx = np.argsort(scores)[::-1]
img_proposal = proposals[i][sort_idx, :]
else:
img_proposal = proposals[i]
prop_num = min(img_proposal.shape[0], proposal_nums[-1])
if gts[i] is None or gts[i].shape[0] == 0:
ious = np.zeros((0, img_proposal.shape[0]), dtype=np.float32)
else:
ious = bbox_overlaps(gts[i], img_proposal[:prop_num, :4])
all_ious.append(ious)
all_ious = np.array(all_ious)
recalls = _recalls(all_ious, proposal_nums, iou_thrs)
print_recall_summary(recalls, proposal_nums, iou_thrs, logger=logger)
return recalls | [
"def",
"eval_recalls",
"(",
"gts",
",",
"proposals",
",",
"proposal_nums",
"=",
"None",
",",
"iou_thrs",
"=",
"0.5",
",",
"logger",
"=",
"None",
")",
":",
"img_num",
"=",
"len",
"(",
"gts",
")",
"assert",
"img_num",
"==",
"len",
"(",
"proposals",
")",
"proposal_nums",
",",
"iou_thrs",
"=",
"set_recall_param",
"(",
"proposal_nums",
",",
"iou_thrs",
")",
"all_ious",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"img_num",
")",
":",
"if",
"proposals",
"[",
"i",
"]",
".",
"ndim",
"==",
"2",
"and",
"proposals",
"[",
"i",
"]",
".",
"shape",
"[",
"1",
"]",
"==",
"5",
":",
"scores",
"=",
"proposals",
"[",
"i",
"]",
"[",
":",
",",
"4",
"]",
"sort_idx",
"=",
"np",
".",
"argsort",
"(",
"scores",
")",
"[",
":",
":",
"-",
"1",
"]",
"img_proposal",
"=",
"proposals",
"[",
"i",
"]",
"[",
"sort_idx",
",",
":",
"]",
"else",
":",
"img_proposal",
"=",
"proposals",
"[",
"i",
"]",
"prop_num",
"=",
"min",
"(",
"img_proposal",
".",
"shape",
"[",
"0",
"]",
",",
"proposal_nums",
"[",
"-",
"1",
"]",
")",
"if",
"gts",
"[",
"i",
"]",
"is",
"None",
"or",
"gts",
"[",
"i",
"]",
".",
"shape",
"[",
"0",
"]",
"==",
"0",
":",
"ious",
"=",
"np",
".",
"zeros",
"(",
"(",
"0",
",",
"img_proposal",
".",
"shape",
"[",
"0",
"]",
")",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"else",
":",
"ious",
"=",
"bbox_overlaps",
"(",
"gts",
"[",
"i",
"]",
",",
"img_proposal",
"[",
":",
"prop_num",
",",
":",
"4",
"]",
")",
"all_ious",
".",
"append",
"(",
"ious",
")",
"all_ious",
"=",
"np",
".",
"array",
"(",
"all_ious",
")",
"recalls",
"=",
"_recalls",
"(",
"all_ious",
",",
"proposal_nums",
",",
"iou_thrs",
")",
"print_recall_summary",
"(",
"recalls",
",",
"proposal_nums",
",",
"iou_thrs",
",",
"logger",
"=",
"logger",
")",
"return",
"recalls"
] | [
63,
0
] | [
105,
18
] | python | en | ['en', 'co', 'en'] | False |
print_recall_summary | (recalls,
proposal_nums,
iou_thrs,
row_idxs=None,
col_idxs=None,
logger=None) | Print recalls in a table.
Args:
recalls (ndarray): calculated from `bbox_recalls`
proposal_nums (ndarray or list): top N proposals
iou_thrs (ndarray or list): iou thresholds
row_idxs (ndarray): which rows(proposal nums) to print
col_idxs (ndarray): which cols(iou thresholds) to print
logger (logging.Logger | str | None): The way to print the recall
summary. See `mmdet.utils.print_log()` for details. Default: None.
| Print recalls in a table. | def print_recall_summary(recalls,
proposal_nums,
iou_thrs,
row_idxs=None,
col_idxs=None,
logger=None):
"""Print recalls in a table.
Args:
recalls (ndarray): calculated from `bbox_recalls`
proposal_nums (ndarray or list): top N proposals
iou_thrs (ndarray or list): iou thresholds
row_idxs (ndarray): which rows(proposal nums) to print
col_idxs (ndarray): which cols(iou thresholds) to print
logger (logging.Logger | str | None): The way to print the recall
summary. See `mmdet.utils.print_log()` for details. Default: None.
"""
proposal_nums = np.array(proposal_nums, dtype=np.int32)
iou_thrs = np.array(iou_thrs)
if row_idxs is None:
row_idxs = np.arange(proposal_nums.size)
if col_idxs is None:
col_idxs = np.arange(iou_thrs.size)
row_header = [''] + iou_thrs[col_idxs].tolist()
table_data = [row_header]
for i, num in enumerate(proposal_nums[row_idxs]):
row = [f'{val:.3f}' for val in recalls[row_idxs[i], col_idxs].tolist()]
row.insert(0, num)
table_data.append(row)
table = AsciiTable(table_data)
print_log('\n' + table.table, logger=logger) | [
"def",
"print_recall_summary",
"(",
"recalls",
",",
"proposal_nums",
",",
"iou_thrs",
",",
"row_idxs",
"=",
"None",
",",
"col_idxs",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"proposal_nums",
"=",
"np",
".",
"array",
"(",
"proposal_nums",
",",
"dtype",
"=",
"np",
".",
"int32",
")",
"iou_thrs",
"=",
"np",
".",
"array",
"(",
"iou_thrs",
")",
"if",
"row_idxs",
"is",
"None",
":",
"row_idxs",
"=",
"np",
".",
"arange",
"(",
"proposal_nums",
".",
"size",
")",
"if",
"col_idxs",
"is",
"None",
":",
"col_idxs",
"=",
"np",
".",
"arange",
"(",
"iou_thrs",
".",
"size",
")",
"row_header",
"=",
"[",
"''",
"]",
"+",
"iou_thrs",
"[",
"col_idxs",
"]",
".",
"tolist",
"(",
")",
"table_data",
"=",
"[",
"row_header",
"]",
"for",
"i",
",",
"num",
"in",
"enumerate",
"(",
"proposal_nums",
"[",
"row_idxs",
"]",
")",
":",
"row",
"=",
"[",
"f'{val:.3f}'",
"for",
"val",
"in",
"recalls",
"[",
"row_idxs",
"[",
"i",
"]",
",",
"col_idxs",
"]",
".",
"tolist",
"(",
")",
"]",
"row",
".",
"insert",
"(",
"0",
",",
"num",
")",
"table_data",
".",
"append",
"(",
"row",
")",
"table",
"=",
"AsciiTable",
"(",
"table_data",
")",
"print_log",
"(",
"'\\n'",
"+",
"table",
".",
"table",
",",
"logger",
"=",
"logger",
")"
] | [
108,
0
] | [
138,
48
] | python | en | ['en', 'en', 'en'] | True |
plot_num_recall | (recalls, proposal_nums) | Plot Proposal_num-Recalls curve.
Args:
recalls(ndarray or list): shape (k,)
proposal_nums(ndarray or list): same shape as `recalls`
| Plot Proposal_num-Recalls curve. | def plot_num_recall(recalls, proposal_nums):
"""Plot Proposal_num-Recalls curve.
Args:
recalls(ndarray or list): shape (k,)
proposal_nums(ndarray or list): same shape as `recalls`
"""
if isinstance(proposal_nums, np.ndarray):
_proposal_nums = proposal_nums.tolist()
else:
_proposal_nums = proposal_nums
if isinstance(recalls, np.ndarray):
_recalls = recalls.tolist()
else:
_recalls = recalls
import matplotlib.pyplot as plt
f = plt.figure()
plt.plot([0] + _proposal_nums, [0] + _recalls)
plt.xlabel('Proposal num')
plt.ylabel('Recall')
plt.axis([0, proposal_nums.max(), 0, 1])
f.show() | [
"def",
"plot_num_recall",
"(",
"recalls",
",",
"proposal_nums",
")",
":",
"if",
"isinstance",
"(",
"proposal_nums",
",",
"np",
".",
"ndarray",
")",
":",
"_proposal_nums",
"=",
"proposal_nums",
".",
"tolist",
"(",
")",
"else",
":",
"_proposal_nums",
"=",
"proposal_nums",
"if",
"isinstance",
"(",
"recalls",
",",
"np",
".",
"ndarray",
")",
":",
"_recalls",
"=",
"recalls",
".",
"tolist",
"(",
")",
"else",
":",
"_recalls",
"=",
"recalls",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"f",
"=",
"plt",
".",
"figure",
"(",
")",
"plt",
".",
"plot",
"(",
"[",
"0",
"]",
"+",
"_proposal_nums",
",",
"[",
"0",
"]",
"+",
"_recalls",
")",
"plt",
".",
"xlabel",
"(",
"'Proposal num'",
")",
"plt",
".",
"ylabel",
"(",
"'Recall'",
")",
"plt",
".",
"axis",
"(",
"[",
"0",
",",
"proposal_nums",
".",
"max",
"(",
")",
",",
"0",
",",
"1",
"]",
")",
"f",
".",
"show",
"(",
")"
] | [
141,
0
] | [
163,
12
] | python | ca | ['mt', 'ca', 'en'] | False |
plot_iou_recall | (recalls, iou_thrs) | Plot IoU-Recalls curve.
Args:
recalls(ndarray or list): shape (k,)
iou_thrs(ndarray or list): same shape as `recalls`
| Plot IoU-Recalls curve. | def plot_iou_recall(recalls, iou_thrs):
"""Plot IoU-Recalls curve.
Args:
recalls(ndarray or list): shape (k,)
iou_thrs(ndarray or list): same shape as `recalls`
"""
if isinstance(iou_thrs, np.ndarray):
_iou_thrs = iou_thrs.tolist()
else:
_iou_thrs = iou_thrs
if isinstance(recalls, np.ndarray):
_recalls = recalls.tolist()
else:
_recalls = recalls
import matplotlib.pyplot as plt
f = plt.figure()
plt.plot(_iou_thrs + [1.0], _recalls + [0.])
plt.xlabel('IoU')
plt.ylabel('Recall')
plt.axis([iou_thrs.min(), 1, 0, 1])
f.show() | [
"def",
"plot_iou_recall",
"(",
"recalls",
",",
"iou_thrs",
")",
":",
"if",
"isinstance",
"(",
"iou_thrs",
",",
"np",
".",
"ndarray",
")",
":",
"_iou_thrs",
"=",
"iou_thrs",
".",
"tolist",
"(",
")",
"else",
":",
"_iou_thrs",
"=",
"iou_thrs",
"if",
"isinstance",
"(",
"recalls",
",",
"np",
".",
"ndarray",
")",
":",
"_recalls",
"=",
"recalls",
".",
"tolist",
"(",
")",
"else",
":",
"_recalls",
"=",
"recalls",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"f",
"=",
"plt",
".",
"figure",
"(",
")",
"plt",
".",
"plot",
"(",
"_iou_thrs",
"+",
"[",
"1.0",
"]",
",",
"_recalls",
"+",
"[",
"0.",
"]",
")",
"plt",
".",
"xlabel",
"(",
"'IoU'",
")",
"plt",
".",
"ylabel",
"(",
"'Recall'",
")",
"plt",
".",
"axis",
"(",
"[",
"iou_thrs",
".",
"min",
"(",
")",
",",
"1",
",",
"0",
",",
"1",
"]",
")",
"f",
".",
"show",
"(",
")"
] | [
166,
0
] | [
188,
12
] | python | en | ['mt', 'la', 'en'] | False |
TagHandler.__init__ | (self, obj) |
Tags are stored internally in the TypedObject.db_tags m2m
field with an tag.db_model based on the obj the taghandler is
stored on and with a tagtype given by self.handlertype
Args:
obj (object): The object on which the handler is set.
|
Tags are stored internally in the TypedObject.db_tags m2m
field with an tag.db_model based on the obj the taghandler is
stored on and with a tagtype given by self.handlertype | def __init__(self, obj):
"""
Tags are stored internally in the TypedObject.db_tags m2m
field with an tag.db_model based on the obj the taghandler is
stored on and with a tagtype given by self.handlertype
Args:
obj (object): The object on which the handler is set.
"""
self.obj = obj
self._objid = obj.id
self._model = obj.__dbclass__.__name__.lower()
self._cache = {}
# store category names fully cached
self._catcache = {}
# full cache was run on all tags
self._cache_complete = False | [
"def",
"__init__",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"obj",
"=",
"obj",
"self",
".",
"_objid",
"=",
"obj",
".",
"id",
"self",
".",
"_model",
"=",
"obj",
".",
"__dbclass__",
".",
"__name__",
".",
"lower",
"(",
")",
"self",
".",
"_cache",
"=",
"{",
"}",
"# store category names fully cached",
"self",
".",
"_catcache",
"=",
"{",
"}",
"# full cache was run on all tags",
"self",
".",
"_cache_complete",
"=",
"False"
] | [
87,
4
] | [
104,
36
] | python | en | ['en', 'error', 'th'] | False |
TagHandler._fullcache | (self) | Cache all tags of this object | Cache all tags of this object | def _fullcache(self):
"Cache all tags of this object"
query = {"%s__id" % self._model: self._objid,
"tag__db_model": self._model,
"tag__db_tagtype": self._tagtype}
tags = [conn.tag for conn in getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query)]
self._cache = dict(("%s-%s" % (to_str(tag.db_key).lower(),
tag.db_category.lower() if tag.db_category else None),
tag) for tag in tags)
self._cache_complete = True | [
"def",
"_fullcache",
"(",
"self",
")",
":",
"query",
"=",
"{",
"\"%s__id\"",
"%",
"self",
".",
"_model",
":",
"self",
".",
"_objid",
",",
"\"tag__db_model\"",
":",
"self",
".",
"_model",
",",
"\"tag__db_tagtype\"",
":",
"self",
".",
"_tagtype",
"}",
"tags",
"=",
"[",
"conn",
".",
"tag",
"for",
"conn",
"in",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"through",
".",
"objects",
".",
"filter",
"(",
"*",
"*",
"query",
")",
"]",
"self",
".",
"_cache",
"=",
"dict",
"(",
"(",
"\"%s-%s\"",
"%",
"(",
"to_str",
"(",
"tag",
".",
"db_key",
")",
".",
"lower",
"(",
")",
",",
"tag",
".",
"db_category",
".",
"lower",
"(",
")",
"if",
"tag",
".",
"db_category",
"else",
"None",
")",
",",
"tag",
")",
"for",
"tag",
"in",
"tags",
")",
"self",
".",
"_cache_complete",
"=",
"True"
] | [
106,
4
] | [
115,
35
] | python | en | ['en', 'en', 'en'] | True |
TagHandler._getcache | (self, key=None, category=None) |
Retrieve from cache or database (always caches)
Args:
key (str, optional): Tag key to query for
category (str, optional): Tag category
Returns:
args (list): Returns a list of zero or more matches
found from cache or database.
Notes:
When given a category only, a search for all objects
of that category is done and a the category *name* is is
stored. This tells the system on subsequent calls that the
list of cached tags of this category is up-to-date
and that the cache can be queried for category matches
without missing any.
The TYPECLASS_AGGRESSIVE_CACHE=False setting will turn off
caching, causing each tag access to trigger a
database lookup.
|
Retrieve from cache or database (always caches) | def _getcache(self, key=None, category=None):
"""
Retrieve from cache or database (always caches)
Args:
key (str, optional): Tag key to query for
category (str, optional): Tag category
Returns:
args (list): Returns a list of zero or more matches
found from cache or database.
Notes:
When given a category only, a search for all objects
of that category is done and a the category *name* is is
stored. This tells the system on subsequent calls that the
list of cached tags of this category is up-to-date
and that the cache can be queried for category matches
without missing any.
The TYPECLASS_AGGRESSIVE_CACHE=False setting will turn off
caching, causing each tag access to trigger a
database lookup.
"""
key = key.strip().lower() if key else None
category = category.strip().lower() if category else None
if key:
cachekey = "%s-%s" % (key, category)
tag = _TYPECLASS_AGGRESSIVE_CACHE and self._cache.get(cachekey, None)
if tag and (not hasattr(tag, "pk") and tag.pk is None):
# clear out Tags deleted from elsewhere. We must search this anew.
tag = None
del self._cache[cachekey]
if tag:
return [tag] # return cached entity
else:
query = {"%s__id" % self._model: self._objid,
"tag__db_model": self._model,
"tag__db_tagtype": self._tagtype,
"tag__db_key__iexact": key.lower(),
"tag__db_category__iexact": category.lower() if category else None}
conn = getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query)
if conn:
tag = conn[0].tag
self._cache[cachekey] = tag
return [tag]
else:
# only category given (even if it's None) - we can't
# assume the cache to be complete unless we have queried
# for this category before
catkey = "-%s" % category
if _TYPECLASS_AGGRESSIVE_CACHE and catkey in self._catcache:
return [tag for key, tag in self._cache.items() if key.endswith(catkey)]
else:
# we have to query to make this category up-date in the cache
query = {"%s__id" % self._model: self._objid,
"tag__db_model": self._model,
"tag__db_tagtype": self._tagtype,
"tag__db_category__iexact": category.lower() if category else None}
tags = [conn.tag for conn in getattr(self.obj,
self._m2m_fieldname).through.objects.filter(**query)]
for tag in tags:
cachekey = "%s-%s" % (tag.db_key, category)
self._cache[cachekey] = tag
# mark category cache as up-to-date
self._catcache[catkey] = True
return tags
return [] | [
"def",
"_getcache",
"(",
"self",
",",
"key",
"=",
"None",
",",
"category",
"=",
"None",
")",
":",
"key",
"=",
"key",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"key",
"else",
"None",
"category",
"=",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"None",
"if",
"key",
":",
"cachekey",
"=",
"\"%s-%s\"",
"%",
"(",
"key",
",",
"category",
")",
"tag",
"=",
"_TYPECLASS_AGGRESSIVE_CACHE",
"and",
"self",
".",
"_cache",
".",
"get",
"(",
"cachekey",
",",
"None",
")",
"if",
"tag",
"and",
"(",
"not",
"hasattr",
"(",
"tag",
",",
"\"pk\"",
")",
"and",
"tag",
".",
"pk",
"is",
"None",
")",
":",
"# clear out Tags deleted from elsewhere. We must search this anew.",
"tag",
"=",
"None",
"del",
"self",
".",
"_cache",
"[",
"cachekey",
"]",
"if",
"tag",
":",
"return",
"[",
"tag",
"]",
"# return cached entity",
"else",
":",
"query",
"=",
"{",
"\"%s__id\"",
"%",
"self",
".",
"_model",
":",
"self",
".",
"_objid",
",",
"\"tag__db_model\"",
":",
"self",
".",
"_model",
",",
"\"tag__db_tagtype\"",
":",
"self",
".",
"_tagtype",
",",
"\"tag__db_key__iexact\"",
":",
"key",
".",
"lower",
"(",
")",
",",
"\"tag__db_category__iexact\"",
":",
"category",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"None",
"}",
"conn",
"=",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"through",
".",
"objects",
".",
"filter",
"(",
"*",
"*",
"query",
")",
"if",
"conn",
":",
"tag",
"=",
"conn",
"[",
"0",
"]",
".",
"tag",
"self",
".",
"_cache",
"[",
"cachekey",
"]",
"=",
"tag",
"return",
"[",
"tag",
"]",
"else",
":",
"# only category given (even if it's None) - we can't",
"# assume the cache to be complete unless we have queried",
"# for this category before",
"catkey",
"=",
"\"-%s\"",
"%",
"category",
"if",
"_TYPECLASS_AGGRESSIVE_CACHE",
"and",
"catkey",
"in",
"self",
".",
"_catcache",
":",
"return",
"[",
"tag",
"for",
"key",
",",
"tag",
"in",
"self",
".",
"_cache",
".",
"items",
"(",
")",
"if",
"key",
".",
"endswith",
"(",
"catkey",
")",
"]",
"else",
":",
"# we have to query to make this category up-date in the cache",
"query",
"=",
"{",
"\"%s__id\"",
"%",
"self",
".",
"_model",
":",
"self",
".",
"_objid",
",",
"\"tag__db_model\"",
":",
"self",
".",
"_model",
",",
"\"tag__db_tagtype\"",
":",
"self",
".",
"_tagtype",
",",
"\"tag__db_category__iexact\"",
":",
"category",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"None",
"}",
"tags",
"=",
"[",
"conn",
".",
"tag",
"for",
"conn",
"in",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"through",
".",
"objects",
".",
"filter",
"(",
"*",
"*",
"query",
")",
"]",
"for",
"tag",
"in",
"tags",
":",
"cachekey",
"=",
"\"%s-%s\"",
"%",
"(",
"tag",
".",
"db_key",
",",
"category",
")",
"self",
".",
"_cache",
"[",
"cachekey",
"]",
"=",
"tag",
"# mark category cache as up-to-date",
"self",
".",
"_catcache",
"[",
"catkey",
"]",
"=",
"True",
"return",
"tags",
"return",
"[",
"]"
] | [
117,
4
] | [
183,
17
] | python | en | ['en', 'error', 'th'] | False |
TagHandler._setcache | (self, key, category, tag_obj) |
Update cache.
Args:
key (str): A cleaned key string
category (str or None): A cleaned category name
tag_obj (tag): The newly saved tag
|
Update cache. | def _setcache(self, key, category, tag_obj):
"""
Update cache.
Args:
key (str): A cleaned key string
category (str or None): A cleaned category name
tag_obj (tag): The newly saved tag
"""
if not key: # don't allow an empty key in cache
return
key, category = key.strip().lower(), category.strip().lower() if category else category
cachekey = "%s-%s" % (key, category)
catkey = "-%s" % category
self._cache[cachekey] = tag_obj
# mark that the category cache is no longer up-to-date
self._catcache.pop(catkey, None)
self._cache_complete = False | [
"def",
"_setcache",
"(",
"self",
",",
"key",
",",
"category",
",",
"tag_obj",
")",
":",
"if",
"not",
"key",
":",
"# don't allow an empty key in cache",
"return",
"key",
",",
"category",
"=",
"key",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
",",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"category",
"cachekey",
"=",
"\"%s-%s\"",
"%",
"(",
"key",
",",
"category",
")",
"catkey",
"=",
"\"-%s\"",
"%",
"category",
"self",
".",
"_cache",
"[",
"cachekey",
"]",
"=",
"tag_obj",
"# mark that the category cache is no longer up-to-date",
"self",
".",
"_catcache",
".",
"pop",
"(",
"catkey",
",",
"None",
")",
"self",
".",
"_cache_complete",
"=",
"False"
] | [
185,
4
] | [
203,
36
] | python | en | ['en', 'error', 'th'] | False |
TagHandler._delcache | (self, key, category) |
Remove tag from cache
Args:
key (str): A cleaned key string
category (str or None): A cleaned category name
|
Remove tag from cache | def _delcache(self, key, category):
"""
Remove tag from cache
Args:
key (str): A cleaned key string
category (str or None): A cleaned category name
"""
key, category = key.strip().lower(), category.strip().lower() if category else category
catkey = "-%s" % category
if key:
cachekey = "%s-%s" % (key, category)
self._cache.pop(cachekey, None)
else:
[self._cache.pop(key, None) for key in self._cache if key.endswith(catkey)]
# mark that the category cache is no longer up-to-date
self._catcache.pop(catkey, None)
self._cache_complete = False | [
"def",
"_delcache",
"(",
"self",
",",
"key",
",",
"category",
")",
":",
"key",
",",
"category",
"=",
"key",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
",",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"category",
"catkey",
"=",
"\"-%s\"",
"%",
"category",
"if",
"key",
":",
"cachekey",
"=",
"\"%s-%s\"",
"%",
"(",
"key",
",",
"category",
")",
"self",
".",
"_cache",
".",
"pop",
"(",
"cachekey",
",",
"None",
")",
"else",
":",
"[",
"self",
".",
"_cache",
".",
"pop",
"(",
"key",
",",
"None",
")",
"for",
"key",
"in",
"self",
".",
"_cache",
"if",
"key",
".",
"endswith",
"(",
"catkey",
")",
"]",
"# mark that the category cache is no longer up-to-date",
"self",
".",
"_catcache",
".",
"pop",
"(",
"catkey",
",",
"None",
")",
"self",
".",
"_cache_complete",
"=",
"False"
] | [
205,
4
] | [
223,
36
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.reset_cache | (self) |
Reset the cache from the outside.
|
Reset the cache from the outside.
| def reset_cache(self):
"""
Reset the cache from the outside.
"""
self._cache_complete = False
self._cache = {}
self._catcache = {} | [
"def",
"reset_cache",
"(",
"self",
")",
":",
"self",
".",
"_cache_complete",
"=",
"False",
"self",
".",
"_cache",
"=",
"{",
"}",
"self",
".",
"_catcache",
"=",
"{",
"}"
] | [
225,
4
] | [
231,
27
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.add | (self, tag=None, category=None, data=None) |
Add a new tag to the handler.
Args:
tag (str or list): The name of the tag to add. If a list,
add several Tags.
category (str, optional): Category of Tag. `None` is the default category.
data (str, optional): Info text about the tag(s) added.
This can not be used to store object-unique info but only
eventual info about the tag itself.
Notes:
If the tag + category combination matches an already
existing Tag object, this will be re-used and no new Tag
will be created.
|
Add a new tag to the handler. | def add(self, tag=None, category=None, data=None):
"""
Add a new tag to the handler.
Args:
tag (str or list): The name of the tag to add. If a list,
add several Tags.
category (str, optional): Category of Tag. `None` is the default category.
data (str, optional): Info text about the tag(s) added.
This can not be used to store object-unique info but only
eventual info about the tag itself.
Notes:
If the tag + category combination matches an already
existing Tag object, this will be re-used and no new Tag
will be created.
"""
if not tag:
return
if not self._cache_complete:
self._fullcache()
for tagstr in make_iter(tag):
if not tagstr:
continue
tagstr = tagstr.strip().lower()
category = category.strip().lower() if category else category
data = str(data) if data is not None else None
# this will only create tag if no matches existed beforehand (it
# will overload data on an existing tag since that is not
# considered part of making the tag unique)
tagobj = self.obj.__class__.objects.create_tag(key=tagstr, category=category, data=data,
tagtype=self._tagtype)
getattr(self.obj, self._m2m_fieldname).add(tagobj)
self._setcache(tagstr, category, tagobj) | [
"def",
"add",
"(",
"self",
",",
"tag",
"=",
"None",
",",
"category",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"if",
"not",
"tag",
":",
"return",
"if",
"not",
"self",
".",
"_cache_complete",
":",
"self",
".",
"_fullcache",
"(",
")",
"for",
"tagstr",
"in",
"make_iter",
"(",
"tag",
")",
":",
"if",
"not",
"tagstr",
":",
"continue",
"tagstr",
"=",
"tagstr",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"category",
"=",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"category",
"data",
"=",
"str",
"(",
"data",
")",
"if",
"data",
"is",
"not",
"None",
"else",
"None",
"# this will only create tag if no matches existed beforehand (it",
"# will overload data on an existing tag since that is not",
"# considered part of making the tag unique)",
"tagobj",
"=",
"self",
".",
"obj",
".",
"__class__",
".",
"objects",
".",
"create_tag",
"(",
"key",
"=",
"tagstr",
",",
"category",
"=",
"category",
",",
"data",
"=",
"data",
",",
"tagtype",
"=",
"self",
".",
"_tagtype",
")",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"add",
"(",
"tagobj",
")",
"self",
".",
"_setcache",
"(",
"tagstr",
",",
"category",
",",
"tagobj",
")"
] | [
233,
4
] | [
267,
52
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.get | (self, key=None, default=None, category=None, return_tagobj=False, return_list=False) |
Get the tag for the given key, category or combination of the two.
Args:
key (str or list, optional): The tag or tags to retrieve.
default (any, optional): The value to return in case of no match.
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category. If no `key` is given, all tags of this category will be
returned.
return_tagobj (bool, optional): Return the Tag object itself
instead of a string representation of the Tag.
return_list (bool, optional): Always return a list, regardless
of number of matches.
Returns:
tags (list): The matches, either string
representations of the tags or the Tag objects themselves
depending on `return_tagobj`. If 'default' is set, this
will be a list with the default value as its only element.
|
Get the tag for the given key, category or combination of the two. | def get(self, key=None, default=None, category=None, return_tagobj=False, return_list=False):
"""
Get the tag for the given key, category or combination of the two.
Args:
key (str or list, optional): The tag or tags to retrieve.
default (any, optional): The value to return in case of no match.
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category. If no `key` is given, all tags of this category will be
returned.
return_tagobj (bool, optional): Return the Tag object itself
instead of a string representation of the Tag.
return_list (bool, optional): Always return a list, regardless
of number of matches.
Returns:
tags (list): The matches, either string
representations of the tags or the Tag objects themselves
depending on `return_tagobj`. If 'default' is set, this
will be a list with the default value as its only element.
"""
ret = []
for keystr in make_iter(key):
# note - the _getcache call removes case sensitivity for us
ret.extend([tag if return_tagobj else to_str(tag.db_key)
for tag in self._getcache(keystr, category)])
if return_list:
return ret if ret else [default] if default is not None else []
return ret[0] if len(ret) == 1 else (ret if ret else default) | [
"def",
"get",
"(",
"self",
",",
"key",
"=",
"None",
",",
"default",
"=",
"None",
",",
"category",
"=",
"None",
",",
"return_tagobj",
"=",
"False",
",",
"return_list",
"=",
"False",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"keystr",
"in",
"make_iter",
"(",
"key",
")",
":",
"# note - the _getcache call removes case sensitivity for us",
"ret",
".",
"extend",
"(",
"[",
"tag",
"if",
"return_tagobj",
"else",
"to_str",
"(",
"tag",
".",
"db_key",
")",
"for",
"tag",
"in",
"self",
".",
"_getcache",
"(",
"keystr",
",",
"category",
")",
"]",
")",
"if",
"return_list",
":",
"return",
"ret",
"if",
"ret",
"else",
"[",
"default",
"]",
"if",
"default",
"is",
"not",
"None",
"else",
"[",
"]",
"return",
"ret",
"[",
"0",
"]",
"if",
"len",
"(",
"ret",
")",
"==",
"1",
"else",
"(",
"ret",
"if",
"ret",
"else",
"default",
")"
] | [
269,
4
] | [
299,
69
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.remove | (self, key, category=None) |
Remove a tag from the handler based ond key and category.
Args:
key (str or list): The tag or tags to retrieve.
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category.
|
Remove a tag from the handler based ond key and category. | def remove(self, key, category=None):
"""
Remove a tag from the handler based ond key and category.
Args:
key (str or list): The tag or tags to retrieve.
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category.
"""
for key in make_iter(key):
if not (key or key.strip()): # we don't allow empty tags
continue
tagstr = key.strip().lower()
category = category.strip().lower() if category else category
# This does not delete the tag object itself. Maybe it should do
# that when no objects reference the tag anymore (but how to check)?
# For now, tags are never deleted, only their connection to objects.
tagobj = getattr(self.obj, self._m2m_fieldname).filter(db_key=tagstr, db_category=category,
db_model=self._model, db_tagtype=self._tagtype)
if tagobj:
getattr(self.obj, self._m2m_fieldname).remove(tagobj[0])
self._delcache(key, category) | [
"def",
"remove",
"(",
"self",
",",
"key",
",",
"category",
"=",
"None",
")",
":",
"for",
"key",
"in",
"make_iter",
"(",
"key",
")",
":",
"if",
"not",
"(",
"key",
"or",
"key",
".",
"strip",
"(",
")",
")",
":",
"# we don't allow empty tags",
"continue",
"tagstr",
"=",
"key",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"category",
"=",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"if",
"category",
"else",
"category",
"# This does not delete the tag object itself. Maybe it should do",
"# that when no objects reference the tag anymore (but how to check)?",
"# For now, tags are never deleted, only their connection to objects.",
"tagobj",
"=",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"filter",
"(",
"db_key",
"=",
"tagstr",
",",
"db_category",
"=",
"category",
",",
"db_model",
"=",
"self",
".",
"_model",
",",
"db_tagtype",
"=",
"self",
".",
"_tagtype",
")",
"if",
"tagobj",
":",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"remove",
"(",
"tagobj",
"[",
"0",
"]",
")",
"self",
".",
"_delcache",
"(",
"key",
",",
"category",
")"
] | [
301,
4
] | [
325,
41
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.clear | (self, category=None) |
Remove all tags from the handler.
Args:
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category.
|
Remove all tags from the handler. | def clear(self, category=None):
"""
Remove all tags from the handler.
Args:
category (str, optional): The Tag category to limit the
request to. Note that `None` is the valid, default
category.
"""
if not self._cache_complete:
self._fullcache()
query = {"%s__id" % self._model: self._objid, "tag__db_model": self._model, "tag__db_tagtype": self._tagtype}
if category:
query["tag__db_category"] = category.strip().lower()
getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query).delete()
self._cache = {}
self._catcache = {}
self._cache_complete = False | [
"def",
"clear",
"(",
"self",
",",
"category",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_cache_complete",
":",
"self",
".",
"_fullcache",
"(",
")",
"query",
"=",
"{",
"\"%s__id\"",
"%",
"self",
".",
"_model",
":",
"self",
".",
"_objid",
",",
"\"tag__db_model\"",
":",
"self",
".",
"_model",
",",
"\"tag__db_tagtype\"",
":",
"self",
".",
"_tagtype",
"}",
"if",
"category",
":",
"query",
"[",
"\"tag__db_category\"",
"]",
"=",
"category",
".",
"strip",
"(",
")",
".",
"lower",
"(",
")",
"getattr",
"(",
"self",
".",
"obj",
",",
"self",
".",
"_m2m_fieldname",
")",
".",
"through",
".",
"objects",
".",
"filter",
"(",
"*",
"*",
"query",
")",
".",
"delete",
"(",
")",
"self",
".",
"_cache",
"=",
"{",
"}",
"self",
".",
"_catcache",
"=",
"{",
"}",
"self",
".",
"_cache_complete",
"=",
"False"
] | [
327,
4
] | [
345,
36
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.all | (self, return_key_and_category=False, return_objs=False) |
Get all tags in this handler, regardless of category.
Args:
return_key_and_category (bool, optional): Return a list of
tuples `[(key, category), ...]`.
return_objs (bool, optional): Return tag objects.
Returns:
tags (list): A list of tag keys `[tagkey, tagkey, ...]` or
a list of tuples `[(key, category), ...]` if
`return_key_and_category` is set.
|
Get all tags in this handler, regardless of category. | def all(self, return_key_and_category=False, return_objs=False):
"""
Get all tags in this handler, regardless of category.
Args:
return_key_and_category (bool, optional): Return a list of
tuples `[(key, category), ...]`.
return_objs (bool, optional): Return tag objects.
Returns:
tags (list): A list of tag keys `[tagkey, tagkey, ...]` or
a list of tuples `[(key, category), ...]` if
`return_key_and_category` is set.
"""
if not self._cache_complete:
self._fullcache()
tags = sorted(self._cache.values())
if return_key_and_category:
# return tuple (key, category)
return [(to_str(tag.db_key), to_str(tag.db_category)) for tag in tags]
elif return_objs:
return tags
else:
return [to_str(tag.db_key) for tag in tags] | [
"def",
"all",
"(",
"self",
",",
"return_key_and_category",
"=",
"False",
",",
"return_objs",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_cache_complete",
":",
"self",
".",
"_fullcache",
"(",
")",
"tags",
"=",
"sorted",
"(",
"self",
".",
"_cache",
".",
"values",
"(",
")",
")",
"if",
"return_key_and_category",
":",
"# return tuple (key, category)",
"return",
"[",
"(",
"to_str",
"(",
"tag",
".",
"db_key",
")",
",",
"to_str",
"(",
"tag",
".",
"db_category",
")",
")",
"for",
"tag",
"in",
"tags",
"]",
"elif",
"return_objs",
":",
"return",
"tags",
"else",
":",
"return",
"[",
"to_str",
"(",
"tag",
".",
"db_key",
")",
"for",
"tag",
"in",
"tags",
"]"
] | [
347,
4
] | [
371,
55
] | python | en | ['en', 'error', 'th'] | False |
TagHandler.batch_add | (self, *args) |
Batch-add tags from a list of tuples.
Args:
tuples (tuple or str): Any number of `tagstr` keys, `(keystr, category)` or
`(keystr, category, data)` tuples.
Notes:
This will generate a mimimal number of self.add calls,
based on the number of categories involved (including
`None`) (data is not unique and may be overwritten by the content
of a latter tuple with the same category).
|
Batch-add tags from a list of tuples. | def batch_add(self, *args):
"""
Batch-add tags from a list of tuples.
Args:
tuples (tuple or str): Any number of `tagstr` keys, `(keystr, category)` or
`(keystr, category, data)` tuples.
Notes:
This will generate a mimimal number of self.add calls,
based on the number of categories involved (including
`None`) (data is not unique and may be overwritten by the content
of a latter tuple with the same category).
"""
keys = defaultdict(list)
data = {}
for tup in args:
tup = make_iter(tup)
nlen = len(tup)
if nlen == 1: # just a key
keys[None].append(tup[0])
elif nlen == 2:
keys[tup[1]].append(tup[0])
else:
keys[tup[1]].append(tup[0])
data[tup[1]] = tup[2] # overwrite previous
for category, key in keys.iteritems():
self.add(tag=key, category=category, data=data.get(category, None)) | [
"def",
"batch_add",
"(",
"self",
",",
"*",
"args",
")",
":",
"keys",
"=",
"defaultdict",
"(",
"list",
")",
"data",
"=",
"{",
"}",
"for",
"tup",
"in",
"args",
":",
"tup",
"=",
"make_iter",
"(",
"tup",
")",
"nlen",
"=",
"len",
"(",
"tup",
")",
"if",
"nlen",
"==",
"1",
":",
"# just a key",
"keys",
"[",
"None",
"]",
".",
"append",
"(",
"tup",
"[",
"0",
"]",
")",
"elif",
"nlen",
"==",
"2",
":",
"keys",
"[",
"tup",
"[",
"1",
"]",
"]",
".",
"append",
"(",
"tup",
"[",
"0",
"]",
")",
"else",
":",
"keys",
"[",
"tup",
"[",
"1",
"]",
"]",
".",
"append",
"(",
"tup",
"[",
"0",
"]",
")",
"data",
"[",
"tup",
"[",
"1",
"]",
"]",
"=",
"tup",
"[",
"2",
"]",
"# overwrite previous",
"for",
"category",
",",
"key",
"in",
"keys",
".",
"iteritems",
"(",
")",
":",
"self",
".",
"add",
"(",
"tag",
"=",
"key",
",",
"category",
"=",
"category",
",",
"data",
"=",
"data",
".",
"get",
"(",
"category",
",",
"None",
")",
")"
] | [
373,
4
] | [
401,
79
] | python | en | ['en', 'error', 'th'] | False |
_migrate_ledger | (data_directory,
old_ledger_file, new_ledger_file,
serializer: MappingSerializer = None) |
Test for the directory, open old and new ledger, migrate data, rename directories
|
Test for the directory, open old and new ledger, migrate data, rename directories
| def _migrate_ledger(data_directory,
old_ledger_file, new_ledger_file,
serializer: MappingSerializer = None):
"""
Test for the directory, open old and new ledger, migrate data, rename directories
"""
# we should have ChunkedFileStorage implementation of the Ledger
if not os.path.isdir(os.path.join(data_directory, old_ledger_file)):
msg = 'Could not find directory {} for migration.'.format(
old_ledger_file)
logger.error(msg)
raise Exception(msg)
# open the old ledger using the specified serializer
old_ledger_file_backup = old_ledger_file + "_new"
old_txn_log_store = ChunkedFileStore(data_directory,
old_ledger_file_backup,
isLineNoKey=True,
storeContentHash=False)
old_ledger = Ledger(CompactMerkleTree(),
dataDir=data_directory,
txn_serializer=serializer,
hash_serializer=serializer,
fileName=old_ledger_file_backup,
transactionLogStore=old_txn_log_store)
# open the new ledger with new serialization
new_ledger = Ledger(CompactMerkleTree(),
dataDir=data_directory,
fileName=new_ledger_file)
logger.info("new size for {}: {}".format(
old_ledger_file_backup, str(new_ledger.size)))
# add all txns into the old ledger
for _, txn in new_ledger.getAllTxn():
old_ledger.add(txn)
logger.info("old size for {}: {}".format(
new_ledger_file, str(old_ledger.size)))
old_ledger.stop()
new_ledger.stop()
# now that everything succeeded, remove the new files and move the old
# files into place
shutil.rmtree(
os.path.join(data_directory, new_ledger_file))
os.rename(
os.path.join(data_directory, old_ledger_file_backup),
os.path.join(data_directory, old_ledger_file)) | [
"def",
"_migrate_ledger",
"(",
"data_directory",
",",
"old_ledger_file",
",",
"new_ledger_file",
",",
"serializer",
":",
"MappingSerializer",
"=",
"None",
")",
":",
"# we should have ChunkedFileStorage implementation of the Ledger",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_directory",
",",
"old_ledger_file",
")",
")",
":",
"msg",
"=",
"'Could not find directory {} for migration.'",
".",
"format",
"(",
"old_ledger_file",
")",
"logger",
".",
"error",
"(",
"msg",
")",
"raise",
"Exception",
"(",
"msg",
")",
"# open the old ledger using the specified serializer",
"old_ledger_file_backup",
"=",
"old_ledger_file",
"+",
"\"_new\"",
"old_txn_log_store",
"=",
"ChunkedFileStore",
"(",
"data_directory",
",",
"old_ledger_file_backup",
",",
"isLineNoKey",
"=",
"True",
",",
"storeContentHash",
"=",
"False",
")",
"old_ledger",
"=",
"Ledger",
"(",
"CompactMerkleTree",
"(",
")",
",",
"dataDir",
"=",
"data_directory",
",",
"txn_serializer",
"=",
"serializer",
",",
"hash_serializer",
"=",
"serializer",
",",
"fileName",
"=",
"old_ledger_file_backup",
",",
"transactionLogStore",
"=",
"old_txn_log_store",
")",
"# open the new ledger with new serialization",
"new_ledger",
"=",
"Ledger",
"(",
"CompactMerkleTree",
"(",
")",
",",
"dataDir",
"=",
"data_directory",
",",
"fileName",
"=",
"new_ledger_file",
")",
"logger",
".",
"info",
"(",
"\"new size for {}: {}\"",
".",
"format",
"(",
"old_ledger_file_backup",
",",
"str",
"(",
"new_ledger",
".",
"size",
")",
")",
")",
"# add all txns into the old ledger",
"for",
"_",
",",
"txn",
"in",
"new_ledger",
".",
"getAllTxn",
"(",
")",
":",
"old_ledger",
".",
"add",
"(",
"txn",
")",
"logger",
".",
"info",
"(",
"\"old size for {}: {}\"",
".",
"format",
"(",
"new_ledger_file",
",",
"str",
"(",
"old_ledger",
".",
"size",
")",
")",
")",
"old_ledger",
".",
"stop",
"(",
")",
"new_ledger",
".",
"stop",
"(",
")",
"# now that everything succeeded, remove the new files and move the old",
"# files into place",
"shutil",
".",
"rmtree",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_directory",
",",
"new_ledger_file",
")",
")",
"os",
".",
"rename",
"(",
"os",
".",
"path",
".",
"join",
"(",
"data_directory",
",",
"old_ledger_file_backup",
")",
",",
"os",
".",
"path",
".",
"join",
"(",
"data_directory",
",",
"old_ledger_file",
")",
")"
] | [
22,
0
] | [
71,
54
] | python | en | ['en', 'error', 'th'] | False |
Solution.rotate | (self, nums: List[int], k: int) |
Do not return anything, modify nums in-place instead.
|
Do not return anything, modify nums in-place instead.
| def rotate(self, nums: List[int], k: int) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
nums.reverse()
nums[:k] = reversed(nums[:k])
nums[k:] = reversed(nums[k:])
return nums | [
"def",
"rotate",
"(",
"self",
",",
"nums",
":",
"List",
"[",
"int",
"]",
",",
"k",
":",
"int",
")",
"->",
"None",
":",
"nums",
".",
"reverse",
"(",
")",
"nums",
"[",
":",
"k",
"]",
"=",
"reversed",
"(",
"nums",
"[",
":",
"k",
"]",
")",
"nums",
"[",
"k",
":",
"]",
"=",
"reversed",
"(",
"nums",
"[",
"k",
":",
"]",
")",
"return",
"nums"
] | [
1,
4
] | [
8,
19
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.align | (self) |
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
|
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above | def align(self):
"""
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["align"] | [
"def",
"align",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"align\"",
"]"
] | [
25,
4
] | [
40,
28
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.alignsrc | (self) |
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"] | [
"def",
"alignsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"alignsrc\"",
"]"
] | [
49,
4
] | [
60,
31
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bgcolor"] | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
69,
4
] | [
120,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"] | [
"def",
"bgcolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolorsrc\"",
"]"
] | [
129,
4
] | [
140,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bordercolor"] | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
149,
4
] | [
200,
34
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bordercolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for
bordercolor .
The 'bordercolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bordercolorsrc"] | [
"def",
"bordercolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolorsrc\"",
"]"
] | [
209,
4
] | [
221,
37
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.font | (self) |
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.densitymapbox.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
Returns
-------
plotly.graph_objs.densitymapbox.hoverlabel.Font
|
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.densitymapbox.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size . | def font(self):
"""
Sets the font used in hover labels.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.densitymapbox.hoverlabel.Font`
- A dict of string/value properties that will be passed
to the Font constructor
Supported dict properties:
color
colorsrc
Sets the source reference on Chart Studio Cloud
for color .
family
HTML font family - the typeface that will be
applied by the web browser. The web browser
will only be able to apply a font if it is
available on the system which it operates.
Provide multiple font families, separated by
commas, to indicate the preference in which to
apply fonts if they aren't available on the
system. The Chart Studio Cloud (at
https://chart-studio.plotly.com or on-premise)
generates images on a server, where only a
select number of fonts are installed and
supported. These include "Arial", "Balto",
"Courier New", "Droid Sans",, "Droid Serif",
"Droid Sans Mono", "Gravitas One", "Old
Standard TT", "Open Sans", "Overpass", "PT Sans
Narrow", "Raleway", "Times New Roman".
familysrc
Sets the source reference on Chart Studio Cloud
for family .
size
sizesrc
Sets the source reference on Chart Studio Cloud
for size .
Returns
-------
plotly.graph_objs.densitymapbox.hoverlabel.Font
"""
return self["font"] | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
230,
4
] | [
277,
27
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelength | (self) |
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|numpy.ndarray
|
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above | def namelength(self):
"""
Sets the default length (in number of characters) of the trace
name in the hover labels for all traces. -1 shows the whole
name regardless of length. 0-3 shows the first 0-3 characters,
and an integer >3 will show the whole name if it is less than
that many characters, but if it is longer, will truncate to
`namelength - 3` characters and add an ellipsis.
The 'namelength' property is a integer and may be specified as:
- An int (or float that will be cast to an int)
in the interval [-1, 9223372036854775807]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|numpy.ndarray
"""
return self["namelength"] | [
"def",
"namelength",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelength\"",
"]"
] | [
286,
4
] | [
304,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.namelengthsrc | (self) |
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def namelengthsrc(self):
"""
Sets the source reference on Chart Studio Cloud for namelength
.
The 'namelengthsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["namelengthsrc"] | [
"def",
"namelengthsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"namelengthsrc\"",
"]"
] | [
313,
4
] | [
325,
36
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.__init__ | (
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
) |
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.densitymapbox.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
Returns
-------
Hoverlabel
|
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.densitymapbox.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength . | def __init__(
self,
arg=None,
align=None,
alignsrc=None,
bgcolor=None,
bgcolorsrc=None,
bordercolor=None,
bordercolorsrc=None,
font=None,
namelength=None,
namelengthsrc=None,
**kwargs
):
"""
Construct a new Hoverlabel object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.densitymapbox.Hoverlabel`
align
Sets the horizontal alignment of the text content
within hover label box. Has an effect only if the hover
label text spans more two or more lines
alignsrc
Sets the source reference on Chart Studio Cloud for
align .
bgcolor
Sets the background color of the hover labels for this
trace
bgcolorsrc
Sets the source reference on Chart Studio Cloud for
bgcolor .
bordercolor
Sets the border color of the hover labels for this
trace.
bordercolorsrc
Sets the source reference on Chart Studio Cloud for
bordercolor .
font
Sets the font used in hover labels.
namelength
Sets the default length (in number of characters) of
the trace name in the hover labels for all traces. -1
shows the whole name regardless of length. 0-3 shows
the first 0-3 characters, and an integer >3 will show
the whole name if it is less than that many characters,
but if it is longer, will truncate to `namelength - 3`
characters and add an ellipsis.
namelengthsrc
Sets the source reference on Chart Studio Cloud for
namelength .
Returns
-------
Hoverlabel
"""
super(Hoverlabel, self).__init__("hoverlabel")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.densitymapbox.Hoverlabel
constructor must be a dict or
an instance of :class:`plotly.graph_objs.densitymapbox.Hoverlabel`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("align", None)
_v = align if align is not None else _v
if _v is not None:
self["align"] = _v
_v = arg.pop("alignsrc", None)
_v = alignsrc if alignsrc is not None else _v
if _v is not None:
self["alignsrc"] = _v
_v = arg.pop("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _v
_v = arg.pop("bgcolorsrc", None)
_v = bgcolorsrc if bgcolorsrc is not None else _v
if _v is not None:
self["bgcolorsrc"] = _v
_v = arg.pop("bordercolor", None)
_v = bordercolor if bordercolor is not None else _v
if _v is not None:
self["bordercolor"] = _v
_v = arg.pop("bordercolorsrc", None)
_v = bordercolorsrc if bordercolorsrc is not None else _v
if _v is not None:
self["bordercolorsrc"] = _v
_v = arg.pop("font", None)
_v = font if font is not None else _v
if _v is not None:
self["font"] = _v
_v = arg.pop("namelength", None)
_v = namelength if namelength is not None else _v
if _v is not None:
self["namelength"] = _v
_v = arg.pop("namelengthsrc", None)
_v = namelengthsrc if namelengthsrc is not None else _v
if _v is not None:
self["namelengthsrc"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"align",
"=",
"None",
",",
"alignsrc",
"=",
"None",
",",
"bgcolor",
"=",
"None",
",",
"bgcolorsrc",
"=",
"None",
",",
"bordercolor",
"=",
"None",
",",
"bordercolorsrc",
"=",
"None",
",",
"font",
"=",
"None",
",",
"namelength",
"=",
"None",
",",
"namelengthsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Hoverlabel",
",",
"self",
")",
".",
"__init__",
"(",
"\"hoverlabel\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"self",
".",
"_parent",
"=",
"kwargs",
"[",
"\"_parent\"",
"]",
"return",
"# Validate arg",
"# ------------",
"if",
"arg",
"is",
"None",
":",
"arg",
"=",
"{",
"}",
"elif",
"isinstance",
"(",
"arg",
",",
"self",
".",
"__class__",
")",
":",
"arg",
"=",
"arg",
".",
"to_plotly_json",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"dict",
")",
":",
"arg",
"=",
"_copy",
".",
"copy",
"(",
"arg",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"\"\"\\\nThe first argument to the plotly.graph_objs.densitymapbox.Hoverlabel \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.densitymapbox.Hoverlabel`\"\"\"",
")",
"# Handle skip_invalid",
"# -------------------",
"self",
".",
"_skip_invalid",
"=",
"kwargs",
".",
"pop",
"(",
"\"skip_invalid\"",
",",
"False",
")",
"self",
".",
"_validate",
"=",
"kwargs",
".",
"pop",
"(",
"\"_validate\"",
",",
"True",
")",
"# Populate data dict with properties",
"# ----------------------------------",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"align\"",
",",
"None",
")",
"_v",
"=",
"align",
"if",
"align",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"align\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"alignsrc\"",
",",
"None",
")",
"_v",
"=",
"alignsrc",
"if",
"alignsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"alignsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bgcolor\"",
",",
"None",
")",
"_v",
"=",
"bgcolor",
"if",
"bgcolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bgcolorsrc\"",
",",
"None",
")",
"_v",
"=",
"bgcolorsrc",
"if",
"bgcolorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bgcolorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bordercolor\"",
",",
"None",
")",
"_v",
"=",
"bordercolor",
"if",
"bordercolor",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bordercolor\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"bordercolorsrc\"",
",",
"None",
")",
"_v",
"=",
"bordercolorsrc",
"if",
"bordercolorsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"bordercolorsrc\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"font\"",
",",
"None",
")",
"_v",
"=",
"font",
"if",
"font",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"font\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"namelength\"",
",",
"None",
")",
"_v",
"=",
"namelength",
"if",
"namelength",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"namelength\"",
"]",
"=",
"_v",
"_v",
"=",
"arg",
".",
"pop",
"(",
"\"namelengthsrc\"",
",",
"None",
")",
"_v",
"=",
"namelengthsrc",
"if",
"namelengthsrc",
"is",
"not",
"None",
"else",
"_v",
"if",
"_v",
"is",
"not",
"None",
":",
"self",
"[",
"\"namelengthsrc\"",
"]",
"=",
"_v",
"# Process unknown kwargs",
"# ----------------------",
"self",
".",
"_process_kwargs",
"(",
"*",
"*",
"dict",
"(",
"arg",
",",
"*",
"*",
"kwargs",
")",
")",
"# Reset skip_invalid",
"# ------------------",
"self",
".",
"_skip_invalid",
"=",
"False"
] | [
370,
4
] | [
502,
34
] | python | en | ['en', 'error', 'th'] | False |
ReadFile | (filename, print_error=True) | Returns the contents of a file. | Returns the contents of a file. | def ReadFile(filename, print_error=True):
"""Returns the contents of a file."""
try:
fp = open(filename)
try:
return fp.read()
finally:
fp.close()
except IOError:
if print_error:
print('Error reading %s: %s' % (filename, sys.exc_info()[1]))
return None | [
"def",
"ReadFile",
"(",
"filename",
",",
"print_error",
"=",
"True",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"filename",
")",
"try",
":",
"return",
"fp",
".",
"read",
"(",
")",
"finally",
":",
"fp",
".",
"close",
"(",
")",
"except",
"IOError",
":",
"if",
"print_error",
":",
"print",
"(",
"'Error reading %s: %s'",
"%",
"(",
"filename",
",",
"sys",
".",
"exc_info",
"(",
")",
"[",
"1",
"]",
")",
")",
"return",
"None"
] | [
29,
0
] | [
40,
19
] | python | en | ['en', 'en', 'en'] | True |
Hoverlabel.align | (self) |
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
|
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above | def align(self):
"""
Sets the horizontal alignment of the text content within hover
label box. Has an effect only if the hover label text spans
more two or more lines
The 'align' property is an enumeration that may be specified as:
- One of the following enumeration values:
['left', 'right', 'auto']
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
Any|numpy.ndarray
"""
return self["align"] | [
"def",
"align",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"align\"",
"]"
] | [
25,
4
] | [
40,
28
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.alignsrc | (self) |
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def alignsrc(self):
"""
Sets the source reference on Chart Studio Cloud for align .
The 'alignsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["alignsrc"] | [
"def",
"alignsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"alignsrc\"",
"]"
] | [
49,
4
] | [
60,
31
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolor | (self) |
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bgcolor(self):
"""
Sets the background color of the hover labels for this trace
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bgcolor"] | [
"def",
"bgcolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolor\"",
"]"
] | [
69,
4
] | [
120,
30
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bgcolorsrc | (self) |
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def bgcolorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for bgcolor .
The 'bgcolorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["bgcolorsrc"] | [
"def",
"bgcolorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bgcolorsrc\"",
"]"
] | [
129,
4
] | [
140,
33
] | python | en | ['en', 'error', 'th'] | False |
Hoverlabel.bordercolor | (self) |
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
|
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above | def bordercolor(self):
"""
Sets the border color of the hover labels for this trace.
The 'bordercolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
- A list or array of any of the above
Returns
-------
str|numpy.ndarray
"""
return self["bordercolor"] | [
"def",
"bordercolor",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"bordercolor\"",
"]"
] | [
149,
4
] | [
200,
34
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.