Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
Marker.opacity | (self) |
Sets the marker opacity. The default value is `1` (fully
opaque). If the markers are not fully opaque and there are
hundreds of thousands of points, it may cause slower zooming
and panning. Opacity fades the color even if `blend` is left on
`false` even if there is no translucen... |
Sets the marker opacity. The default value is `1` (fully
opaque). If the markers are not fully opaque and there are
hundreds of thousands of points, it may cause slower zooming
and panning. Opacity fades the color even if `blend` is left on
`false` even if there is no translucen... | def opacity(self):
"""
Sets the marker opacity. The default value is `1` (fully
opaque). If the markers are not fully opaque and there are
hundreds of thousands of points, it may cause slower zooming
and panning. Opacity fades the color even if `blend` is left on
`false` ... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
131,
4
] | [
146,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.sizemax | (self) |
Sets the maximum size (in px) of the rendered marker points.
Effective when the `pointcloud` shows only few points.
The 'sizemax' property is a number and may be specified as:
- An int or float in the interval [0.1, inf]
Returns
-------
int|float
|
Sets the maximum size (in px) of the rendered marker points.
Effective when the `pointcloud` shows only few points.
The 'sizemax' property is a number and may be specified as:
- An int or float in the interval [0.1, inf] | def sizemax(self):
"""
Sets the maximum size (in px) of the rendered marker points.
Effective when the `pointcloud` shows only few points.
The 'sizemax' property is a number and may be specified as:
- An int or float in the interval [0.1, inf]
Returns
----... | [
"def",
"sizemax",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizemax\"",
"]"
] | [
155,
4
] | [
167,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.sizemin | (self) |
Sets the minimum size (in px) of the rendered marker points,
effective when the `pointcloud` shows a million or more points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0.1, 2]
Returns
-------
int|float
... |
Sets the minimum size (in px) of the rendered marker points,
effective when the `pointcloud` shows a million or more points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0.1, 2] | def sizemin(self):
"""
Sets the minimum size (in px) of the rendered marker points,
effective when the `pointcloud` shows a million or more points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0.1, 2]
Returns
... | [
"def",
"sizemin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizemin\"",
"]"
] | [
176,
4
] | [
188,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (
self,
arg=None,
blend=None,
border=None,
color=None,
opacity=None,
sizemax=None,
sizemin=None,
**kwargs
) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.pointcloud.Marker`
blend
Determines if colors are blended together for... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.pointcloud.Marker`
blend
Determines if colors are blended together for... | def __init__(
self,
arg=None,
blend=None,
border=None,
color=None,
opacity=None,
sizemax=None,
sizemin=None,
**kwargs
):
"""
Construct a new Marker object
Parameters
----------
arg
di... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"blend",
"=",
"None",
",",
"border",
"=",
"None",
",",
"color",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"sizemax",
"=",
"None",
",",
"sizemin",
"=",
"None",
",",
"*",
"*",
"kwar... | [
229,
4
] | [
342,
34
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatBlueprint.assert_task_args | (
cls, args: "DictConfig", shared_state: "SharedTaskState"
) |
Ensure that arguments are properly configured to launch this task.
|
Ensure that arguments are properly configured to launch this task.
| def assert_task_args(
cls, args: "DictConfig", shared_state: "SharedTaskState"
) -> None:
"""
Ensure that arguments are properly configured to launch this task.
"""
super().assert_task_args(args, shared_state)
assert (
args.blueprint.get("task_description_... | [
"def",
"assert_task_args",
"(",
"cls",
",",
"args",
":",
"\"DictConfig\"",
",",
"shared_state",
":",
"\"SharedTaskState\"",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"assert_task_args",
"(",
"args",
",",
"shared_state",
")",
"assert",
"(",
"args",
".",... | [
167,
4
] | [
202,
73
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatBlueprint._get_shared_models | (self, args: "DictConfig") |
Return a dictionary whose values are the shared models.
|
Return a dictionary whose values are the shared models.
| def _get_shared_models(self, args: "DictConfig") -> Dict[str, dict]:
"""
Return a dictionary whose values are the shared models.
""" | [
"def",
"_get_shared_models",
"(",
"self",
",",
"args",
":",
"\"DictConfig\"",
")",
"->",
"Dict",
"[",
"str",
",",
"dict",
"]",
":"
] | [
254,
4
] | [
257,
11
] | python | en | ['en', 'error', 'th'] | False |
BaseModelChatBlueprint.get_frontend_args | (self) |
Specifies what options within a task_config should be forwarded to the client
for use by the task's frontend.
|
Specifies what options within a task_config should be forwarded to the client
for use by the task's frontend.
| def get_frontend_args(self) -> Dict[str, Any]:
"""
Specifies what options within a task_config should be forwarded to the client
for use by the task's frontend.
"""
if self.args.blueprint.get('annotations_config_path', '') != '':
with open(
self.args.b... | [
"def",
"get_frontend_args",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":",
"if",
"self",
".",
"args",
".",
"blueprint",
".",
"get",
"(",
"'annotations_config_path'",
",",
"''",
")",
"!=",
"''",
":",
"with",
"open",
"(",
"self",
"."... | [
259,
4
] | [
283,
9
] | python | en | ['en', 'error', 'th'] | False |
Stream.maxpoints | (self) |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000]... |
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or float in the interval [0, 10000] | def maxpoints(self):
"""
Sets the maximum number of points to keep on the plots from an
incoming stream. If `maxpoints` is set to 50, only the newest
50 points will be displayed on the plot.
The 'maxpoints' property is a number and may be specified as:
- An int or ... | [
"def",
"maxpoints",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxpoints\"",
"]"
] | [
15,
4
] | [
28,
32
] | python | en | ['en', 'error', 'th'] | False |
Stream.token | (self) |
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
str
|
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string | def token(self):
"""
The stream id number links a data trace on a plot with a
stream. See https://chart-studio.plotly.com/settings for more
details.
The 'token' property is a string and must be specified as:
- A non-empty string
Returns
-------
... | [
"def",
"token",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"token\"",
"]"
] | [
37,
4
] | [
50,
28
] | python | en | ['en', 'error', 'th'] | False |
Stream.__init__ | (self, arg=None, maxpoints=None, token=None, **kwargs) |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterternary.Stream`
maxpoints
Sets the maximum number of points to ... |
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterternary.Stream`
maxpoints
Sets the maximum number of points to ... | def __init__(self, arg=None, maxpoints=None, token=None, **kwargs):
"""
Construct a new Stream object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scattertern... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"maxpoints",
"=",
"None",
",",
"token",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Stream",
",",
"self",
")",
".",
"__init__",
"(",
"\"stream\"",
")",
"if",
"\"_paren... | [
72,
4
] | [
140,
34
] | python | en | ['en', 'error', 'th'] | False |
Marker.autocolorscale | (self) |
Determines whether the colorscale is a default palette
(`autocolorscale: true`) or the palette determined by
`marker.colorscale`. Has an effect only if in `marker.color`is
set to a numerical array. In case `colorscale` is unspecified
or `autocolorscale` is true, the default pal... |
Determines whether the colorscale is a default palette
(`autocolorscale: true`) or the palette determined by
`marker.colorscale`. Has an effect only if in `marker.color`is
set to a numerical array. In case `colorscale` is unspecified
or `autocolorscale` is true, the default pal... | def autocolorscale(self):
"""
Determines whether the colorscale is a default palette
(`autocolorscale: true`) or the palette determined by
`marker.colorscale`. Has an effect only if in `marker.color`is
set to a numerical array. In case `colorscale` is unspecified
or `auto... | [
"def",
"autocolorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"autocolorscale\"",
"]"
] | [
40,
4
] | [
57,
37
] | python | en | ['en', 'error', 'th'] | False |
Marker.cauto | (self) |
Determines whether or not the color domain is computed with
respect to the input data (here in `marker.color`) or the
bounds set in `marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical array. Defaults
to `false` when `marker.cmin` and `ma... |
Determines whether or not the color domain is computed with
respect to the input data (here in `marker.color`) or the
bounds set in `marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical array. Defaults
to `false` when `marker.cmin` and `ma... | def cauto(self):
"""
Determines whether or not the color domain is computed with
respect to the input data (here in `marker.color`) or the
bounds set in `marker.cmin` and `marker.cmax` Has an effect
only if in `marker.color`is set to a numerical array. Defaults
to `false... | [
"def",
"cauto",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cauto\"",
"]"
] | [
66,
4
] | [
82,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmax | (self) |
Sets the upper bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmin`
must be set as well.
The 'cmax' property is a number and may be specified as:
... |
Sets the upper bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmin`
must be set as well.
The 'cmax' property is a number and may be specified as:
... | def cmax(self):
"""
Sets the upper bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmin`
must be set as well.
The 'cmax' property is a number and ... | [
"def",
"cmax",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmax\"",
"]"
] | [
91,
4
] | [
105,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmid | (self) |
Sets the mid-point of the color domain by scaling `marker.cmin`
and/or `marker.cmax` to be equidistant to this point. Has an
effect only if in `marker.color`is set to a numerical array.
Value should have the same units as in `marker.color`. Has no
effect when `marker.cauto` is `... |
Sets the mid-point of the color domain by scaling `marker.cmin`
and/or `marker.cmax` to be equidistant to this point. Has an
effect only if in `marker.color`is set to a numerical array.
Value should have the same units as in `marker.color`. Has no
effect when `marker.cauto` is `... | def cmid(self):
"""
Sets the mid-point of the color domain by scaling `marker.cmin`
and/or `marker.cmax` to be equidistant to this point. Has an
effect only if in `marker.color`is set to a numerical array.
Value should have the same units as in `marker.color`. Has no
effe... | [
"def",
"cmid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmid\"",
"]"
] | [
114,
4
] | [
129,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.cmin | (self) |
Sets the lower bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmax`
must be set as well.
The 'cmin' property is a number and may be specified as:
... |
Sets the lower bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmax`
must be set as well.
The 'cmin' property is a number and may be specified as:
... | def cmin(self):
"""
Sets the lower bound of the color domain. Has an effect only if
in `marker.color`is set to a numerical array. Value should have
the same units as in `marker.color` and if set, `marker.cmax`
must be set as well.
The 'cmin' property is a number and ... | [
"def",
"cmin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"cmin\"",
"]"
] | [
138,
4
] | [
152,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.color | (self) |
Sets themarkercolor. It accepts either a specific color or an
array of numbers that are mapped to the colorscale relative to
the max and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
The 'color' property is a color and may be specified as:
... |
Sets themarkercolor. It accepts either a specific color or an
array of numbers that are mapped to the colorscale relative to
the max and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
The 'color' property is a color and may be specified as:
... | def color(self):
"""
Sets themarkercolor. It accepts either a specific color or an
array of numbers that are mapped to the colorscale relative to
the max and min values of the array or relative to
`marker.cmin` and `marker.cmax` if set.
The 'color' property is a colo... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
161,
4
] | [
217,
28
] | python | en | ['en', 'error', 'th'] | False |
Marker.coloraxis | (self) |
Sets a reference to a shared color axis. References to these
shared color axes are "coloraxis", "coloraxis2", "coloraxis3",
etc. Settings for these shared color axes are set in the
layout, under `layout.coloraxis`, `layout.coloraxis2`, etc.
Note that multiple color scales can be... |
Sets a reference to a shared color axis. References to these
shared color axes are "coloraxis", "coloraxis2", "coloraxis3",
etc. Settings for these shared color axes are set in the
layout, under `layout.coloraxis`, `layout.coloraxis2`, etc.
Note that multiple color scales can be... | def coloraxis(self):
"""
Sets a reference to a shared color axis. References to these
shared color axes are "coloraxis", "coloraxis2", "coloraxis3",
etc. Settings for these shared color axes are set in the
layout, under `layout.coloraxis`, `layout.coloraxis2`, etc.
Note t... | [
"def",
"coloraxis",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"coloraxis\"",
"]"
] | [
226,
4
] | [
244,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorbar | (self) |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict prope... |
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
Supported dict prope... | def colorbar(self):
"""
The 'colorbar' property is an instance of ColorBar
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.ColorBar`
- A dict of string/value properties that will be passed
to the ColorBar constructor
... | [
"def",
"colorbar",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorbar\"",
"]"
] | [
253,
4
] | [
480,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorscale | (self) |
Sets the colorscale. Has an effect only if in `marker.color`is
set to a numerical array. The colorscale must be an array
containing arrays mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At minimum, a mapping for
the lowest (0) and highest (1) v... |
Sets the colorscale. Has an effect only if in `marker.color`is
set to a numerical array. The colorscale must be an array
containing arrays mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At minimum, a mapping for
the lowest (0) and highest (1) v... | def colorscale(self):
"""
Sets the colorscale. Has an effect only if in `marker.color`is
set to a numerical array. The colorscale must be an array
containing arrays mapping a normalized value to an rgb, rgba,
hex, hsl, hsv, or named color string. At minimum, a mapping for
... | [
"def",
"colorscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorscale\"",
"]"
] | [
489,
4
] | [
533,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.colorsrc | (self) |
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for color .
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | [
542,
4
] | [
553,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.gradient | (self) |
The 'gradient' property is an instance of Gradient
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Gradient`
- A dict of string/value properties that will be passed
to the Gradient constructor
Supported dict prope... |
The 'gradient' property is an instance of Gradient
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Gradient`
- A dict of string/value properties that will be passed
to the Gradient constructor
Supported dict prope... | def gradient(self):
"""
The 'gradient' property is an instance of Gradient
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Gradient`
- A dict of string/value properties that will be passed
to the Gradient constructor
... | [
"def",
"gradient",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"gradient\"",
"]"
] | [
562,
4
] | [
590,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.line | (self) |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... |
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported dict properties:
... | def line(self):
"""
The 'line' property is an instance of Line
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatterpolar.marker.Line`
- A dict of string/value properties that will be passed
to the Line constructor
Supported... | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"line\"",
"]"
] | [
599,
4
] | [
702,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.maxdisplayed | (self) |
Sets a maximum number of points to be drawn on the graph. 0
corresponds to no limit.
The 'maxdisplayed' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
|
Sets a maximum number of points to be drawn on the graph. 0
corresponds to no limit.
The 'maxdisplayed' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def maxdisplayed(self):
"""
Sets a maximum number of points to be drawn on the graph. 0
corresponds to no limit.
The 'maxdisplayed' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
int|float
... | [
"def",
"maxdisplayed",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"maxdisplayed\"",
"]"
] | [
711,
4
] | [
723,
35
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the marker opacity.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
Sets the marker opacity.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above | def opacity(self):
"""
Sets the marker opacity.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndar... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
732,
4
] | [
744,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacitysrc | (self) |
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
|
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def opacitysrc(self):
"""
Sets the source reference on Chart Studio Cloud for opacity .
The 'opacitysrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["opacitysrc"] | [
"def",
"opacitysrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacitysrc\"",
"]"
] | [
753,
4
] | [
764,
33
] | python | en | ['en', 'error', 'th'] | False |
Marker.reversescale | (self) |
Reverses the color mapping if true. Has an effect only if in
`marker.color`is set to a numerical array. If true,
`marker.cmin` will correspond to the last color in the array
and `marker.cmax` will correspond to the first color.
The 'reversescale' property must be specified ... |
Reverses the color mapping if true. Has an effect only if in
`marker.color`is set to a numerical array. If true,
`marker.cmin` will correspond to the last color in the array
and `marker.cmax` will correspond to the first color.
The 'reversescale' property must be specified ... | def reversescale(self):
"""
Reverses the color mapping if true. Has an effect only if in
`marker.color`is set to a numerical array. If true,
`marker.cmin` will correspond to the last color in the array
and `marker.cmax` will correspond to the first color.
The 'revers... | [
"def",
"reversescale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"reversescale\"",
"]"
] | [
773,
4
] | [
787,
35
] | python | en | ['en', 'error', 'th'] | False |
Marker.showscale | (self) |
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False) | def showscale(self):
"""
Determines whether or not a colorbar is displayed for this
trace. Has an effect only if in `marker.color`is set to a
numerical array.
The 'showscale' property must be specified as a bool
(either True, or False)
Returns
------... | [
"def",
"showscale",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"showscale\"",
"]"
] | [
796,
4
] | [
809,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.size | (self) |
Sets the marker size (in px).
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.ndarray
|
Sets the marker size (in px).
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-dimensional numpy array of the above | def size(self):
"""
Sets the marker size (in px).
The 'size' property is a number and may be specified as:
- An int or float in the interval [0, inf]
- A tuple, list, or one-dimensional numpy array of the above
Returns
-------
int|float|numpy.nda... | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | [
818,
4
] | [
830,
27
] | python | en | ['en', 'error', 'th'] | False |
Marker.sizemin | (self) |
Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Returns
-------
in... |
Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf] | def sizemin(self):
"""
Has an effect only if `marker.size` is set to a numerical
array. Sets the minimum size (in px) of the rendered marker
points.
The 'sizemin' property is a number and may be specified as:
- An int or float in the interval [0, inf]
Retu... | [
"def",
"sizemin",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizemin\"",
"]"
] | [
839,
4
] | [
852,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.sizemode | (self) |
Has an effect only if `marker.size` is set to a numerical
array. Sets the rule for which the data in `size` is converted
to pixels.
The 'sizemode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['diameter', ... |
Has an effect only if `marker.size` is set to a numerical
array. Sets the rule for which the data in `size` is converted
to pixels.
The 'sizemode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['diameter', ... | def sizemode(self):
"""
Has an effect only if `marker.size` is set to a numerical
array. Sets the rule for which the data in `size` is converted
to pixels.
The 'sizemode' property is an enumeration that may be specified as:
- One of the following enumeration values... | [
"def",
"sizemode",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizemode\"",
"]"
] | [
861,
4
] | [
875,
31
] | python | en | ['en', 'error', 'th'] | False |
Marker.sizeref | (self) |
Has an effect only if `marker.size` is set to a numerical
array. Sets the scale factor used to determine the rendered
size of marker points. Use with `sizemin` and `sizemode`.
The 'sizeref' property is a number and may be specified as:
- An int or float
Returns
... |
Has an effect only if `marker.size` is set to a numerical
array. Sets the scale factor used to determine the rendered
size of marker points. Use with `sizemin` and `sizemode`.
The 'sizeref' property is a number and may be specified as:
- An int or float | def sizeref(self):
"""
Has an effect only if `marker.size` is set to a numerical
array. Sets the scale factor used to determine the rendered
size of marker points. Use with `sizemin` and `sizemode`.
The 'sizeref' property is a number and may be specified as:
- An i... | [
"def",
"sizeref",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"sizeref\"",
"]"
] | [
884,
4
] | [
897,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.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\"",
"]"
] | [
906,
4
] | [
917,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.symbol | (self) |
Sets the marker symbol type. Adding 100 is equivalent to
appending "-open" to a symbol name. Adding 200 is equivalent to
appending "-dot" to a symbol name. Adding 300 is equivalent to
appending "-open-dot" or "dot-open" to a symbol name.
The 'symbol' property is an enumerat... |
Sets the marker symbol type. Adding 100 is equivalent to
appending "-open" to a symbol name. Adding 200 is equivalent to
appending "-dot" to a symbol name. Adding 300 is equivalent to
appending "-open-dot" or "dot-open" to a symbol name.
The 'symbol' property is an enumerat... | def symbol(self):
"""
Sets the marker symbol type. Adding 100 is equivalent to
appending "-open" to a symbol name. Adding 200 is equivalent to
appending "-dot" to a symbol name. Adding 300 is equivalent to
appending "-open-dot" or "dot-open" to a symbol name.
The 'sy... | [
"def",
"symbol",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"symbol\"",
"]"
] | [
926,
4
] | [
1002,
29
] | python | en | ['en', 'error', 'th'] | False |
Marker.symbolsrc | (self) |
Sets the source reference on Chart Studio Cloud for symbol .
The 'symbolsrc' 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 symbol .
The 'symbolsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | def symbolsrc(self):
"""
Sets the source reference on Chart Studio Cloud for symbol .
The 'symbolsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["symbolsrc"] | [
"def",
"symbolsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"symbolsrc\"",
"]"
] | [
1011,
4
] | [
1022,
32
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
gradient=None,
line=None,
maxdisplayed=No... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolar.Marker`
autocolorscale
Determines whether the colorscale ... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.scatterpolar.Marker`
autocolorscale
Determines whether the colorscale ... | def __init__(
self,
arg=None,
autocolorscale=None,
cauto=None,
cmax=None,
cmid=None,
cmin=None,
color=None,
coloraxis=None,
colorbar=None,
colorscale=None,
colorsrc=None,
gradient=None,
line=None,
max... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"autocolorscale",
"=",
"None",
",",
"cauto",
"=",
"None",
",",
"cmax",
"=",
"None",
",",
"cmid",
"=",
"None",
",",
"cmin",
"=",
"None",
",",
"color",
"=",
"None",
",",
"coloraxis",
"=",
... | [
1152,
4
] | [
1444,
34
] | python | en | ['en', 'error', 'th'] | False |
Seq2SeqModel.get_batch | (self, data, decoding=False) |
:param data:
:param decoding: set this parameter to True to output dummy
data for the decoder side (using the maximum output size)
:return:
|
:param data:
:param decoding: set this parameter to True to output dummy
data for the decoder side (using the maximum output size)
:return:
| def get_batch(self, data, decoding=False):
"""
:param data:
:param decoding: set this parameter to True to output dummy
data for the decoder side (using the maximum output size)
:return:
"""
inputs = [[] for _ in self.encoders]
targets = [[] for _ in sel... | [
"def",
"get_batch",
"(",
"self",
",",
"data",
",",
"decoding",
"=",
"False",
")",
":",
"inputs",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"self",
".",
"encoders",
"]",
"targets",
"=",
"[",
"[",
"]",
"for",
"_",
"in",
"self",
".",
"decoders",
"]",
... | [
274,
4
] | [
334,
44
] | python | en | ['en', 'error', 'th'] | False |
presentation | () |
Template that increases the size of text and markers/lines for certain
trace types
|
Template that increases the size of text and markers/lines for certain
trace types
| def presentation():
"""
Template that increases the size of text and markers/lines for certain
trace types
"""
# Create blank template
template = Template()
template.layout.xaxis.title.standoff = 15
template.layout.yaxis.title.standoff = 15
# Increase global font size by 1.5x (12->... | [
"def",
"presentation",
"(",
")",
":",
"# Create blank template",
"template",
"=",
"Template",
"(",
")",
"template",
".",
"layout",
".",
"xaxis",
".",
"title",
".",
"standoff",
"=",
"15",
"template",
".",
"layout",
".",
"yaxis",
".",
"title",
".",
"standoff... | [
592,
0
] | [
622,
19
] | python | en | ['en', 'error', 'th'] | False |
xgridoff | () |
Template to disable x-grid by default
|
Template to disable x-grid by default
| def xgridoff():
"""
Template to disable x-grid by default
"""
# Create blank template
template = Template()
template.layout.xaxis.showgrid = False
template.layout.xaxis.title.standoff = 15
template.layout.yaxis.title.standoff = 15
# Automargin for pie chart
template.data.pie = [... | [
"def",
"xgridoff",
"(",
")",
":",
"# Create blank template",
"template",
"=",
"Template",
"(",
")",
"template",
".",
"layout",
".",
"xaxis",
".",
"showgrid",
"=",
"False",
"template",
".",
"layout",
".",
"xaxis",
".",
"title",
".",
"standoff",
"=",
"15",
... | [
628,
0
] | [
641,
19
] | python | en | ['en', 'error', 'th'] | False |
ygridoff | () |
Template to disable y-grid by default
|
Template to disable y-grid by default
| def ygridoff():
"""
Template to disable y-grid by default
"""
# Create blank template
template = Template()
template.layout.yaxis.showgrid = False
# Automargin for pie chart
template.data.pie = [{"automargin": True}]
return template | [
"def",
"ygridoff",
"(",
")",
":",
"# Create blank template",
"template",
"=",
"Template",
"(",
")",
"template",
".",
"layout",
".",
"yaxis",
".",
"showgrid",
"=",
"False",
"# Automargin for pie chart",
"template",
".",
"data",
".",
"pie",
"=",
"[",
"{",
"\"a... | [
647,
0
] | [
658,
19
] | python | en | ['en', 'error', 'th'] | False |
gridon | () |
Template to enable x and y-grid by default
|
Template to enable x and y-grid by default
| def gridon():
"""
Template to enable x and y-grid by default
"""
# Create blank template
template = Template()
template.layout.xaxis.showgrid = True
template.layout.xaxis.title.standoff = 15
template.layout.yaxis.showgrid = True
template.layout.yaxis.title.standoff = 15
# Automa... | [
"def",
"gridon",
"(",
")",
":",
"# Create blank template",
"template",
"=",
"Template",
"(",
")",
"template",
".",
"layout",
".",
"xaxis",
".",
"showgrid",
"=",
"True",
"template",
".",
"layout",
".",
"xaxis",
".",
"title",
".",
"standoff",
"=",
"15",
"t... | [
664,
0
] | [
678,
19
] | python | en | ['en', 'error', 'th'] | False |
TestUpdateMethod.test_update_uninitialized_list_with_list | (self) |
If the original list is undefined, the updated list should be
accepted in full.
See GH1072
|
If the original list is undefined, the updated list should be
accepted in full. | def test_update_uninitialized_list_with_list(self):
"""
If the original list is undefined, the updated list should be
accepted in full.
See GH1072
"""
layout = go.Layout()
layout.update(
annotations=[
go.layout.Annotation(text="one"),
... | [
"def",
"test_update_uninitialized_list_with_list",
"(",
"self",
")",
":",
"layout",
"=",
"go",
".",
"Layout",
"(",
")",
"layout",
".",
"update",
"(",
"annotations",
"=",
"[",
"go",
".",
"layout",
".",
"Annotation",
"(",
"text",
"=",
"\"one\"",
")",
",",
... | [
69,
4
] | [
87,
59
] | python | en | ['en', 'error', 'th'] | False |
TestUpdateMethod.test_update_initialized_empty_list_with_list | (self) |
If the original list is empty, treat is just as if it's undefined.
This is a change in behavior from version 2
(where the input list would just be completly ignored), because
in version 3 the difference between an uninitialized and empty list
is not obvious to the user.
|
If the original list is empty, treat is just as if it's undefined.
This is a change in behavior from version 2
(where the input list would just be completly ignored), because
in version 3 the difference between an uninitialized and empty list
is not obvious to the user.
| def test_update_initialized_empty_list_with_list(self):
"""
If the original list is empty, treat is just as if it's undefined.
This is a change in behavior from version 2
(where the input list would just be completly ignored), because
in version 3 the difference between an uninit... | [
"def",
"test_update_initialized_empty_list_with_list",
"(",
"self",
")",
":",
"layout",
"=",
"go",
".",
"Layout",
"(",
"annotations",
"=",
"[",
"]",
")",
"layout",
".",
"update",
"(",
"annotations",
"=",
"[",
"go",
".",
"layout",
".",
"Annotation",
"(",
"t... | [
89,
4
] | [
108,
59
] | python | en | ['en', 'error', 'th'] | False |
TestUpdateMethod.test_update_initialized_nonempty_list_with_dict | (self) |
If the original list is defined, a dict from
index numbers to property dicts may be used to update select
elements of the existing list
|
If the original list is defined, a dict from
index numbers to property dicts may be used to update select
elements of the existing list
| def test_update_initialized_nonempty_list_with_dict(self):
"""
If the original list is defined, a dict from
index numbers to property dicts may be used to update select
elements of the existing list
"""
layout = go.Layout(
annotations=[
go.layo... | [
"def",
"test_update_initialized_nonempty_list_with_dict",
"(",
"self",
")",
":",
"layout",
"=",
"go",
".",
"Layout",
"(",
"annotations",
"=",
"[",
"go",
".",
"layout",
".",
"Annotation",
"(",
"text",
"=",
"\"one\"",
")",
",",
"go",
".",
"layout",
".",
"Ann... | [
110,
4
] | [
128,
59
] | python | en | ['en', 'error', 'th'] | False |
main | (opt) |
Converts a Fbdialog file of episodes into two self-feeding files (split by topic)
All conversations including a word in the provided topic's bag of words will be
separated from conversations without those words.
|
Converts a Fbdialog file of episodes into two self-feeding files (split by topic) | def main(opt):
"""
Converts a Fbdialog file of episodes into two self-feeding files (split by topic)
All conversations including a word in the provided topic's bag of words will be
separated from conversations without those words.
"""
on_topic_exs = []
off_topic_exs = []
num_episodes = ... | [
"def",
"main",
"(",
"opt",
")",
":",
"on_topic_exs",
"=",
"[",
"]",
"off_topic_exs",
"=",
"[",
"]",
"num_episodes",
"=",
"0",
"for",
"episode",
"in",
"extract_fb_episodes",
"(",
"opt",
"[",
"'infile'",
"]",
")",
":",
"num_episodes",
"+=",
"1",
"if",
"o... | [
115,
0
] | [
161,
58
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.dtickrange | (self) |
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The... |
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The... | def dtickrange(self):
"""
range [*min*, *max*], where "min", "max" - dtick values which
describe some zoom level, it is possible to omit "min" or "max"
value by passing "null"
The 'dtickrange' property is an info array that may be specified as:
* a list or tuple... | [
"def",
"dtickrange",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"dtickrange\"",
"]"
] | [
15,
4
] | [
31,
33
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.enabled | (self) |
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
|
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False) | def enabled(self):
"""
Determines whether or not this stop is used. If `false`, this
stop is ignored even within its `dtickrange`.
The 'enabled' property must be specified as a bool
(either True, or False)
Returns
-------
bool
"""
ret... | [
"def",
"enabled",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"enabled\"",
"]"
] | [
40,
4
] | [
52,
30
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.name | (self) |
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications ... |
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` alongside your modifications ... | def name(self):
"""
When used in a template, named items are created in the output
figure in addition to any items the figure already has in this
array. You can modify these items in the output figure by
making your own item with `templateitemname` matching this
`name` al... | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"name\"",
"]"
] | [
61,
4
] | [
79,
27
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.templateitemname | (self) |
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (includ... |
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
alongside your modifications (includ... | def templateitemname(self):
"""
Used to refer to a named item in this array in the template.
Named items from the template will be created even without a
matching item in the input figure, but you can modify one by
making an item with `templateitemname` matching its `name`,
... | [
"def",
"templateitemname",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"templateitemname\"",
"]"
] | [
88,
4
] | [
107,
39
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.value | (self) |
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
|
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string | def value(self):
"""
string - dtickformat for described zoom level, the same as
"tickformat"
The 'value' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str
"... | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"value\"",
"]"
] | [
116,
4
] | [
129,
28
] | python | en | ['en', 'error', 'th'] | False |
Tickformatstop.__init__ | (
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
) |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.marker.colorbar.Tickformatstop`
dtickrange
ran... |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatterpolargl
.marker.colorbar.Tickformatstop`
dtickrange
ran... | def __init__(
self,
arg=None,
dtickrange=None,
enabled=None,
name=None,
templateitemname=None,
value=None,
**kwargs
):
"""
Construct a new Tickformatstop object
Parameters
----------
arg
dict... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"dtickrange",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"name",
"=",
"None",
",",
"templateitemname",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"sup... | [
172,
4
] | [
282,
34
] | python | en | ['en', 'error', 'th'] | False |
is_iter | (iterable) |
Checks if an object behaves iterably.
Args:
iterable (any): Entity to check for iterability.
Returns:
is_iterable (bool): If `iterable` is iterable or not.
Notes:
Strings are *not* accepted as iterable (although they are
actually iterable), since string iterations are... |
Checks if an object behaves iterably. | def is_iter(iterable):
"""
Checks if an object behaves iterably.
Args:
iterable (any): Entity to check for iterability.
Returns:
is_iterable (bool): If `iterable` is iterable or not.
Notes:
Strings are *not* accepted as iterable (although they are
actually iterable... | [
"def",
"is_iter",
"(",
"iterable",
")",
":",
"return",
"hasattr",
"(",
"iterable",
",",
"'__iter__'",
")"
] | [
47,
0
] | [
63,
40
] | python | en | ['en', 'error', 'th'] | False |
make_iter | (obj) |
Makes sure that the object is always iterable.
Args:
obj (any): Object to make iterable.
Returns:
iterable (list or iterable): The same object
passed-through or made iterable.
|
Makes sure that the object is always iterable. | def make_iter(obj):
"""
Makes sure that the object is always iterable.
Args:
obj (any): Object to make iterable.
Returns:
iterable (list or iterable): The same object
passed-through or made iterable.
"""
return not hasattr(obj, '__iter__') and [obj] or obj | [
"def",
"make_iter",
"(",
"obj",
")",
":",
"return",
"not",
"hasattr",
"(",
"obj",
",",
"'__iter__'",
")",
"and",
"[",
"obj",
"]",
"or",
"obj"
] | [
66,
0
] | [
78,
56
] | python | en | ['en', 'error', 'th'] | False |
wrap | (text, width=None, indent=0) |
Safely wrap text to a certain number of characters.
Args:
text (str): The text to wrap.
width (int, optional): The number of characters to wrap to.
indent (int): How much to indent each line (with whitespace).
Returns:
text (str): Properly wrapped text.
|
Safely wrap text to a certain number of characters. | def wrap(text, width=None, indent=0):
"""
Safely wrap text to a certain number of characters.
Args:
text (str): The text to wrap.
width (int, optional): The number of characters to wrap to.
indent (int): How much to indent each line (with whitespace).
Returns:
text (str... | [
"def",
"wrap",
"(",
"text",
",",
"width",
"=",
"None",
",",
"indent",
"=",
"0",
")",
":",
"width",
"=",
"width",
"if",
"width",
"else",
"settings",
".",
"CLIENT_DEFAULT_WIDTH",
"if",
"not",
"text",
":",
"return",
"\"\"",
"text",
"=",
"to_unicode",
"(",... | [
81,
0
] | [
99,
94
] | python | en | ['en', 'error', 'th'] | False |
pad | (text, width=None, align="c", fillchar=" ") |
Pads to a given width.
Args:
text (str): Text to pad.
width (int, optional): The width to pad to, in characters.
align (str, optional): This is one of 'c', 'l' or 'r' (center,
left or right).
fillchar (str, optional): The character to fill with.
Returns:
... |
Pads to a given width. | def pad(text, width=None, align="c", fillchar=" "):
"""
Pads to a given width.
Args:
text (str): Text to pad.
width (int, optional): The width to pad to, in characters.
align (str, optional): This is one of 'c', 'l' or 'r' (center,
left or right).
fillchar (str, ... | [
"def",
"pad",
"(",
"text",
",",
"width",
"=",
"None",
",",
"align",
"=",
"\"c\"",
",",
"fillchar",
"=",
"\" \"",
")",
":",
"width",
"=",
"width",
"if",
"width",
"else",
"settings",
".",
"CLIENT_DEFAULT_WIDTH",
"align",
"=",
"align",
"if",
"align",
"in"... | [
106,
0
] | [
129,
43
] | python | en | ['en', 'error', 'th'] | False |
crop | (text, width=None, suffix="[...]") |
Crop text to a certain width, throwing away text from too-long
lines.
Args:
text (str): Text to crop.
width (int, optional): Width of line to crop, in characters.
suffix (str, optional): This is appended to the end of cropped
lines to show that the line actually continu... |
Crop text to a certain width, throwing away text from too-long
lines. | def crop(text, width=None, suffix="[...]"):
"""
Crop text to a certain width, throwing away text from too-long
lines.
Args:
text (str): Text to crop.
width (int, optional): Width of line to crop, in characters.
suffix (str, optional): This is appended to the end of cropped
... | [
"def",
"crop",
"(",
"text",
",",
"width",
"=",
"None",
",",
"suffix",
"=",
"\"[...]\"",
")",
":",
"width",
"=",
"width",
"if",
"width",
"else",
"settings",
".",
"CLIENT_DEFAULT_WIDTH",
"utext",
"=",
"to_unicode",
"(",
"text",
")",
"ltext",
"=",
"len",
... | [
132,
0
] | [
158,
28
] | python | en | ['en', 'error', 'th'] | False |
dedent | (text, baseline_index=None) |
Safely clean all whitespace at the left of a paragraph.
Args:
text (str): The text to dedent.
baseline_index (int or None, optional): Which row to use as a 'base'
for the indentation. Lines will be dedented to this level but
no further. If None, indent so as to complete... |
Safely clean all whitespace at the left of a paragraph. | def dedent(text, baseline_index=None):
"""
Safely clean all whitespace at the left of a paragraph.
Args:
text (str): The text to dedent.
baseline_index (int or None, optional): Which row to use as a 'base'
for the indentation. Lines will be dedented to this level but
... | [
"def",
"dedent",
"(",
"text",
",",
"baseline_index",
"=",
"None",
")",
":",
"if",
"not",
"text",
":",
"return",
"\"\"",
"if",
"baseline_index",
"is",
"None",
":",
"return",
"textwrap",
".",
"dedent",
"(",
"text",
")",
"else",
":",
"lines",
"=",
"text",... | [
161,
0
] | [
190,
43
] | python | en | ['en', 'error', 'th'] | False |
justify | (text, width=None, align="f", indent=0) |
Fully justify a text so that it fits inside `width`. When using
full justification (default) this will be done by padding between
words with extra whitespace where necessary. Paragraphs will
be retained.
Args:
text (str): Text to justify.
width (int, optional): The length of each l... |
Fully justify a text so that it fits inside `width`. When using
full justification (default) this will be done by padding between
words with extra whitespace where necessary. Paragraphs will
be retained. | def justify(text, width=None, align="f", indent=0):
"""
Fully justify a text so that it fits inside `width`. When using
full justification (default) this will be done by padding between
words with extra whitespace where necessary. Paragraphs will
be retained.
Args:
text (str): Text to j... | [
"def",
"justify",
"(",
"text",
",",
"width",
"=",
"None",
",",
"align",
"=",
"\"f\"",
",",
"indent",
"=",
"0",
")",
":",
"width",
"=",
"width",
"if",
"width",
"else",
"settings",
".",
"CLIENT_DEFAULT_WIDTH",
"def",
"_process_line",
"(",
"line",
")",
":... | [
193,
0
] | [
282,
61
] | python | en | ['en', 'error', 'th'] | False |
columnize | (string, columns=2, spacing=4, align='l', width=None) |
Break a string into a number of columns, using as little
vertical space as possible.
Args:
string (str): The string to columnize.
columns (int, optional): The number of columns to use.
spacing (int, optional): How much space to have between columns.
width (int, optional): T... |
Break a string into a number of columns, using as little
vertical space as possible. | def columnize(string, columns=2, spacing=4, align='l', width=None):
"""
Break a string into a number of columns, using as little
vertical space as possible.
Args:
string (str): The string to columnize.
columns (int, optional): The number of columns to use.
spacing (int, optional... | [
"def",
"columnize",
"(",
"string",
",",
"columns",
"=",
"2",
",",
"spacing",
"=",
"4",
",",
"align",
"=",
"'l'",
",",
"width",
"=",
"None",
")",
":",
"columns",
"=",
"max",
"(",
"1",
",",
"columns",
")",
"spacing",
"=",
"max",
"(",
"1",
",",
"s... | [
285,
0
] | [
338,
26
] | python | en | ['en', 'error', 'th'] | False |
list_to_string | (inlist, endsep="and", addquote=False) |
This pretty-formats a list as string output, adding an optional
alternative separator to the second to last entry. If `addquote`
is `True`, the outgoing strings will be surrounded by quotes.
Args:
inlist (list): The list to print.
endsep (str, optional): If set, the last item separato... |
This pretty-formats a list as string output, adding an optional
alternative separator to the second to last entry. If `addquote`
is `True`, the outgoing strings will be surrounded by quotes. | def list_to_string(inlist, endsep="and", addquote=False):
"""
This pretty-formats a list as string output, adding an optional
alternative separator to the second to last entry. If `addquote`
is `True`, the outgoing strings will be surrounded by quotes.
Args:
inlist (list): The list to prin... | [
"def",
"list_to_string",
"(",
"inlist",
",",
"endsep",
"=",
"\"and\"",
",",
"addquote",
"=",
"False",
")",
":",
"if",
"not",
"endsep",
":",
"endsep",
"=",
"\",\"",
"else",
":",
"endsep",
"=",
"\" \"",
"+",
"endsep",
"if",
"not",
"inlist",
":",
"return"... | [
341,
0
] | [
382,
86
] | python | en | ['en', 'error', 'th'] | False |
wildcard_to_regexp | (instring) |
Converts a player-supplied string that may have wildcards in it to
regular expressions. This is useful for name matching.
Args:
instring (string): A string that may potentially contain
wildcards (`*` or `?`).
Returns:
regex (str): A string where wildcards were replaced wit... |
Converts a player-supplied string that may have wildcards in it to
regular expressions. This is useful for name matching. | def wildcard_to_regexp(instring):
"""
Converts a player-supplied string that may have wildcards in it to
regular expressions. This is useful for name matching.
Args:
instring (string): A string that may potentially contain
wildcards (`*` or `?`).
Returns:
regex (str): A... | [
"def",
"wildcard_to_regexp",
"(",
"instring",
")",
":",
"regexp_string",
"=",
"\"\"",
"# If the string starts with an asterisk, we can't impose the beginning of",
"# string (^) limiter.",
"if",
"instring",
"[",
"0",
"]",
"!=",
"\"*\"",
":",
"regexp_string",
"+=",
"\"^\"",
... | [
385,
0
] | [
414,
24
] | python | en | ['en', 'error', 'th'] | False |
time_format | (seconds, style=0) |
Function to return a 'prettified' version of a value in seconds.
Args:
seconds (int): Number if seconds to format.
style (int): One of the following styles:
0. "1d 08:30"
1. "1d"
2. "1 day, 8 hours, 30 minutes"
3. "1 day, 8 hours, 30 minutes, 10 ... |
Function to return a 'prettified' version of a value in seconds. | def time_format(seconds, style=0):
"""
Function to return a 'prettified' version of a value in seconds.
Args:
seconds (int): Number if seconds to format.
style (int): One of the following styles:
0. "1d 08:30"
1. "1d"
2. "1 day, 8 hours, 30 minutes"
... | [
"def",
"time_format",
"(",
"seconds",
",",
"style",
"=",
"0",
")",
":",
"if",
"seconds",
"<",
"0",
":",
"seconds",
"=",
"0",
"else",
":",
"# We'll just use integer math, no need for decimal precision.",
"seconds",
"=",
"int",
"(",
"seconds",
")",
"days",
"=",
... | [
417,
0
] | [
550,
25
] | python | en | ['en', 'error', 'th'] | False |
datetime_format | (dtobj) |
Pretty-prints the time since a given time.
Args:
dtobj (datetime): An datetime object, e.g. from Django's
`DateTimeField`.
Returns:
deltatime (str): A string describing how long ago `dtobj`
took place.
|
Pretty-prints the time since a given time. | def datetime_format(dtobj):
"""
Pretty-prints the time since a given time.
Args:
dtobj (datetime): An datetime object, e.g. from Django's
`DateTimeField`.
Returns:
deltatime (str): A string describing how long ago `dtobj`
took place.
"""
year, month, d... | [
"def",
"datetime_format",
"(",
"dtobj",
")",
":",
"year",
",",
"month",
",",
"day",
"=",
"dtobj",
".",
"year",
",",
"dtobj",
".",
"month",
",",
"dtobj",
".",
"day",
"hour",
",",
"minute",
",",
"second",
"=",
"dtobj",
".",
"hour",
",",
"dtobj",
".",... | [
553,
0
] | [
583,
21
] | python | en | ['en', 'error', 'th'] | False |
host_os_is | (osname) |
Check to see if the host OS matches the query.
Args:
osname (str): Common names are "posix" (linux/unix/mac) and
"nt" (windows).
Args:
is_os (bool): If the os matches or not.
|
Check to see if the host OS matches the query. | def host_os_is(osname):
"""
Check to see if the host OS matches the query.
Args:
osname (str): Common names are "posix" (linux/unix/mac) and
"nt" (windows).
Args:
is_os (bool): If the os matches or not.
"""
return os.name == osname | [
"def",
"host_os_is",
"(",
"osname",
")",
":",
"return",
"os",
".",
"name",
"==",
"osname"
] | [
586,
0
] | [
598,
28
] | python | en | ['en', 'error', 'th'] | False |
get_evennia_version | () |
Helper method for getting the current evennia version.
Returns:
version (str): The version string.
|
Helper method for getting the current evennia version. | def get_evennia_version():
"""
Helper method for getting the current evennia version.
Returns:
version (str): The version string.
"""
import evennia
return evennia.__version__ | [
"def",
"get_evennia_version",
"(",
")",
":",
"import",
"evennia",
"return",
"evennia",
".",
"__version__"
] | [
601,
0
] | [
610,
30
] | python | en | ['en', 'error', 'th'] | False |
pypath_to_realpath | (python_path, file_ending='.py', pypath_prefixes=None) |
Converts a dotted Python path to an absolute path under the
Evennia library directory or under the current game directory.
Args:
python_path (str): A dot-python path
file_ending (str): A file ending, including the period.
pypath_prefixes (list): A list of paths to test for existenc... |
Converts a dotted Python path to an absolute path under the
Evennia library directory or under the current game directory. | def pypath_to_realpath(python_path, file_ending='.py', pypath_prefixes=None):
"""
Converts a dotted Python path to an absolute path under the
Evennia library directory or under the current game directory.
Args:
python_path (str): A dot-python path
file_ending (str): A file ending, inclu... | [
"def",
"pypath_to_realpath",
"(",
"python_path",
",",
"file_ending",
"=",
"'.py'",
",",
"pypath_prefixes",
"=",
"None",
")",
":",
"path",
"=",
"python_path",
".",
"strip",
"(",
")",
".",
"split",
"(",
"'.'",
")",
"plong",
"=",
"osjoin",
"(",
"*",
"path",... | [
613,
0
] | [
658,
59
] | python | en | ['en', 'error', 'th'] | False |
dbref | (inp, reqhash=True) |
Converts/checks if input is a valid dbref.
Args:
inp (int, str): A database ref on the form N or #N.
reqhash (bool, optional): Require the #N form to accept
input as a valid dbref.
Returns:
dbref (int or None): The integer part of the dbref or `None`
if inp... |
Converts/checks if input is a valid dbref. | def dbref(inp, reqhash=True):
"""
Converts/checks if input is a valid dbref.
Args:
inp (int, str): A database ref on the form N or #N.
reqhash (bool, optional): Require the #N form to accept
input as a valid dbref.
Returns:
dbref (int or None): The integer part of t... | [
"def",
"dbref",
"(",
"inp",
",",
"reqhash",
"=",
"True",
")",
":",
"if",
"reqhash",
":",
"num",
"=",
"(",
"int",
"(",
"inp",
".",
"lstrip",
"(",
"'#'",
")",
")",
"if",
"(",
"isinstance",
"(",
"inp",
",",
"basestring",
")",
"and",
"inp",
".",
"s... | [
661,
0
] | [
685,
52
] | python | en | ['en', 'error', 'th'] | False |
dbref_to_obj | (inp, objclass, raise_errors=True) |
Convert a #dbref to a valid object.
Args:
inp (str or int): A valid #dbref.
objclass (class): A valid django model to filter against.
raise_errors (bool, optional): Whether to raise errors
or return `None` on errors.
Returns:
obj (Object or None): An entity loa... |
Convert a #dbref to a valid object. | def dbref_to_obj(inp, objclass, raise_errors=True):
"""
Convert a #dbref to a valid object.
Args:
inp (str or int): A valid #dbref.
objclass (class): A valid django model to filter against.
raise_errors (bool, optional): Whether to raise errors
or return `None` on errors... | [
"def",
"dbref_to_obj",
"(",
"inp",
",",
"objclass",
",",
"raise_errors",
"=",
"True",
")",
":",
"dbid",
"=",
"dbref",
"(",
"inp",
")",
"if",
"not",
"dbid",
":",
"# we only convert #dbrefs",
"return",
"inp",
"try",
":",
"if",
"dbid",
"<",
"0",
":",
"ret... | [
688,
0
] | [
723,
18
] | python | en | ['en', 'error', 'th'] | False |
latinify | (unicode_string, default='?', pure_ascii=False) |
Convert a unicode string to "safe" ascii/latin-1 characters.
This is used as a last resort when normal decoding does not work.
Arguments:
unicode_string (unicode): A string to convert to an ascii
or latin-1 string.
default (str, optional): Characters resisting mapping will be r... |
Convert a unicode string to "safe" ascii/latin-1 characters.
This is used as a last resort when normal decoding does not work. | def latinify(unicode_string, default='?', pure_ascii=False):
"""
Convert a unicode string to "safe" ascii/latin-1 characters.
This is used as a last resort when normal decoding does not work.
Arguments:
unicode_string (unicode): A string to convert to an ascii
or latin-1 string.
... | [
"def",
"latinify",
"(",
"unicode_string",
",",
"default",
"=",
"'?'",
",",
"pure_ascii",
"=",
"False",
")",
":",
"from",
"unicodedata",
"import",
"name",
"converted",
"=",
"[",
"]",
"for",
"unich",
"in",
"iter",
"(",
"unicode_string",
")",
":",
"try",
":... | [
735,
0
] | [
778,
29
] | python | en | ['en', 'error', 'th'] | False |
to_unicode | (obj, encoding='utf-8', force_string=False) |
This decodes a suitable object to the unicode format.
Args:
obj (any): Object to decode to unicode.
encoding (str, optional): The encoding type to use for the
dedoding.
force_string (bool, optional): Always convert to string, no
matter what type `obj` is initial... |
This decodes a suitable object to the unicode format. | def to_unicode(obj, encoding='utf-8', force_string=False):
"""
This decodes a suitable object to the unicode format.
Args:
obj (any): Object to decode to unicode.
encoding (str, optional): The encoding type to use for the
dedoding.
force_string (bool, optional): Always c... | [
"def",
"to_unicode",
"(",
"obj",
",",
"encoding",
"=",
"'utf-8'",
",",
"force_string",
"=",
"False",
")",
":",
"if",
"force_string",
"and",
"not",
"isinstance",
"(",
"obj",
",",
"basestring",
")",
":",
"# some sort of other object. Try to",
"# convert it to a stri... | [
781,
0
] | [
828,
14
] | python | en | ['en', 'error', 'th'] | False |
to_str | (obj, encoding='utf-8', force_string=False) |
This encodes a unicode string back to byte-representation,
for printing, writing to disk etc.
Args:
obj (any): Object to encode to bytecode.
encoding (str, optional): The encoding type to use for the
encoding.
force_string (bool, optional): Always convert to string, no
... |
This encodes a unicode string back to byte-representation,
for printing, writing to disk etc. | def to_str(obj, encoding='utf-8', force_string=False):
"""
This encodes a unicode string back to byte-representation,
for printing, writing to disk etc.
Args:
obj (any): Object to encode to bytecode.
encoding (str, optional): The encoding type to use for the
encoding.
... | [
"def",
"to_str",
"(",
"obj",
",",
"encoding",
"=",
"'utf-8'",
",",
"force_string",
"=",
"False",
")",
":",
"if",
"force_string",
"and",
"not",
"isinstance",
"(",
"obj",
",",
"basestring",
")",
":",
"# some sort of other object. Try to",
"# convert it to a string r... | [
831,
0
] | [
875,
14
] | python | en | ['en', 'error', 'th'] | False |
validate_email_address | (emailaddress) |
Checks if an email address is syntactically correct.
Args:
emailaddress (str): Email address to validate.
Returns:
is_valid (bool): If this is a valid email or not.
Notes.
(This snippet was adapted from
http://commandline.org.uk/python/email-syntax-check.)
|
Checks if an email address is syntactically correct. | def validate_email_address(emailaddress):
"""
Checks if an email address is syntactically correct.
Args:
emailaddress (str): Email address to validate.
Returns:
is_valid (bool): If this is a valid email or not.
Notes.
(This snippet was adapted from
http://commandli... | [
"def",
"validate_email_address",
"(",
"emailaddress",
")",
":",
"emailaddress",
"=",
"r\"%s\"",
"%",
"emailaddress",
"domains",
"=",
"(",
"\"aero\"",
",",
"\"asia\"",
",",
"\"biz\"",
",",
"\"cat\"",
",",
"\"com\"",
",",
"\"coop\"",
",",
"\"edu\"",
",",
"\"gov\... | [
878,
0
] | [
923,
20
] | python | en | ['en', 'error', 'th'] | False |
inherits_from | (obj, parent) |
Takes an object and tries to determine if it inherits at *any*
distance from parent.
Args:
obj (any): Object to analyze. This may be either an instance
or a class.
parent (any): Can be either instance, class or python path to class.
Returns:
inherits_from (bool): I... |
Takes an object and tries to determine if it inherits at *any*
distance from parent. | def inherits_from(obj, parent):
"""
Takes an object and tries to determine if it inherits at *any*
distance from parent.
Args:
obj (any): Object to analyze. This may be either an instance
or a class.
parent (any): Can be either instance, class or python path to class.
R... | [
"def",
"inherits_from",
"(",
"obj",
",",
"parent",
")",
":",
"if",
"callable",
"(",
"obj",
")",
":",
"# this is a class",
"obj_paths",
"=",
"[",
"\"%s.%s\"",
"%",
"(",
"mod",
".",
"__module__",
",",
"mod",
".",
"__name__",
")",
"for",
"mod",
"in",
"obj... | [
926,
0
] | [
961,
70
] | python | en | ['en', 'error', 'th'] | False |
server_services | () |
Lists all services active on the Server. Observe that since
services are launched in memory, this function will only return
any results if called from inside the game.
Returns:
services (dict): A dict of available services.
|
Lists all services active on the Server. Observe that since
services are launched in memory, this function will only return
any results if called from inside the game. | def server_services():
"""
Lists all services active on the Server. Observe that since
services are launched in memory, this function will only return
any results if called from inside the game.
Returns:
services (dict): A dict of available services.
"""
from evennia.server.session... | [
"def",
"server_services",
"(",
")",
":",
"from",
"evennia",
".",
"server",
".",
"sessionhandler",
"import",
"SESSIONS",
"if",
"hasattr",
"(",
"SESSIONS",
",",
"\"server\"",
")",
"and",
"hasattr",
"(",
"SESSIONS",
".",
"server",
",",
"\"services\"",
")",
":",... | [
964,
0
] | [
981,
17
] | python | en | ['en', 'error', 'th'] | False |
uses_database | (name="sqlite3") |
Checks if the game is currently using a given database. This is a
shortcut to having to use the full backend name.
Args:
name (str): One of 'sqlite3', 'mysql', 'postgresql_psycopg2'
or 'oracle'.
Returns:
uses (bool): If the given database is used or not.
|
Checks if the game is currently using a given database. This is a
shortcut to having to use the full backend name. | def uses_database(name="sqlite3"):
"""
Checks if the game is currently using a given database. This is a
shortcut to having to use the full backend name.
Args:
name (str): One of 'sqlite3', 'mysql', 'postgresql_psycopg2'
or 'oracle'.
Returns:
uses (bool): If the given datab... | [
"def",
"uses_database",
"(",
"name",
"=",
"\"sqlite3\"",
")",
":",
"try",
":",
"engine",
"=",
"settings",
".",
"DATABASES",
"[",
"\"default\"",
"]",
"[",
"\"ENGINE\"",
"]",
"except",
"KeyError",
":",
"engine",
"=",
"settings",
".",
"DATABASE_ENGINE",
"return... | [
984,
0
] | [
1001,
51
] | python | en | ['en', 'error', 'th'] | False |
delay | (timedelay, callback, *args, **kwargs) |
Delay the return of a value.
Args:
timedelay (int or float): The delay in seconds
callback (callable): Will be called as `callback(*args, **kwargs)`
after `timedelay` seconds.
args (any, optional): Will be used as arguments to callback
Kwargs:
persistent (bool, ... |
Delay the return of a value. | def delay(timedelay, callback, *args, **kwargs):
"""
Delay the return of a value.
Args:
timedelay (int or float): The delay in seconds
callback (callable): Will be called as `callback(*args, **kwargs)`
after `timedelay` seconds.
args (any, optional): Will be used as argu... | [
"def",
"delay",
"(",
"timedelay",
",",
"callback",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"_TASK_HANDLER",
"# Do some imports here to avoid circular import and speed things up",
"if",
"_TASK_HANDLER",
"is",
"None",
":",
"from",
"evennia",
"."... | [
1007,
0
] | [
1042,
66
] | python | en | ['en', 'error', 'th'] | False |
clean_object_caches | (obj) |
Clean all object caches on the given object.
Args:
obj (Object instace): An object whose caches to clean.
Notes:
This is only the contents cache these days.
|
Clean all object caches on the given object. | def clean_object_caches(obj):
"""
Clean all object caches on the given object.
Args:
obj (Object instace): An object whose caches to clean.
Notes:
This is only the contents cache these days.
"""
global _TYPECLASSMODELS, _OBJECTMODELS
if not _TYPECLASSMODELS:
from e... | [
"def",
"clean_object_caches",
"(",
"obj",
")",
":",
"global",
"_TYPECLASSMODELS",
",",
"_OBJECTMODELS",
"if",
"not",
"_TYPECLASSMODELS",
":",
"from",
"evennia",
".",
"typeclasses",
"import",
"models",
"as",
"_TYPECLASSMODELS",
"if",
"not",
"obj",
":",
"return",
... | [
1049,
0
] | [
1081,
12
] | python | en | ['en', 'error', 'th'] | False |
run_async | (to_execute, *args, **kwargs) |
Runs a function or executes a code snippet asynchronously.
Args:
to_execute (callable): If this is a callable, it will be
executed with *args and non-reserved *kwargs as arguments.
The callable will be executed using ProcPool, or in a thread
if ProcPool is not avail... |
Runs a function or executes a code snippet asynchronously. | def run_async(to_execute, *args, **kwargs):
"""
Runs a function or executes a code snippet asynchronously.
Args:
to_execute (callable): If this is a callable, it will be
executed with *args and non-reserved *kwargs as arguments.
The callable will be executed using ProcPool, ... | [
"def",
"run_async",
"(",
"to_execute",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# handle special reserved input kwargs",
"callback",
"=",
"kwargs",
".",
"pop",
"(",
"\"at_return\"",
",",
"None",
")",
"errback",
"=",
"kwargs",
".",
"pop",
"(",
... | [
1089,
0
] | [
1145,
50
] | python | en | ['en', 'error', 'th'] | False |
check_evennia_dependencies | () |
Checks the versions of Evennia's dependencies including making
some checks for runtime libraries.
Returns:
result (bool): `False` if a show-stopping version mismatch is
found.
|
Checks the versions of Evennia's dependencies including making
some checks for runtime libraries. | def check_evennia_dependencies():
"""
Checks the versions of Evennia's dependencies including making
some checks for runtime libraries.
Returns:
result (bool): `False` if a show-stopping version mismatch is
found.
"""
# check main dependencies
from evennia.server.evenn... | [
"def",
"check_evennia_dependencies",
"(",
")",
":",
"# check main dependencies",
"from",
"evennia",
".",
"server",
".",
"evennia_launcher",
"import",
"check_main_evennia_dependencies",
"not_error",
"=",
"check_main_evennia_dependencies",
"(",
")",
"errstring",
"=",
"\"\"",
... | [
1148,
0
] | [
1183,
20
] | python | en | ['en', 'error', 'th'] | False |
has_parent | (basepath, obj) |
Checks if `basepath` is somewhere in `obj`s parent tree.
Args:
basepath (str): Python dotpath to compare against obj path.
obj (any): Object whose path is to be checked.
Returns:
has_parent (bool): If the check was successful or not.
|
Checks if `basepath` is somewhere in `obj`s parent tree. | def has_parent(basepath, obj):
"""
Checks if `basepath` is somewhere in `obj`s parent tree.
Args:
basepath (str): Python dotpath to compare against obj path.
obj (any): Object whose path is to be checked.
Returns:
has_parent (bool): If the check was successful or not.
"""
... | [
"def",
"has_parent",
"(",
"basepath",
",",
"obj",
")",
":",
"try",
":",
"return",
"any",
"(",
"cls",
"for",
"cls",
"in",
"obj",
".",
"__class__",
".",
"mro",
"(",
")",
"if",
"basepath",
"==",
"\"%s.%s\"",
"%",
"(",
"cls",
".",
"__module__",
",",
"c... | [
1186,
0
] | [
1204,
20
] | python | en | ['en', 'error', 'th'] | False |
mod_import | (module) |
A generic Python module loader.
Args:
module (str, module): This can be either a Python path
(dot-notation like `evennia.objects.models`), an absolute path
(e.g. `/home/eve/evennia/evennia/objects.models.py`) or an
already imported module object (e.g. `models`)
... |
A generic Python module loader. | def mod_import(module):
"""
A generic Python module loader.
Args:
module (str, module): This can be either a Python path
(dot-notation like `evennia.objects.models`), an absolute path
(e.g. `/home/eve/evennia/evennia/objects.models.py`) or an
already imported mod... | [
"def",
"mod_import",
"(",
"module",
")",
":",
"if",
"not",
"module",
":",
"return",
"None",
"if",
"isinstance",
"(",
"module",
",",
"types",
".",
"ModuleType",
")",
":",
"# if this is already a module, we are done",
"mod",
"=",
"module",
"else",
":",
"# first ... | [
1207,
0
] | [
1259,
14
] | python | en | ['en', 'error', 'th'] | False |
all_from_module | (module) |
Return all global-level variables defined in a module.
Args:
module (str, module): This can be either a Python path
(dot-notation like `evennia.objects.models`), an absolute path
(e.g. `/home/eve/evennia/evennia/objects.models.py`) or an
already imported module obje... |
Return all global-level variables defined in a module. | def all_from_module(module):
"""
Return all global-level variables defined in a module.
Args:
module (str, module): This can be either a Python path
(dot-notation like `evennia.objects.models`), an absolute path
(e.g. `/home/eve/evennia/evennia/objects.models.py`) or an
... | [
"def",
"all_from_module",
"(",
"module",
")",
":",
"mod",
"=",
"mod_import",
"(",
"module",
")",
"if",
"not",
"mod",
":",
"return",
"{",
"}",
"# make sure to only return variables actually defined in this",
"# module if available (try to avoid not imports)",
"members",
"=... | [
1262,
0
] | [
1286,
78
] | python | en | ['en', 'error', 'th'] | False |
callables_from_module | (module) |
Return all global-level callables defined in a module.
Args:
module (str, module): A python-path to a module or an actual
module object.
Returns:
callables (dict): A dict of {name: callable, ...} from the module.
Notes:
Will ignore callables whose names start with... |
Return all global-level callables defined in a module. | def callables_from_module(module):
"""
Return all global-level callables defined in a module.
Args:
module (str, module): A python-path to a module or an actual
module object.
Returns:
callables (dict): A dict of {name: callable, ...} from the module.
Notes:
Wi... | [
"def",
"callables_from_module",
"(",
"module",
")",
":",
"mod",
"=",
"mod_import",
"(",
"module",
")",
"if",
"not",
"mod",
":",
"return",
"{",
"}",
"# make sure to only return callables actually defined in this module (not imports)",
"members",
"=",
"getmembers",
"(",
... | [
1289,
0
] | [
1309,
78
] | python | en | ['en', 'error', 'th'] | False |
variable_from_module | (module, variable=None, default=None) |
Retrieve a variable or list of variables from a module. The
variable(s) must be defined globally in the module. If no variable
is given (or a list entry is `None`), all global variables are
extracted from the module.
Args:
module (string or module): Python path, absolute path or a module.
... |
Retrieve a variable or list of variables from a module. The
variable(s) must be defined globally in the module. If no variable
is given (or a list entry is `None`), all global variables are
extracted from the module. | def variable_from_module(module, variable=None, default=None):
"""
Retrieve a variable or list of variables from a module. The
variable(s) must be defined globally in the module. If no variable
is given (or a list entry is `None`), all global variables are
extracted from the module.
Args:
... | [
"def",
"variable_from_module",
"(",
"module",
",",
"variable",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"if",
"not",
"module",
":",
"return",
"default",
"mod",
"=",
"mod_import",
"(",
"module",
")",
"if",
"variable",
":",
"result",
"=",
"[",
... | [
1312,
0
] | [
1352,
17
] | python | en | ['en', 'error', 'th'] | False |
string_from_module | (module, variable=None, default=None) |
This is a wrapper for `variable_from_module` that requires return
value to be a string to pass. It's primarily used by login screen.
Args:
module (string or module): Python path, absolute path or a module.
variable (string or iterable, optional): Single variable name or iterable
of v... |
This is a wrapper for `variable_from_module` that requires return
value to be a string to pass. It's primarily used by login screen. | def string_from_module(module, variable=None, default=None):
"""
This is a wrapper for `variable_from_module` that requires return
value to be a string to pass. It's primarily used by login screen.
Args:
module (string or module): Python path, absolute path or a module.
variable (string or ... | [
"def",
"string_from_module",
"(",
"module",
",",
"variable",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"val",
"=",
"variable_from_module",
"(",
"module",
",",
"variable",
"=",
"variable",
",",
"default",
"=",
"default",
")",
"if",
"val",
":",
"... | [
1355,
0
] | [
1381,
18
] | python | en | ['en', 'error', 'th'] | False |
random_string_from_module | (module) |
Returns a random global string from a module.
Args:
module (string or module): Python path, absolute path or a module.
Returns:
random (string): A random stribg variable from `module`.
|
Returns a random global string from a module. | def random_string_from_module(module):
"""
Returns a random global string from a module.
Args:
module (string or module): Python path, absolute path or a module.
Returns:
random (string): A random stribg variable from `module`.
"""
return random.choice(string_from_module(module... | [
"def",
"random_string_from_module",
"(",
"module",
")",
":",
"return",
"random",
".",
"choice",
"(",
"string_from_module",
"(",
"module",
")",
")"
] | [
1384,
0
] | [
1394,
52
] | python | en | ['en', 'error', 'th'] | False |
fuzzy_import_from_module | (path, variable, default=None, defaultpaths=None) |
Import a variable based on a fuzzy path. First the literal
`path` will be tried, then all given `defaultpaths` will be
prepended to see a match is found.
Args:
path (str): Full or partial python path.
variable (str): Name of variable to import from module.
default (string, opti... |
Import a variable based on a fuzzy path. First the literal
`path` will be tried, then all given `defaultpaths` will be
prepended to see a match is found. | def fuzzy_import_from_module(path, variable, default=None, defaultpaths=None):
"""
Import a variable based on a fuzzy path. First the literal
`path` will be tried, then all given `defaultpaths` will be
prepended to see a match is found.
Args:
path (str): Full or partial python path.
... | [
"def",
"fuzzy_import_from_module",
"(",
"path",
",",
"variable",
",",
"default",
"=",
"None",
",",
"defaultpaths",
"=",
"None",
")",
":",
"paths",
"=",
"[",
"path",
"]",
"+",
"make_iter",
"(",
"defaultpaths",
")",
"for",
"modpath",
"in",
"paths",
":",
"t... | [
1397,
0
] | [
1426,
18
] | python | en | ['en', 'error', 'th'] | False |
class_from_module | (path, defaultpaths=None) |
Return a class from a module, given the module's path. This is
primarily used to convert db_typeclass_path:s to classes.
Args:
path (str): Full Python dot-path to module.
defaultpaths (iterable, optional): If a direc import from `path` fails,
try subsequent imports by prependin... |
Return a class from a module, given the module's path. This is
primarily used to convert db_typeclass_path:s to classes. | def class_from_module(path, defaultpaths=None):
"""
Return a class from a module, given the module's path. This is
primarily used to convert db_typeclass_path:s to classes.
Args:
path (str): Full Python dot-path to module.
defaultpaths (iterable, optional): If a direc import from `path`... | [
"def",
"class_from_module",
"(",
"path",
",",
"defaultpaths",
"=",
"None",
")",
":",
"cls",
"=",
"None",
"if",
"defaultpaths",
":",
"paths",
"=",
"[",
"path",
"]",
"+",
"[",
"\"%s.%s\"",
"%",
"(",
"dpath",
",",
"path",
")",
"for",
"dpath",
"in",
"mak... | [
1429,
0
] | [
1483,
14
] | python | en | ['en', 'error', 'th'] | False |
init_new_account | (account) |
Deprecated.
|
Deprecated.
| def init_new_account(account):
"""
Deprecated.
"""
from evennia.utils import logger
logger.log_dep("evennia.utils.utils.init_new_account is DEPRECATED and should not be used.") | [
"def",
"init_new_account",
"(",
"account",
")",
":",
"from",
"evennia",
".",
"utils",
"import",
"logger",
"logger",
".",
"log_dep",
"(",
"\"evennia.utils.utils.init_new_account is DEPRECATED and should not be used.\"",
")"
] | [
1490,
0
] | [
1495,
96
] | python | en | ['en', 'error', 'th'] | False |
string_similarity | (string1, string2) |
This implements a "cosine-similarity" algorithm as described for example in
*Proceedings of the 22nd International Conference on Computation
Linguistics* (Coling 2008), pages 593-600, Manchester, August 2008.
The measure-vectors used is simply a "bag of words" type histogram
(but for letters)... |
This implements a "cosine-similarity" algorithm as described for example in
*Proceedings of the 22nd International Conference on Computation
Linguistics* (Coling 2008), pages 593-600, Manchester, August 2008.
The measure-vectors used is simply a "bag of words" type histogram
(but for letters)... | def string_similarity(string1, string2):
"""
This implements a "cosine-similarity" algorithm as described for example in
*Proceedings of the 22nd International Conference on Computation
Linguistics* (Coling 2008), pages 593-600, Manchester, August 2008.
The measure-vectors used is simply a "ba... | [
"def",
"string_similarity",
"(",
"string1",
",",
"string2",
")",
":",
"vocabulary",
"=",
"set",
"(",
"list",
"(",
"string1",
"+",
"string2",
")",
")",
"vec1",
"=",
"[",
"string1",
".",
"count",
"(",
"v",
")",
"for",
"v",
"in",
"vocabulary",
"]",
"vec... | [
1498,
0
] | [
1524,
16
] | python | en | ['en', 'error', 'th'] | False |
string_suggestions | (string, vocabulary, cutoff=0.6, maxnum=3) |
Given a `string` and a `vocabulary`, return a match or a list of
suggestions based on string similarity.
Args:
string (str): A string to search for.
vocabulary (iterable): A list of available strings.
cutoff (int, 0-1): Limit the similarity matches (the higher
the value... |
Given a `string` and a `vocabulary`, return a match or a list of
suggestions based on string similarity. | def string_suggestions(string, vocabulary, cutoff=0.6, maxnum=3):
"""
Given a `string` and a `vocabulary`, return a match or a list of
suggestions based on string similarity.
Args:
string (str): A string to search for.
vocabulary (iterable): A list of available strings.
cutoff (... | [
"def",
"string_suggestions",
"(",
"string",
",",
"vocabulary",
",",
"cutoff",
"=",
"0.6",
",",
"maxnum",
"=",
"3",
")",
":",
"return",
"[",
"tup",
"[",
"1",
"]",
"for",
"tup",
"in",
"sorted",
"(",
"[",
"(",
"string_similarity",
"(",
"string",
",",
"s... | [
1527,
0
] | [
1548,
41
] | python | en | ['en', 'error', 'th'] | False |
string_partial_matching | (alternatives, inp, ret_index=True) |
Partially matches a string based on a list of `alternatives`.
Matching is made from the start of each subword in each
alternative. Case is not important. So e.g. "bi sh sw" or just
"big" or "shiny" or "sw" will match "Big shiny sword". Scoring is
done to allow to separate by most common demoninator... |
Partially matches a string based on a list of `alternatives`.
Matching is made from the start of each subword in each
alternative. Case is not important. So e.g. "bi sh sw" or just
"big" or "shiny" or "sw" will match "Big shiny sword". Scoring is
done to allow to separate by most common demoninator... | def string_partial_matching(alternatives, inp, ret_index=True):
"""
Partially matches a string based on a list of `alternatives`.
Matching is made from the start of each subword in each
alternative. Case is not important. So e.g. "bi sh sw" or just
"big" or "shiny" or "sw" will match "Big shiny swor... | [
"def",
"string_partial_matching",
"(",
"alternatives",
",",
"inp",
",",
"ret_index",
"=",
"True",
")",
":",
"if",
"not",
"alternatives",
"or",
"not",
"inp",
":",
"return",
"[",
"]",
"matches",
"=",
"defaultdict",
"(",
"list",
")",
"inp_words",
"=",
"inp",
... | [
1551,
0
] | [
1598,
13
] | python | en | ['en', 'error', 'th'] | False |
format_table | (table, extra_space=1) |
Note: `evennia.utils.evtable` is more powerful than this, but this
function can be useful when the number of columns and rows are
unknown and must be calculated on the fly.
Args.
table (list): A list of lists to represent columns in the
table: `[[val,val,val,...], [val,val,val,...]... |
Note: `evennia.utils.evtable` is more powerful than this, but this
function can be useful when the number of columns and rows are
unknown and must be calculated on the fly. | def format_table(table, extra_space=1):
"""
Note: `evennia.utils.evtable` is more powerful than this, but this
function can be useful when the number of columns and rows are
unknown and must be calculated on the fly.
Args.
table (list): A list of lists to represent columns in the
... | [
"def",
"format_table",
"(",
"table",
",",
"extra_space",
"=",
"1",
")",
":",
"if",
"not",
"table",
":",
"return",
"[",
"[",
"]",
"]",
"max_widths",
"=",
"[",
"max",
"(",
"[",
"len",
"(",
"str",
"(",
"val",
")",
")",
"for",
"val",
"in",
"col",
"... | [
1601,
0
] | [
1645,
17
] | python | en | ['en', 'error', 'th'] | False |
get_evennia_pids | () |
Get the currently valid PIDs (Process IDs) of the Portal and
Server by trying to access a PID file.
Returns:
server, portal (tuple): The PIDs of the respective processes,
or two `None` values if not found.
Examples:
This can be used to determine if we are in a subprocess b... |
Get the currently valid PIDs (Process IDs) of the Portal and
Server by trying to access a PID file. | def get_evennia_pids():
"""
Get the currently valid PIDs (Process IDs) of the Portal and
Server by trying to access a PID file.
Returns:
server, portal (tuple): The PIDs of the respective processes,
or two `None` values if not found.
Examples:
This can be used to determ... | [
"def",
"get_evennia_pids",
"(",
")",
":",
"server_pidfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"settings",
".",
"GAME_DIR",
",",
"'server.pid'",
")",
"portal_pidfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"settings",
".",
"GAME_DIR",
",",
"'p... | [
1648,
0
] | [
1678,
21
] | python | en | ['en', 'error', 'th'] | False |
deepsize | (obj, max_depth=4) |
Get not only size of the given object, but also the size of
objects referenced by the object, down to `max_depth` distance
from the object.
Args:
obj (object): the object to be measured.
max_depth (int, optional): maximum referential distance
from `obj` that `deepsize()` sh... |
Get not only size of the given object, but also the size of
objects referenced by the object, down to `max_depth` distance
from the object. | def deepsize(obj, max_depth=4):
"""
Get not only size of the given object, but also the size of
objects referenced by the object, down to `max_depth` distance
from the object.
Args:
obj (object): the object to be measured.
max_depth (int, optional): maximum referential distance
... | [
"def",
"deepsize",
"(",
"obj",
",",
"max_depth",
"=",
"4",
")",
":",
"def",
"_recurse",
"(",
"o",
",",
"dct",
",",
"depth",
")",
":",
"if",
"0",
"<=",
"max_depth",
"<",
"depth",
":",
"return",
"for",
"ref",
"in",
"get_referents",
"(",
"o",
")",
"... | [
1685,
0
] | [
1718,
15
] | python | en | ['en', 'error', 'th'] | False |
strip_control_sequences | (string) |
Remove non-print text sequences.
Args:
string (str): Text to strip.
Returns.
text (str): Stripped text.
|
Remove non-print text sequences. | def strip_control_sequences(string):
"""
Remove non-print text sequences.
Args:
string (str): Text to strip.
Returns.
text (str): Stripped text.
"""
global _STRIP_ANSI
if not _STRIP_ANSI:
from evennia.utils.ansi import strip_raw_ansi as _STRIP_ANSI
return _RE_C... | [
"def",
"strip_control_sequences",
"(",
"string",
")",
":",
"global",
"_STRIP_ANSI",
"if",
"not",
"_STRIP_ANSI",
":",
"from",
"evennia",
".",
"utils",
".",
"ansi",
"import",
"strip_raw_ansi",
"as",
"_STRIP_ANSI",
"return",
"_RE_CONTROL_CHAR",
".",
"sub",
"(",
"''... | [
1767,
0
] | [
1781,
56
] | python | en | ['en', 'error', 'th'] | False |
calledby | (callerdepth=1) |
Only to be used for debug purposes. Insert this debug function in
another function; it will print which function called it.
Args:
callerdepth (int): Must be larger than 0. When > 1, it will
print the caller of the caller etc.
Returns:
calledby (str): A debug string detaili... |
Only to be used for debug purposes. Insert this debug function in
another function; it will print which function called it. | def calledby(callerdepth=1):
"""
Only to be used for debug purposes. Insert this debug function in
another function; it will print which function called it.
Args:
callerdepth (int): Must be larger than 0. When > 1, it will
print the caller of the caller etc.
Returns:
ca... | [
"def",
"calledby",
"(",
"callerdepth",
"=",
"1",
")",
":",
"import",
"inspect",
"stack",
"=",
"inspect",
".",
"stack",
"(",
")",
"# we must step one extra level back in stack since we don't want",
"# to include the call of this function itself.",
"callerdepth",
"=",
"min",
... | [
1784,
0
] | [
1805,
78
] | python | en | ['en', 'error', 'th'] | False |
m_len | (target) |
Provides length checking for strings with MXP patterns, and falls
back to normal len for other objects.
Args:
target (string): A string with potential MXP components
to search.
Returns:
length (int): The length of `target`, ignoring MXP components.
|
Provides length checking for strings with MXP patterns, and falls
back to normal len for other objects. | def m_len(target):
"""
Provides length checking for strings with MXP patterns, and falls
back to normal len for other objects.
Args:
target (string): A string with potential MXP components
to search.
Returns:
length (int): The length of `target`, ignoring MXP components... | [
"def",
"m_len",
"(",
"target",
")",
":",
"# Would create circular import if in module root.",
"from",
"evennia",
".",
"utils",
".",
"ansi",
"import",
"ANSI_PARSER",
"if",
"inherits_from",
"(",
"target",
",",
"basestring",
")",
"and",
"\"|lt\"",
"in",
"target",
":"... | [
1808,
0
] | [
1825,
22
] | python | en | ['en', 'error', 'th'] | False |
at_search_result | (matches, caller, query="", quiet=False, **kwargs) |
This is a generic hook for handling all processing of a search
result, including error reporting. This is also called by the cmdhandler
to manage errors in command lookup.
Args:
matches (list): This is a list of 0, 1 or more typeclass
instances or Command instances, the matched res... |
This is a generic hook for handling all processing of a search
result, including error reporting. This is also called by the cmdhandler
to manage errors in command lookup. | def at_search_result(matches, caller, query="", quiet=False, **kwargs):
"""
This is a generic hook for handling all processing of a search
result, including error reporting. This is also called by the cmdhandler
to manage errors in command lookup.
Args:
matches (list): This is a list of 0, ... | [
"def",
"at_search_result",
"(",
"matches",
",",
"caller",
",",
"query",
"=",
"\"\"",
",",
"quiet",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"error",
"=",
"\"\"",
"if",
"not",
"matches",
":",
"# no results.",
"error",
"=",
"kwargs",
".",
"get",
... | [
1834,
0
] | [
1889,
18
] | python | en | ['en', 'error', 'th'] | False |
get_game_dir_path | () |
This is called by settings_default in order to determine the path
of the game directory.
Returns:
path (str): Full OS path to the game dir
|
This is called by settings_default in order to determine the path
of the game directory. | def get_game_dir_path():
"""
This is called by settings_default in order to determine the path
of the game directory.
Returns:
path (str): Full OS path to the game dir
"""
# current working directory, assumed to be somewhere inside gamedir.
for _ in range(10):
gpath = os.ge... | [
"def",
"get_game_dir_path",
"(",
")",
":",
"# current working directory, assumed to be somewhere inside gamedir.",
"for",
"_",
"in",
"range",
"(",
"10",
")",
":",
"gpath",
"=",
"os",
".",
"getcwd",
"(",
")",
"if",
"\"server\"",
"in",
"os",
".",
"listdir",
"(",
... | [
1943,
0
] | [
1960,
93
] | python | en | ['en', 'error', 'th'] | False |
get_all_typeclasses | (parent=None) |
List available typeclasses from all available modules.
Args:
parent (str, optional): If given, only return typeclasses inheriting (at any distance)
from this parent.
Returns:
typeclasses (dict): On the form {"typeclass.path": typeclass, ...}
Notes:
This will dynam... |
List available typeclasses from all available modules. | def get_all_typeclasses(parent=None):
"""
List available typeclasses from all available modules.
Args:
parent (str, optional): If given, only return typeclasses inheriting (at any distance)
from this parent.
Returns:
typeclasses (dict): On the form {"typeclass.path": typecl... | [
"def",
"get_all_typeclasses",
"(",
"parent",
"=",
"None",
")",
":",
"from",
"evennia",
".",
"typeclasses",
".",
"models",
"import",
"TypedObject",
"typeclasses",
"=",
"{",
"\"{}.{}\"",
".",
"format",
"(",
"model",
".",
"__module__",
",",
"model",
".",
"__nam... | [
1963,
0
] | [
1986,
22
] | 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.