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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
LiDARInstance3DBoxes.points_in_boxes | (self, points) | Find the box which the points are in.
Args:
points (torch.Tensor): Points in shape (N, 3).
Returns:
torch.Tensor: The index of box where each point are in.
| Find the box which the points are in. | def points_in_boxes(self, points):
"""Find the box which the points are in.
Args:
points (torch.Tensor): Points in shape (N, 3).
Returns:
torch.Tensor: The index of box where each point are in.
"""
box_idx = points_in_boxes_gpu(
points.unsque... | [
"def",
"points_in_boxes",
"(",
"self",
",",
"points",
")",
":",
"box_idx",
"=",
"points_in_boxes_gpu",
"(",
"points",
".",
"unsqueeze",
"(",
"0",
")",
",",
"self",
".",
"tensor",
".",
"unsqueeze",
"(",
"0",
")",
".",
"to",
"(",
"points",
".",
"device",... | [
241,
4
] | [
253,
22
] | python | en | ['en', 'en', 'en'] | True |
Fill.color | (self) |
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string... |
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string... | def color(self):
"""
Sets the cell fill color. It accepts either a specific color or
an array of colors or a 2D array of colors.
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
... | [
"def",
"color",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"color\"",
"]"
] | [
15,
4
] | [
67,
28
] | python | en | ['en', 'error', 'th'] | False |
Fill.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\"",
"]"
] | [
76,
4
] | [
87,
31
] | python | en | ['en', 'error', 'th'] | False |
Fill.__init__ | (self, arg=None, color=None, colorsrc=None, **kwargs) |
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.header.Fill`
color
Sets the cell fill color. It accepts either a s... |
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.header.Fill`
color
Sets the cell fill color. It accepts either a s... | def __init__(self, arg=None, color=None, colorsrc=None, **kwargs):
"""
Construct a new Fill object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of
:class:`plotly.graph_objs.table.header.F... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colorsrc",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Fill",
",",
"self",
")",
".",
"__init__",
"(",
"\"fill\"",
")",
"if",
"\"_parent\"",... | [
106,
4
] | [
171,
34
] | python | en | ['en', 'error', 'th'] | False |
get_points_type | (points_type) | Get the class of points according to coordinate type.
Args:
points_type (str): The type of points coordinate.
The valid value are "CAMERA", "LIDAR", or "DEPTH".
Returns:
class: Points type.
| Get the class of points according to coordinate type. | def get_points_type(points_type):
"""Get the class of points according to coordinate type.
Args:
points_type (str): The type of points coordinate.
The valid value are "CAMERA", "LIDAR", or "DEPTH".
Returns:
class: Points type.
"""
if points_type == 'CAMERA':
poi... | [
"def",
"get_points_type",
"(",
"points_type",
")",
":",
"if",
"points_type",
"==",
"'CAMERA'",
":",
"points_cls",
"=",
"CameraPoints",
"elif",
"points_type",
"==",
"'LIDAR'",
":",
"points_cls",
"=",
"LiDARPoints",
"elif",
"points_type",
"==",
"'DEPTH'",
":",
"po... | [
8,
0
] | [
28,
21
] | python | en | ['en', 'en', 'en'] | True |
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.barpolar.marke
r.colorbar.Tickformatstop`
dtickrange
range [*m... |
Construct a new Tickformatstop object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.barpolar.marke
r.colorbar.Tickformatstop`
dtickrange
range [*m... | 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 |
ChannelCommand.parse | (self) |
Simple parser
|
Simple parser
| def parse(self):
"""
Simple parser
"""
# cmdhandler sends channame:msg here.
channelname, msg = self.args.split(":", 1)
self.history_start = None
if msg.startswith("/history"):
arg = msg[8:]
try:
self.history_start = int(arg... | [
"def",
"parse",
"(",
"self",
")",
":",
"# cmdhandler sends channame:msg here.",
"channelname",
",",
"msg",
"=",
"self",
".",
"args",
".",
"split",
"(",
"\":\"",
",",
"1",
")",
"self",
".",
"history_start",
"=",
"None",
"if",
"msg",
".",
"startswith",
"(",
... | [
71,
4
] | [
85,
54
] | python | en | ['en', 'error', 'th'] | False |
ChannelCommand.func | (self) |
Create a new message and send it to channel, using
the already formatted input.
|
Create a new message and send it to channel, using
the already formatted input.
| def func(self):
"""
Create a new message and send it to channel, using
the already formatted input.
"""
global _CHANNELDB
if not _CHANNELDB:
from evennia.comms.models import ChannelDB as _CHANNELDB
channelkey, msg = self.args
caller = self.cal... | [
"def",
"func",
"(",
"self",
")",
":",
"global",
"_CHANNELDB",
"if",
"not",
"_CHANNELDB",
":",
"from",
"evennia",
".",
"comms",
".",
"models",
"import",
"ChannelDB",
"as",
"_CHANNELDB",
"channelkey",
",",
"msg",
"=",
"self",
".",
"args",
"caller",
"=",
"s... | [
87,
4
] | [
142,
62
] | python | en | ['en', 'error', 'th'] | False |
ChannelCommand.get_extra_info | (self, caller, **kwargs) |
Let users know that this command is for communicating on a channel.
Args:
caller (TypedObject): A Character or Account who has entered an ambiguous command.
Returns:
A string with identifying information to disambiguate the object, conventionally with a preceding space... |
Let users know that this command is for communicating on a channel. | def get_extra_info(self, caller, **kwargs):
"""
Let users know that this command is for communicating on a channel.
Args:
caller (TypedObject): A Character or Account who has entered an ambiguous command.
Returns:
A string with identifying information to disambi... | [
"def",
"get_extra_info",
"(",
"self",
",",
"caller",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_",
"(",
"\" (channel)\"",
")"
] | [
144,
4
] | [
154,
30
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.__init__ | (self) |
Initializes the channel handler's internal state.
|
Initializes the channel handler's internal state. | def __init__(self):
"""
Initializes the channel handler's internal state.
"""
self._cached_channel_cmds = {}
self._cached_cmdsets = {}
self._cached_channels = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_cached_channel_cmds",
"=",
"{",
"}",
"self",
".",
"_cached_cmdsets",
"=",
"{",
"}",
"self",
".",
"_cached_channels",
"=",
"{",
"}"
] | [
169,
4
] | [
176,
34
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.__str__ | (self) |
Returns the string representation of the handler
|
Returns the string representation of the handler | def __str__(self):
"""
Returns the string representation of the handler
"""
return ", ".join(str(cmd) for cmd in self._cached_channel_cmds) | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"\", \"",
".",
"join",
"(",
"str",
"(",
"cmd",
")",
"for",
"cmd",
"in",
"self",
".",
"_cached_channel_cmds",
")"
] | [
178,
4
] | [
183,
71
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.clear | (self) |
Reset the cache storage.
|
Reset the cache storage. | def clear(self):
"""
Reset the cache storage.
"""
self._cached_channel_cmds = {}
self._cached_cmdsets = {}
self._cached_channels = {} | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_cached_channel_cmds",
"=",
"{",
"}",
"self",
".",
"_cached_cmdsets",
"=",
"{",
"}",
"self",
".",
"_cached_channels",
"=",
"{",
"}"
] | [
185,
4
] | [
192,
34
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.add | (self, channel) |
Add an individual channel to the handler. This is called
whenever a new channel is created.
Args:
channel (Channel): The channel to add.
Notes:
To remove a channel, simply delete the channel object and
run self.update on the handler. This should usu... |
Add an individual channel to the handler. This is called
whenever a new channel is created. | def add(self, channel):
"""
Add an individual channel to the handler. This is called
whenever a new channel is created.
Args:
channel (Channel): The channel to add.
Notes:
To remove a channel, simply delete the channel object and
run self.upd... | [
"def",
"add",
"(",
"self",
",",
"channel",
")",
":",
"global",
"_CHANNEL_COMMAND_CLASS",
"if",
"not",
"_CHANNEL_COMMAND_CLASS",
":",
"_CHANNEL_COMMAND_CLASS",
"=",
"class_from_module",
"(",
"settings",
".",
"CHANNEL_COMMAND_CLASS",
")",
"# map the channel to a searchable ... | [
194,
4
] | [
229,
33
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.remove | (self, channel) |
Remove channel from channelhandler. This will also delete it.
Args:
channel (Channel): Channel to remove/delete.
|
Remove channel from channelhandler. This will also delete it. | def remove(self, channel):
"""
Remove channel from channelhandler. This will also delete it.
Args:
channel (Channel): Channel to remove/delete.
"""
if channel.pk:
channel.delete()
self.update() | [
"def",
"remove",
"(",
"self",
",",
"channel",
")",
":",
"if",
"channel",
".",
"pk",
":",
"channel",
".",
"delete",
"(",
")",
"self",
".",
"update",
"(",
")"
] | [
232,
4
] | [
242,
21
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.update | (self) |
Updates the handler completely, including removing old removed
Channel objects. This must be called after deleting a Channel.
|
Updates the handler completely, including removing old removed
Channel objects. This must be called after deleting a Channel. | def update(self):
"""
Updates the handler completely, including removing old removed
Channel objects. This must be called after deleting a Channel.
"""
global _CHANNELDB
if not _CHANNELDB:
from evennia.comms.models import ChannelDB as _CHANNELDB
self.... | [
"def",
"update",
"(",
"self",
")",
":",
"global",
"_CHANNELDB",
"if",
"not",
"_CHANNELDB",
":",
"from",
"evennia",
".",
"comms",
".",
"models",
"import",
"ChannelDB",
"as",
"_CHANNELDB",
"self",
".",
"_cached_channel_cmds",
"=",
"{",
"}",
"self",
".",
"_ca... | [
244,
4
] | [
257,
29
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.get | (self, channelname=None) |
Get a channel from the handler, or all channels
Args:
channelame (str, optional): Channel key, case insensitive.
Returns
channels (list): The matching channels in a list, or all
channels in the handler.
|
Get a channel from the handler, or all channels | def get(self, channelname=None):
"""
Get a channel from the handler, or all channels
Args:
channelame (str, optional): Channel key, case insensitive.
Returns
channels (list): The matching channels in a list, or all
channels in the handler.
... | [
"def",
"get",
"(",
"self",
",",
"channelname",
"=",
"None",
")",
":",
"if",
"channelname",
":",
"channel",
"=",
"self",
".",
"_cached_channels",
".",
"get",
"(",
"channelname",
".",
"lower",
"(",
")",
",",
"None",
")",
"return",
"[",
"channel",
"]",
... | [
259,
4
] | [
273,
45
] | python | en | ['en', 'error', 'th'] | False |
ChannelHandler.get_cmdset | (self, source_object) |
Retrieve cmdset for channels this source_object has
access to send to.
Args:
source_object (Object): An object subscribing to one
or more channels.
Returns:
cmdsets (list): The Channel-Cmdsets `source_object` has
access to.
... |
Retrieve cmdset for channels this source_object has
access to send to. | def get_cmdset(self, source_object):
"""
Retrieve cmdset for channels this source_object has
access to send to.
Args:
source_object (Object): An object subscribing to one
or more channels.
Returns:
cmdsets (list): The Channel-Cmdsets `sou... | [
"def",
"get_cmdset",
"(",
"self",
",",
"source_object",
")",
":",
"if",
"source_object",
"in",
"self",
".",
"_cached_cmdsets",
":",
"return",
"self",
".",
"_cached_cmdsets",
"[",
"source_object",
"]",
"else",
":",
"# create a new cmdset holding all viable channels",
... | [
275,
4
] | [
305,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.opacity | (self) |
Sets the marker opacity of unselected points, applied only when
a selection exists.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
|
Sets the marker opacity of unselected points, applied only when
a selection exists.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1] | def opacity(self):
"""
Sets the marker opacity of unselected points, applied only when
a selection exists.
The 'opacity' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
... | [
"def",
"opacity",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"opacity\"",
"]"
] | [
15,
4
] | [
27,
30
] | python | en | ['en', 'error', 'th'] | False |
Marker.__init__ | (self, arg=None, opacity=None, **kwargs) |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.choroplethmapb
ox.unselected.Marker`
opacity
Sets the marker opacity o... |
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.choroplethmapb
ox.unselected.Marker`
opacity
Sets the marker opacity o... | def __init__(self, arg=None, opacity=None, **kwargs):
"""
Construct a new Marker object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.choroplethmapb
ox.unselec... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"opacity",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Marker",
",",
"self",
")",
".",
"__init__",
"(",
"\"marker\"",
")",
"if",
"\"_parent\"",
"in",
"kwargs",
":",
"s... | [
43,
4
] | [
101,
34
] | python | en | ['en', 'error', 'th'] | False |
AgentState.get_active_agent | (self) |
Return active messenger agent.
:return:
a ChatServiceAgent, which corresponds to the active agent for this
agent state.
|
Return active messenger agent. | def get_active_agent(self) -> ChatServiceAgent:
"""
Return active messenger agent.
:return:
a ChatServiceAgent, which corresponds to the active agent for this
agent state.
"""
return self.active_agent | [
"def",
"get_active_agent",
"(",
"self",
")",
"->",
"ChatServiceAgent",
":",
"return",
"self",
".",
"active_agent"
] | [
43,
4
] | [
51,
32
] | python | en | ['en', 'error', 'th'] | False |
AgentState.set_active_agent | (self, active_agent: ChatServiceAgent) |
Set active agent for this agent.
:param active_agent:
A ChatServiceAgent, the new active agent for this given agent state
|
Set active agent for this agent. | def set_active_agent(self, active_agent: ChatServiceAgent):
"""
Set active agent for this agent.
:param active_agent:
A ChatServiceAgent, the new active agent for this given agent state
"""
self.active_agent = active_agent | [
"def",
"set_active_agent",
"(",
"self",
",",
"active_agent",
":",
"ChatServiceAgent",
")",
":",
"self",
".",
"active_agent",
"=",
"active_agent"
] | [
53,
4
] | [
60,
40
] | python | en | ['en', 'error', 'th'] | False |
AgentState.get_overworld_agent | (self) |
Return overworld messenger agent.
:return:
a ChatServiceAgent, which corresponds agent object in the overworld
|
Return overworld messenger agent. | def get_overworld_agent(self) -> ChatServiceAgent:
"""
Return overworld messenger agent.
:return:
a ChatServiceAgent, which corresponds agent object in the overworld
"""
return self.overworld_agent | [
"def",
"get_overworld_agent",
"(",
"self",
")",
"->",
"ChatServiceAgent",
":",
"return",
"self",
".",
"overworld_agent"
] | [
62,
4
] | [
69,
35
] | python | en | ['en', 'error', 'th'] | False |
AgentState.get_id | (self) |
Return the agent's ID.
:return:
int agent's service ID
|
Return the agent's ID. | def get_id(self) -> int:
"""
Return the agent's ID.
:return:
int agent's service ID
"""
return self.service_id | [
"def",
"get_id",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"service_id"
] | [
71,
4
] | [
78,
30
] | python | en | ['en', 'error', 'th'] | False |
AgentState.has_task | (self, task_id: str) |
Determine if an agent is in a task.
:param task_id:
task id
:return:
if agent is in that task.
|
Determine if an agent is in a task. | def has_task(self, task_id: str) -> bool:
"""
Determine if an agent is in a task.
:param task_id:
task id
:return:
if agent is in that task.
"""
return task_id in self.task_id_to_agent | [
"def",
"has_task",
"(",
"self",
",",
"task_id",
":",
"str",
")",
"->",
"bool",
":",
"return",
"task_id",
"in",
"self",
".",
"task_id_to_agent"
] | [
80,
4
] | [
90,
47
] | python | en | ['en', 'error', 'th'] | False |
AgentState.get_agent_for_task | (self, task_id: str) |
Return ChatServiceAgent for given task id.
For each "player", a separate agent is created for each task. This
returns the appropriate MessengerAgent given the task id
:param task_id:
task id
:return:
ChatServiceAgent object associated with the given ta... |
Return ChatServiceAgent for given task id. | def get_agent_for_task(self, task_id: str) -> Optional[ChatServiceAgent]:
"""
Return ChatServiceAgent for given task id.
For each "player", a separate agent is created for each task. This
returns the appropriate MessengerAgent given the task id
:param task_id:
task ... | [
"def",
"get_agent_for_task",
"(",
"self",
",",
"task_id",
":",
"str",
")",
"->",
"Optional",
"[",
"ChatServiceAgent",
"]",
":",
"if",
"self",
".",
"has_task",
"(",
"task_id",
")",
":",
"return",
"self",
".",
"task_id_to_agent",
"[",
"task_id",
"]",
"else",... | [
92,
4
] | [
108,
23
] | python | en | ['en', 'error', 'th'] | False |
AgentState.assign_agent_to_task | (self, agent: ChatServiceAgent, task_id: str) |
Mark agent in task.
:param agent:
ChatServiceAgent object to mark in task
:param task_id:
string task name
|
Mark agent in task. | def assign_agent_to_task(self, agent: ChatServiceAgent, task_id: str):
"""
Mark agent in task.
:param agent:
ChatServiceAgent object to mark in task
:param task_id:
string task name
"""
self.task_id_to_agent[task_id] = agent | [
"def",
"assign_agent_to_task",
"(",
"self",
",",
"agent",
":",
"ChatServiceAgent",
",",
"task_id",
":",
"str",
")",
":",
"self",
".",
"task_id_to_agent",
"[",
"task_id",
"]",
"=",
"agent"
] | [
110,
4
] | [
119,
46
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.__init__ | (self, opt: Opt) |
Create a ChatServiceManager using the given setup options.
|
Create a ChatServiceManager using the given setup options.
| def __init__(self, opt: Opt):
"""
Create a ChatServiceManager using the given setup options.
"""
# Manager attributes
self.opt = opt
self.server_url = None
self.port = 443
self.agent_pool_change_condition = threading.Condition()
self.active_worlds:... | [
"def",
"__init__",
"(",
"self",
",",
"opt",
":",
"Opt",
")",
":",
"# Manager attributes",
"self",
".",
"opt",
"=",
"opt",
"self",
".",
"server_url",
"=",
"None",
"self",
".",
"port",
"=",
"443",
"self",
".",
"agent_pool_change_condition",
"=",
"threading",... | [
145,
4
] | [
167,
52
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._parse_config | (self, opt: Opt) |
Parse config for task.
Use this to parse all options and settings necessary to set the variables for
the conversation
|
Parse config for task. | def _parse_config(self, opt: Opt):
"""
Parse config for task.
Use this to parse all options and settings necessary to set the variables for
the conversation
"""
self.debug = opt['is_debug']
self.config = opt['config']
self.overworld = self.config['overwor... | [
"def",
"_parse_config",
"(",
"self",
",",
"opt",
":",
"Opt",
")",
":",
"self",
".",
"debug",
"=",
"opt",
"[",
"'is_debug'",
"]",
"self",
".",
"config",
"=",
"opt",
"[",
"'config'",
"]",
"self",
".",
"overworld",
"=",
"self",
".",
"config",
"[",
"'o... | [
173,
4
] | [
203,
39
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.parse_additional_args | (self, opt: Opt) |
Parse any other service specific args here.
|
Parse any other service specific args here.
| def parse_additional_args(self, opt: Opt):
"""
Parse any other service specific args here.
""" | [
"def",
"parse_additional_args",
"(",
"self",
",",
"opt",
":",
"Opt",
")",
":"
] | [
206,
4
] | [
209,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._get_port | (self) |
Return the port number currently being used.
|
Return the port number currently being used.
| def _get_port(self) -> int:
"""
Return the port number currently being used.
"""
return self.port | [
"def",
"_get_port",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"port"
] | [
212,
4
] | [
216,
24
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._set_port | (self, port_no: int) |
Use a custom port number.
:param port_no: New port number to be used
|
Use a custom port number. | def _set_port(self, port_no: int):
"""
Use a custom port number.
:param port_no: New port number to be used
"""
self.port = port_no | [
"def",
"_set_port",
"(",
"self",
",",
"port_no",
":",
"int",
")",
":",
"self",
".",
"port",
"=",
"port_no"
] | [
218,
4
] | [
224,
27
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._complete_setup | (self) |
Complete necessary setup items.
Consider this as a unified method for setting up. Call every other functions
used in setup from here. To be called during instantiation
|
Complete necessary setup items. | def _complete_setup(self):
"""
Complete necessary setup items.
Consider this as a unified method for setting up. Call every other functions
used in setup from here. To be called during instantiation
""" | [
"def",
"_complete_setup",
"(",
"self",
")",
":"
] | [
227,
4
] | [
233,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._load_model | (self) |
Load model if necessary.
|
Load model if necessary.
| def _load_model(self):
"""
Load model if necessary.
""" | [
"def",
"_load_model",
"(",
"self",
")",
":"
] | [
236,
4
] | [
239,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._expire_all_conversations | (self) |
Iterate through all sub-worlds and shut them down.
|
Iterate through all sub-worlds and shut them down.
| def _expire_all_conversations(self):
"""
Iterate through all sub-worlds and shut them down.
"""
self.running = False
for agent_id, overworld_fut in self.agent_id_to_overworld_future.items():
self.observe_message(
agent_id,
'System: The ... | [
"def",
"_expire_all_conversations",
"(",
"self",
")",
":",
"self",
".",
"running",
"=",
"False",
"for",
"agent_id",
",",
"overworld_fut",
"in",
"self",
".",
"agent_id_to_overworld_future",
".",
"items",
"(",
")",
":",
"self",
".",
"observe_message",
"(",
"agen... | [
241,
4
] | [
267,
33
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._get_unique_pool | (self) |
Return unique pool.
Returns a filtered version of the agent pool where each agent is
only listed a maximum of one time.
:return:
a dictionary mapping world_types to agent pools
|
Return unique pool. | def _get_unique_pool(self):
"""
Return unique pool.
Returns a filtered version of the agent pool where each agent is
only listed a maximum of one time.
:return:
a dictionary mapping world_types to agent pools
"""
valid_pools = {}
for world_ty... | [
"def",
"_get_unique_pool",
"(",
"self",
")",
":",
"valid_pools",
"=",
"{",
"}",
"for",
"world_type",
",",
"agent_pool",
"in",
"self",
".",
"agent_pool",
".",
"items",
"(",
")",
":",
"eligibility_function",
"=",
"utils",
".",
"get_eligibility_fn",
"(",
"self"... | [
269,
4
] | [
290,
26
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.restructure_message | (self, message: Dict[str, Any]) |
Use this function to restructure the message into the provided format.
returns the appropriate message.
|
Use this function to restructure the message into the provided format. | def restructure_message(self, message: Dict[str, Any]) -> Dict[str, Any]:
"""
Use this function to restructure the message into the provided format.
returns the appropriate message.
""" | [
"def",
"restructure_message",
"(",
"self",
",",
"message",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Dict",
"[",
"str",
",",
"Any",
"]",
":"
] | [
293,
4
] | [
298,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._handle_bot_read | (self, agent_id: int) |
Use this function to handle/execute events once the bot has observed the
message.
|
Use this function to handle/execute events once the bot has observed the
message.
| def _handle_bot_read(self, agent_id: int):
"""
Use this function to handle/execute events once the bot has observed the
message.
""" | [
"def",
"_handle_bot_read",
"(",
"self",
",",
"agent_id",
":",
"int",
")",
":"
] | [
301,
4
] | [
305,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._confirm_message_delivery | (self, event: Dict[str, Any]) |
A callback for when messages are marked as delivered.
|
A callback for when messages are marked as delivered.
| def _confirm_message_delivery(self, event: Dict[str, Any]):
"""
A callback for when messages are marked as delivered.
""" | [
"def",
"_confirm_message_delivery",
"(",
"self",
",",
"event",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":"
] | [
308,
4
] | [
311,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._remove_agent | (self, agent_id: int) |
Remove an agent from the system (after they disconnect or leave in some other
way)
|
Remove an agent from the system (after they disconnect or leave in some other
way)
| def _remove_agent(self, agent_id: int):
"""
Remove an agent from the system (after they disconnect or leave in some other
way)
"""
self.observe_message(agent_id, 'See you later!')
for world_type in self.agent_pool:
agent_state = self.get_agent_state(agent_id)
... | [
"def",
"_remove_agent",
"(",
"self",
",",
"agent_id",
":",
"int",
")",
":",
"self",
".",
"observe_message",
"(",
"agent_id",
",",
"'See you later!'",
")",
"for",
"world_type",
"in",
"self",
".",
"agent_pool",
":",
"agent_state",
"=",
"self",
".",
"get_agent_... | [
327,
4
] | [
340,
55
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._launch_overworld | (self, agent_id: int) |
Launch an overworld for the given agent id, replacing the existing overworld if
it exists already.
|
Launch an overworld for the given agent id, replacing the existing overworld if
it exists already.
| def _launch_overworld(self, agent_id: int):
"""
Launch an overworld for the given agent id, replacing the existing overworld if
it exists already.
"""
agent_state = self.get_agent_state(agent_id)
task_id = 'overworld-{}-{}'.format(agent_id, time.time())
if agent_s... | [
"def",
"_launch_overworld",
"(",
"self",
",",
"agent_id",
":",
"int",
")",
":",
"agent_state",
"=",
"self",
".",
"get_agent_state",
"(",
"agent_id",
")",
"task_id",
"=",
"'overworld-{}-{}'",
".",
"format",
"(",
"agent_id",
",",
"time",
".",
"time",
"(",
")... | [
342,
4
] | [
377,
60
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._on_first_message | (self, message: Dict[str, Any]) |
Handle first message from player.
Run when a psid is given that is not paired with any assignment yet.
Launch an overworld, complete onboarding, etc.
:param message:
message sent from agent
|
Handle first message from player. | def _on_first_message(self, message: Dict[str, Any]):
"""
Handle first message from player.
Run when a psid is given that is not paired with any assignment yet.
Launch an overworld, complete onboarding, etc.
:param message:
message sent from agent
"""
... | [
"def",
"_on_first_message",
"(",
"self",
",",
"message",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"if",
"self",
".",
"service_reference_id",
"is",
"None",
":",
"self",
".",
"service_reference_id",
"=",
"message",
"[",
"'recipient'",
"]",
"[",
... | [
379,
4
] | [
402,
40
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._on_new_message | (self, message: Dict[str, Any]) |
Put an incoming message onto the correct agent's message queue.
:param message:
message to put on queue
|
Put an incoming message onto the correct agent's message queue. | def _on_new_message(self, message: Dict[str, Any]):
"""
Put an incoming message onto the correct agent's message queue.
:param message:
message to put on queue
"""
message = self.restructure_message(message)
agent_id = message['sender']['id']
if not s... | [
"def",
"_on_new_message",
"(",
"self",
",",
"message",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"message",
"=",
"self",
".",
"restructure_message",
"(",
"message",
")",
"agent_id",
"=",
"message",
"[",
"'sender'",
"]",
"[",
"'id'",
"]",
"if"... | [
404,
4
] | [
451,
35
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.add_agent_to_pool | (self, agent: AgentState, world_type: str = 'default') |
Add the agent to pool.
:param agent:
AgentState object
:param world_type:
Name of world whose pool should now contain agent
|
Add the agent to pool. | def add_agent_to_pool(self, agent: AgentState, world_type: str = 'default'):
"""
Add the agent to pool.
:param agent:
AgentState object
:param world_type:
Name of world whose pool should now contain agent
"""
with self.agent_pool_change_condition:... | [
"def",
"add_agent_to_pool",
"(",
"self",
",",
"agent",
":",
"AgentState",
",",
"world_type",
":",
"str",
"=",
"'default'",
")",
":",
"with",
"self",
".",
"agent_pool_change_condition",
":",
"self",
".",
"_log_debug",
"(",
"'Adding agent {} to pool...'",
".",
"fo... | [
453,
4
] | [
467,
68
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.remove_agent_from_pool | (
self, agent: AgentState, world_type: str = 'default', mark_removed: bool = True
) |
Remove agent from the pool.
:param agent:
AgentState object
:param world_type:
world name
:param mark_removed:
whether to mark an agent as removed from the pool
|
Remove agent from the pool. | def remove_agent_from_pool(
self, agent: AgentState, world_type: str = 'default', mark_removed: bool = True
):
"""
Remove agent from the pool.
:param agent:
AgentState object
:param world_type:
world name
:param mark_removed:
wheth... | [
"def",
"remove_agent_from_pool",
"(",
"self",
",",
"agent",
":",
"AgentState",
",",
"world_type",
":",
"str",
"=",
"'default'",
",",
"mark_removed",
":",
"bool",
"=",
"True",
")",
":",
"with",
"self",
".",
"agent_pool_change_condition",
":",
"self",
".",
"_l... | [
469,
4
] | [
493,
86
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._create_agent | (self, task_id: str, agent_id: int) |
Initialize an agent and return it.
Called each time an agent is placed into a new task.
:param task_id:
task identifier
:param agent_id:
agent id
|
Initialize an agent and return it. | def _create_agent(self, task_id: str, agent_id: int) -> ChatServiceAgent:
"""
Initialize an agent and return it.
Called each time an agent is placed into a new task.
:param task_id:
task identifier
:param agent_id:
agent id
""" | [
"def",
"_create_agent",
"(",
"self",
",",
"task_id",
":",
"str",
",",
"agent_id",
":",
"int",
")",
"->",
"ChatServiceAgent",
":"
] | [
496,
4
] | [
506,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._get_agent | (self, agent_id: int, task_id: str) |
Return agent object for given agent ID and task ID.
:param agent_id:
agent identifier
:param task_id:
task name
:return:
ChatServiceAgent object associated with given agent ID and task ID if
possible, else None
|
Return agent object for given agent ID and task ID. | def _get_agent(self, agent_id: int, task_id: str) -> Optional[ChatServiceAgent]:
"""
Return agent object for given agent ID and task ID.
:param agent_id:
agent identifier
:param task_id:
task name
:return:
ChatServiceAgent object associated w... | [
"def",
"_get_agent",
"(",
"self",
",",
"agent_id",
":",
"int",
",",
"task_id",
":",
"str",
")",
"->",
"Optional",
"[",
"ChatServiceAgent",
"]",
":",
"agent_state",
"=",
"self",
".",
"get_agent_state",
"(",
"agent_id",
")",
"if",
"agent_state",
"is",
"not",... | [
508,
4
] | [
525,
19
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.get_agent_state | (self, agent_id: int) |
Return agent state.
:param agent_id:
agent identifier
:return:
AgentState object if agent_id is being tracked, else None
|
Return agent state. | def get_agent_state(self, agent_id: int) -> Optional[AgentState]:
"""
Return agent state.
:param agent_id:
agent identifier
:return:
AgentState object if agent_id is being tracked, else None
"""
if agent_id in self.messenger_agent_states:
... | [
"def",
"get_agent_state",
"(",
"self",
",",
"agent_id",
":",
"int",
")",
"->",
"Optional",
"[",
"AgentState",
"]",
":",
"if",
"agent_id",
"in",
"self",
".",
"messenger_agent_states",
":",
"return",
"self",
".",
"messenger_agent_states",
"[",
"agent_id",
"]",
... | [
527,
4
] | [
539,
19
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.setup_server | (self) |
Prepare the Chat Service server for handling messages.
|
Prepare the Chat Service server for handling messages.
| def setup_server(self):
"""
Prepare the Chat Service server for handling messages.
"""
pass | [
"def",
"setup_server",
"(",
"self",
")",
":",
"pass"
] | [
542,
4
] | [
546,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.setup_socket | (self) |
Set up socket to start communicating to workers.
|
Set up socket to start communicating to workers.
| def setup_socket(self):
"""
Set up socket to start communicating to workers.
"""
pass | [
"def",
"setup_socket",
"(",
"self",
")",
":",
"pass"
] | [
549,
4
] | [
553,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.init_new_state | (self) |
Prepare for new run.
Initialize everything in the agent, task, and thread states
|
Prepare for new run. | def init_new_state(self):
"""
Prepare for new run.
Initialize everything in the agent, task, and thread states
"""
self.agent_pool = {}
self.messenger_agent_states = {}
self.task_to_agent_ids = {}
self.agent_id_to_overworld_future = {} | [
"def",
"init_new_state",
"(",
"self",
")",
":",
"self",
".",
"agent_pool",
"=",
"{",
"}",
"self",
".",
"messenger_agent_states",
"=",
"{",
"}",
"self",
".",
"task_to_agent_ids",
"=",
"{",
"}",
"self",
".",
"agent_id_to_overworld_future",
"=",
"{",
"}"
] | [
555,
4
] | [
564,
46
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.start_new_run | (self) |
Begin new run.
|
Begin new run.
| def start_new_run(self):
"""
Begin new run.
"""
self.run_id = str(int(time.time()))
self.task_group_id = '{}_{}'.format(self.opt['task'], self.run_id) | [
"def",
"start_new_run",
"(",
"self",
")",
":",
"self",
".",
"run_id",
"=",
"str",
"(",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
")",
"self",
".",
"task_group_id",
"=",
"'{}_{}'",
".",
"format",
"(",
"self",
".",
"opt",
"[",
"'task'",
"]",
... | [
566,
4
] | [
571,
74
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.check_timeout_in_pool | (
self,
world_type: str,
agent_pool: List[AgentState],
max_time_in_pool: int,
backup_task: str = None,
) |
Check for timed-out agents in pool.
:param world_type:
world type
:param agent_pool:
list of AgentStates
:param max_time_in_pool:
maximum time allowed for agent to be in pool
:param backup_task:
backup_task to start if we reach a ... |
Check for timed-out agents in pool. | def check_timeout_in_pool(
self,
world_type: str,
agent_pool: List[AgentState],
max_time_in_pool: int,
backup_task: str = None,
):
"""
Check for timed-out agents in pool.
:param world_type:
world type
:param agent_pool:
... | [
"def",
"check_timeout_in_pool",
"(",
"self",
",",
"world_type",
":",
"str",
",",
"agent_pool",
":",
"List",
"[",
"AgentState",
"]",
",",
"max_time_in_pool",
":",
"int",
",",
"backup_task",
":",
"str",
"=",
"None",
",",
")",
":",
"for",
"agent_state",
"in",... | [
573,
4
] | [
622,
71
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._get_done_callback_for_agents | (
self, task_id: str, world_type: str, agents: List[ChatServiceAgent]
) |
Create done callback for finishing task world with particular agents.
:param task_id:
task identifier
:param world_type:
world name
:param agents:
agents for which we are retrieving done callback
:return:
the done callback, i.e. ... |
Create done callback for finishing task world with particular agents. | def _get_done_callback_for_agents(
self, task_id: str, world_type: str, agents: List[ChatServiceAgent]
) -> Callable[[Future], None]:
"""
Create done callback for finishing task world with particular agents.
:param task_id:
task identifier
:param world_type:
... | [
"def",
"_get_done_callback_for_agents",
"(",
"self",
",",
"task_id",
":",
"str",
",",
"world_type",
":",
"str",
",",
"agents",
":",
"List",
"[",
"ChatServiceAgent",
"]",
")",
"->",
"Callable",
"[",
"[",
"Future",
"]",
",",
"None",
"]",
":",
"def",
"_done... | [
624,
4
] | [
683,
29
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.start_task | (self) |
Begin handling task.
Periodically check to see when enough agents are in the agent pool to start an
instance of the task. Continue doing this until the desired number of
conversations is had.
|
Begin handling task. | def start_task(self):
"""
Begin handling task.
Periodically check to see when enough agents are in the agent pool to start an
instance of the task. Continue doing this until the desired number of
conversations is had.
"""
self.running = True
while self.r... | [
"def",
"start_task",
"(",
"self",
")",
":",
"self",
".",
"running",
"=",
"True",
"while",
"self",
".",
"running",
":",
"# Loop forever until the server is shut down",
"with",
"self",
".",
"agent_pool_change_condition",
":",
"valid_pools",
"=",
"self",
".",
"_get_u... | [
685,
4
] | [
763,
49
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.shutdown | (self) |
Handle any client shutdown cleanup.
|
Handle any client shutdown cleanup.
| def shutdown(self):
"""
Handle any client shutdown cleanup.
"""
try:
self.is_running = False
self.world_runner.shutdown()
if not self.bypass_server_setup:
self.socket.keep_running = False
self._expire_all_conversations()
... | [
"def",
"shutdown",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"is_running",
"=",
"False",
"self",
".",
"world_runner",
".",
"shutdown",
"(",
")",
"if",
"not",
"self",
".",
"bypass_server_setup",
":",
"self",
".",
"socket",
".",
"keep_running",
"=",
... | [
765,
4
] | [
780,
84
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.observe_message | (
self,
receiver_id: int,
text: str,
quick_replies: List[str] = None,
persona_id: str = None,
) |
Send a message through the message manager.
:param receiver_id:
identifier for agent to send message to
:param text:
text to send
:param quick_replies:
list of quick replies
:param persona_id:
identifier of persona
|
Send a message through the message manager. | def observe_message(
self,
receiver_id: int,
text: str,
quick_replies: List[str] = None,
persona_id: str = None,
):
"""
Send a message through the message manager.
:param receiver_id:
identifier for agent to send message to
:param ... | [
"def",
"observe_message",
"(",
"self",
",",
"receiver_id",
":",
"int",
",",
"text",
":",
"str",
",",
"quick_replies",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"persona_id",
":",
"str",
"=",
"None",
",",
")",
":"
] | [
783,
4
] | [
801,
11
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager._handle_webhook_event | (self, event: Dict[str, Any]) |
Use this if the service uses webhooks.
|
Use this if the service uses webhooks.
| def _handle_webhook_event(self, event: Dict[str, Any]):
"""
Use this if the service uses webhooks.
"""
pass | [
"def",
"_handle_webhook_event",
"(",
"self",
",",
"event",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
":",
"pass"
] | [
805,
4
] | [
809,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.mark_removed | (self, agent_id: int, pageid: int) |
Mark the agent as removed from the pool.
Can be overriden to change other metadata linked to agent removal.
:param agent_id:
int agent psid
:param pageid:
int page id
|
Mark the agent as removed from the pool. | def mark_removed(self, agent_id: int, pageid: int):
"""
Mark the agent as removed from the pool.
Can be overriden to change other metadata linked to agent removal.
:param agent_id:
int agent psid
:param pageid:
int page id
"""
pass | [
"def",
"mark_removed",
"(",
"self",
",",
"agent_id",
":",
"int",
",",
"pageid",
":",
"int",
")",
":",
"pass"
] | [
811,
4
] | [
822,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.after_agent_removed | (self, agent_id: int) |
Perform any changes to metadata on agent removal.
override if extra bookkeeping must be done when removing agent
|
Perform any changes to metadata on agent removal. | def after_agent_removed(self, agent_id: int):
"""
Perform any changes to metadata on agent removal.
override if extra bookkeeping must be done when removing agent
"""
pass | [
"def",
"after_agent_removed",
"(",
"self",
",",
"agent_id",
":",
"int",
")",
":",
"pass"
] | [
824,
4
] | [
830,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.observe_payload | (
self,
receiver_id: str,
data: Dict[Any, Any],
quick_replies: List[str] = None,
persona_id: str = None,
) |
Send a payload through the message manager.
:param receiver_id:
int identifier for agent to send message to
:param data:
object data to send
:param quick_replies:
list of quick replies
:param persona_id:
identifier of persona
... |
Send a payload through the message manager. | def observe_payload(
self,
receiver_id: str,
data: Dict[Any, Any],
quick_replies: List[str] = None,
persona_id: str = None,
):
"""
Send a payload through the message manager.
:param receiver_id:
int identifier for agent to send message to
... | [
"def",
"observe_payload",
"(",
"self",
",",
"receiver_id",
":",
"str",
",",
"data",
":",
"Dict",
"[",
"Any",
",",
"Any",
"]",
",",
"quick_replies",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"persona_id",
":",
"str",
"=",
"None",
",",
")",
":"... | [
834,
4
] | [
853,
12
] | python | en | ['en', 'error', 'th'] | False |
ChatServiceManager.upload_attachment | (self, payload: Dict[str, str]) |
Upload an attachment and return an attachment ID.
:param payload:
dict with the following format:
{'type': <TYPE>, 'url': <URL>} or
{'type': <TYPE>, 'filename': <FILENAME>, 'format': <FILEFORMAT>}.
For example,
{'type': 'image... |
Upload an attachment and return an attachment ID. | def upload_attachment(self, payload: Dict[str, str]) -> str:
"""
Upload an attachment and return an attachment ID.
:param payload:
dict with the following format:
{'type': <TYPE>, 'url': <URL>} or
{'type': <TYPE>, 'filename': <FILENAME>, 'format': <FI... | [
"def",
"upload_attachment",
"(",
"self",
",",
"payload",
":",
"Dict",
"[",
"str",
",",
"str",
"]",
")",
"->",
"str",
":",
"pass"
] | [
855,
4
] | [
869,
12
] | python | en | ['en', 'error', 'th'] | False |
Title.font | (self) |
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatter3d.marker.colorbar.title.Font`
... |
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatter3d.marker.colorbar.title.Font`
... | def font(self):
"""
Sets this color bar's title font. Note that the title's font
used to be set by the now deprecated `titlefont` attribute.
The 'font' property is an instance of Font
that may be specified as:
- An instance of :class:`plotly.graph_objs.scatter3d.ma... | [
"def",
"font",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"font\"",
"]"
] | [
15,
4
] | [
53,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.side | (self) |
Determines the location of color bar's title with respect to
the color bar. Note that the title's location used to be set by
the now deprecated `titleside` attribute.
The 'side' property is an enumeration that may be specified as:
- One of the following enumeration values... |
Determines the location of color bar's title with respect to
the color bar. Note that the title's location used to be set by
the now deprecated `titleside` attribute.
The 'side' property is an enumeration that may be specified as:
- One of the following enumeration values... | def side(self):
"""
Determines the location of color bar's title with respect to
the color bar. Note that the title's location used to be set by
the now deprecated `titleside` attribute.
The 'side' property is an enumeration that may be specified as:
- One of the f... | [
"def",
"side",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"side\"",
"]"
] | [
62,
4
] | [
76,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.text | (self) |
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A ... |
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
- A string
- A ... | def text(self):
"""
Sets the title of the color bar. Note that before the existence
of `title.text`, the title's contents used to be defined as the
`title` attribute itself. This behavior has been deprecated.
The 'text' property is a string and must be specified as:
... | [
"def",
"text",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"text\"",
"]"
] | [
85,
4
] | [
99,
27
] | python | en | ['en', 'error', 'th'] | False |
Title.__init__ | (self, arg=None, font=None, side=None, text=None, **kwargs) |
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatter3d.mark
er.colorbar.Title`
font
Sets this color bar's title font... |
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatter3d.mark
er.colorbar.Title`
font
Sets this color bar's title font... | def __init__(self, arg=None, font=None, side=None, text=None, **kwargs):
"""
Construct a new Title object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.scatter3d.mark
... | [
"def",
"__init__",
"(",
"self",
",",
"arg",
"=",
"None",
",",
"font",
"=",
"None",
",",
"side",
"=",
"None",
",",
"text",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"Title",
",",
"self",
")",
".",
"__init__",
"(",
"\"title\"",
... | [
126,
4
] | [
203,
34
] | python | en | ['en', 'error', 'th'] | False |
render_file | (src, dst, coins, support_info) | Renders `src` template into `dst`.
`src` is a filename, `dst` is an open file object.
| Renders `src` template into `dst`. | def render_file(src, dst, coins, support_info):
"""Renders `src` template into `dst`.
`src` is a filename, `dst` is an open file object.
"""
template = mako.template.Template(filename=src)
result = template.render(
support_info=support_info,
supported_on=make_support_filter(support_... | [
"def",
"render_file",
"(",
"src",
",",
"dst",
",",
"coins",
",",
"support_info",
")",
":",
"template",
"=",
"mako",
".",
"template",
".",
"Template",
"(",
"filename",
"=",
"src",
")",
"result",
"=",
"template",
".",
"render",
"(",
"support_info",
"=",
... | [
129,
0
] | [
141,
21
] | python | en | ['it', 'en', 'en'] | True |
highlight_key | (coin, color) | Return a colorful string where the SYMBOL part is bold. | Return a colorful string where the SYMBOL part is bold. | def highlight_key(coin, color):
"""Return a colorful string where the SYMBOL part is bold."""
keylist = coin["key"].split(":")
if keylist[-1].isdigit():
keylist[-2] = crayon(color, keylist[-2], bold=True)
else:
keylist[-1] = crayon(color, keylist[-1], bold=True)
key = crayon(color, "... | [
"def",
"highlight_key",
"(",
"coin",
",",
"color",
")",
":",
"keylist",
"=",
"coin",
"[",
"\"key\"",
"]",
".",
"split",
"(",
"\":\"",
")",
"if",
"keylist",
"[",
"-",
"1",
"]",
".",
"isdigit",
"(",
")",
":",
"keylist",
"[",
"-",
"2",
"]",
"=",
"... | [
154,
0
] | [
163,
36
] | python | en | ['en', 'en', 'en'] | True |
find_collisions | (coins, field) | Detects collisions in a given field. Returns buckets of colliding coins. | Detects collisions in a given field. Returns buckets of colliding coins. | def find_collisions(coins, field):
"""Detects collisions in a given field. Returns buckets of colliding coins."""
collisions = defaultdict(list)
for coin in coins:
values = coin[field]
if not isinstance(values, list):
values = [values]
for value in values:
col... | [
"def",
"find_collisions",
"(",
"coins",
",",
"field",
")",
":",
"collisions",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"coin",
"in",
"coins",
":",
"values",
"=",
"coin",
"[",
"field",
"]",
"if",
"not",
"isinstance",
"(",
"values",
",",
"list",
")",... | [
166,
0
] | [
175,
62
] | python | en | ['en', 'en', 'en'] | True |
check_dups | (buckets, print_at_level=logging.WARNING) | Analyze and pretty-print results of `coin_info.mark_duplicate_shortcuts`.
`print_at_level` can be one of logging levels.
The results are buckets of colliding symbols.
If the collision is only between ERC20 tokens, it's DEBUG.
If the collision includes one non-token, it's INFO.
If the collision inc... | Analyze and pretty-print results of `coin_info.mark_duplicate_shortcuts`. | def check_dups(buckets, print_at_level=logging.WARNING):
"""Analyze and pretty-print results of `coin_info.mark_duplicate_shortcuts`.
`print_at_level` can be one of logging levels.
The results are buckets of colliding symbols.
If the collision is only between ERC20 tokens, it's DEBUG.
If the colli... | [
"def",
"check_dups",
"(",
"buckets",
",",
"print_at_level",
"=",
"logging",
".",
"WARNING",
")",
":",
"def",
"coin_str",
"(",
"coin",
")",
":",
"\"\"\"Colorize coins. Tokens are cyan, nontokens are red. Coins that are NOT\n marked duplicate get a green asterisk.\n \... | [
295,
0
] | [
365,
23
] | python | en | ['en', 'en', 'en'] | True |
convert_icon | (icon) | Convert PIL icon to TOIF format | Convert PIL icon to TOIF format | def convert_icon(icon):
"""Convert PIL icon to TOIF format"""
# TODO: move this to python-trezor at some point
DIM = 32
icon = icon.resize((DIM, DIM), Image.LANCZOS)
# remove alpha channel, replace with black
bg = Image.new("RGBA", icon.size, (0, 0, 0, 255))
icon = Image.alpha_composite(bg, ... | [
"def",
"convert_icon",
"(",
"icon",
")",
":",
"# TODO: move this to python-trezor at some point",
"DIM",
"=",
"32",
"icon",
"=",
"icon",
".",
"resize",
"(",
"(",
"DIM",
",",
"DIM",
")",
",",
"Image",
".",
"LANCZOS",
")",
"# remove alpha channel, replace with black... | [
557,
0
] | [
576,
16
] | python | en | ['en', 'en', 'it'] | True |
check | (backend, icons, show_duplicates) | Validate coin definitions.
Checks that every btc-like coin is properly filled out, reports duplicate symbols,
missing or invalid icons, backend responses, and uniform key information --
i.e., that all coins of the same type have the same fields in their JSON data.
Uniformity check ignores NEM mosaics ... | Validate coin definitions. | def check(backend, icons, show_duplicates):
"""Validate coin definitions.
Checks that every btc-like coin is properly filled out, reports duplicate symbols,
missing or invalid icons, backend responses, and uniform key information --
i.e., that all coins of the same type have the same fields in their JS... | [
"def",
"check",
"(",
"backend",
",",
"icons",
",",
"show_duplicates",
")",
":",
"if",
"backend",
"and",
"requests",
"is",
"None",
":",
"raise",
"click",
".",
"ClickException",
"(",
"\"You must install requests for backend check\"",
")",
"if",
"icons",
"and",
"no... | [
628,
0
] | [
727,
34
] | python | en | ['fr', 'en', 'en'] | True |
dump | (
outfile,
support,
pretty,
flat_list,
include,
exclude,
include_type,
exclude_type,
filter,
filter_exclude,
exclude_tokens,
device,
) | Dump coin data in JSON format.
This file is structured the same as the internal data. That is, top-level object
is a dict with keys: 'bitcoin', 'eth', 'erc20', 'nem' and 'misc'. Value for each
key is a list of dicts, each describing a known coin.
If '--list' is specified, the top-level object is inste... | Dump coin data in JSON format. | def dump(
outfile,
support,
pretty,
flat_list,
include,
exclude,
include_type,
exclude_type,
filter,
filter_exclude,
exclude_tokens,
device,
):
"""Dump coin data in JSON format.
This file is structured the same as the internal data. That is, top-level object
... | [
"def",
"dump",
"(",
"outfile",
",",
"support",
",",
"pretty",
",",
"flat_list",
",",
"include",
",",
"exclude",
",",
"include_type",
",",
"exclude_type",
",",
"filter",
",",
"filter_exclude",
",",
"exclude_tokens",
",",
"device",
",",
")",
":",
"if",
"excl... | [
745,
0
] | [
855,
27
] | python | ha | ['nl', 'ha', 'it'] | False |
coindefs | (outfile) | Generate signed coin definitions for python-trezor and others
This is currently unused but should enable us to add new coins without having to
update firmware.
| Generate signed coin definitions for python-trezor and others | def coindefs(outfile):
"""Generate signed coin definitions for python-trezor and others
This is currently unused but should enable us to add new coins without having to
update firmware.
"""
coins = coin_info.coin_info().bitcoin
coindefs = {}
for coin in coins:
key = coin["key"]
... | [
"def",
"coindefs",
"(",
"outfile",
")",
":",
"coins",
"=",
"coin_info",
".",
"coin_info",
"(",
")",
".",
"bitcoin",
"coindefs",
"=",
"{",
"}",
"for",
"coin",
"in",
"coins",
":",
"key",
"=",
"coin",
"[",
"\"key\"",
"]",
"icon",
"=",
"Image",
".",
"o... | [
860,
0
] | [
878,
27
] | python | en | ['en', 'en', 'en'] | True |
render | (paths, outfile, verbose, bitcoin_only) | Generate source code from Mako templates.
For every "foo.bar.mako" filename passed, runs the template and
saves the result as "foo.bar". For every directory name passed,
processes all ".mako" files found in that directory.
If `-o` is specified, renders a single file into the specified outfile.
If... | Generate source code from Mako templates. | def render(paths, outfile, verbose, bitcoin_only):
"""Generate source code from Mako templates.
For every "foo.bar.mako" filename passed, runs the template and
saves the result as "foo.bar". For every directory name passed,
processes all ".mako" files found in that directory.
If `-o` is specified,... | [
"def",
"render",
"(",
"paths",
",",
"outfile",
",",
"verbose",
",",
"bitcoin_only",
")",
":",
"if",
"not",
"CAN_RENDER",
":",
"raise",
"click",
".",
"ClickException",
"(",
"\"Please install 'mako' and 'munch'\"",
")",
"if",
"outfile",
"and",
"(",
"len",
"(",
... | [
888,
0
] | [
953,
36
] | python | en | ['en', 'en', 'en'] | True |
BasicWallet.__init__ | (self, config: dict = None) |
Initialize a `BasicWallet` instance.
Args:
config: {name, key, seed, did, auto-create, auto-remove}
|
Initialize a `BasicWallet` instance. | def __init__(self, config: dict = None):
"""
Initialize a `BasicWallet` instance.
Args:
config: {name, key, seed, did, auto-create, auto-remove}
"""
if not config:
config = {}
super(BasicWallet, self).__init__(config)
self._name = config.... | [
"def",
"__init__",
"(",
"self",
",",
"config",
":",
"dict",
"=",
"None",
")",
":",
"if",
"not",
"config",
":",
"config",
"=",
"{",
"}",
"super",
"(",
"BasicWallet",
",",
"self",
")",
".",
"__init__",
"(",
"config",
")",
"self",
".",
"_name",
"=",
... | [
27,
4
] | [
41,
28
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.name | (self) | Accessor for the wallet name. | Accessor for the wallet name. | def name(self) -> str:
"""Accessor for the wallet name."""
return self._name | [
"def",
"name",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"_name"
] | [
44,
4
] | [
46,
25
] | python | en | ['en', 'en', 'en'] | True |
BasicWallet.created | (self) | Check whether the wallet was created on the last open call. | Check whether the wallet was created on the last open call. | def created(self) -> bool:
"""Check whether the wallet was created on the last open call."""
return True | [
"def",
"created",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
49,
4
] | [
51,
19
] | python | en | ['en', 'en', 'en'] | True |
BasicWallet.opened | (self) |
Check whether wallet is currently open.
Returns:
True
|
Check whether wallet is currently open. | def opened(self) -> bool:
"""
Check whether wallet is currently open.
Returns:
True
"""
return True | [
"def",
"opened",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | [
54,
4
] | [
62,
19
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.open | (self) | Not applicable to in-memory wallet. | Not applicable to in-memory wallet. | async def open(self):
"""Not applicable to in-memory wallet."""
pass | [
"async",
"def",
"open",
"(",
"self",
")",
":",
"pass"
] | [
64,
4
] | [
66,
12
] | python | en | ['en', 'en', 'en'] | True |
BasicWallet.close | (self) | Not applicable to in-memory wallet. | Not applicable to in-memory wallet. | async def close(self):
"""Not applicable to in-memory wallet."""
pass | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"pass"
] | [
68,
4
] | [
70,
12
] | python | en | ['en', 'en', 'en'] | True |
BasicWallet.create_signing_key | (
self, seed: str = None, metadata: dict = None
) |
Create a new public/private signing keypair.
Args:
seed: Seed to use for signing key
metadata: Optional metadata to store with the keypair
Returns:
A `KeyInfo` representing the new record
Raises:
WalletDuplicateError: If the resulting v... |
Create a new public/private signing keypair. | async def create_signing_key(
self, seed: str = None, metadata: dict = None
) -> KeyInfo:
"""
Create a new public/private signing keypair.
Args:
seed: Seed to use for signing key
metadata: Optional metadata to store with the keypair
Returns:
... | [
"async",
"def",
"create_signing_key",
"(",
"self",
",",
"seed",
":",
"str",
"=",
"None",
",",
"metadata",
":",
"dict",
"=",
"None",
")",
"->",
"KeyInfo",
":",
"seed",
"=",
"validate_seed",
"(",
"seed",
")",
"or",
"random_seed",
"(",
")",
"verkey",
",",... | [
72,
4
] | [
100,
77
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.get_signing_key | (self, verkey: str) |
Fetch info for a signing keypair.
Args:
verkey: The verification key of the keypair
Returns:
A `KeyInfo` representing the keypair
Raises:
WalletNotFoundError: if no keypair is associated with the verification key
|
Fetch info for a signing keypair. | async def get_signing_key(self, verkey: str) -> KeyInfo:
"""
Fetch info for a signing keypair.
Args:
verkey: The verification key of the keypair
Returns:
A `KeyInfo` representing the keypair
Raises:
WalletNotFoundError: if no keypair is asso... | [
"async",
"def",
"get_signing_key",
"(",
"self",
",",
"verkey",
":",
"str",
")",
"->",
"KeyInfo",
":",
"if",
"verkey",
"not",
"in",
"self",
".",
"_keys",
":",
"raise",
"WalletNotFoundError",
"(",
"\"Key not found: {}\"",
".",
"format",
"(",
"verkey",
")",
"... | [
102,
4
] | [
119,
61
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.replace_signing_key_metadata | (self, verkey: str, metadata: dict) |
Replace the metadata associated with a signing keypair.
Args:
verkey: The verification key of the keypair
metadata: The new metadata to store
Raises:
WalletNotFoundError: if no keypair is associated with the verification key
|
Replace the metadata associated with a signing keypair. | async def replace_signing_key_metadata(self, verkey: str, metadata: dict):
"""
Replace the metadata associated with a signing keypair.
Args:
verkey: The verification key of the keypair
metadata: The new metadata to store
Raises:
WalletNotFoundError: ... | [
"async",
"def",
"replace_signing_key_metadata",
"(",
"self",
",",
"verkey",
":",
"str",
",",
"metadata",
":",
"dict",
")",
":",
"if",
"verkey",
"not",
"in",
"self",
".",
"_keys",
":",
"raise",
"WalletNotFoundError",
"(",
"\"Key not found: {}\"",
".",
"format",... | [
121,
4
] | [
135,
76
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.create_local_did | (
self, seed: str = None, did: str = None, metadata: dict = None
) |
Create and store a new local DID.
Args:
seed: Optional seed to use for did
did: The DID to use
metadata: Metadata to store with DID
Returns:
A `DIDInfo` instance representing the created DID
Raises:
WalletDuplicateError: If ... |
Create and store a new local DID. | async def create_local_did(
self, seed: str = None, did: str = None, metadata: dict = None
) -> DIDInfo:
"""
Create and store a new local DID.
Args:
seed: Optional seed to use for did
did: The DID to use
metadata: Metadata to store with DID
... | [
"async",
"def",
"create_local_did",
"(",
"self",
",",
"seed",
":",
"str",
"=",
"None",
",",
"did",
":",
"str",
"=",
"None",
",",
"metadata",
":",
"dict",
"=",
"None",
")",
"->",
"DIDInfo",
":",
"seed",
"=",
"validate_seed",
"(",
"seed",
")",
"or",
... | [
137,
4
] | [
168,
81
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet._get_did_info | (self, did: str) |
Convert internal DID record to DIDInfo.
Args:
did: The DID to get info for
Returns:
A `DIDInfo` instance for the DID
|
Convert internal DID record to DIDInfo. | def _get_did_info(self, did: str) -> DIDInfo:
"""
Convert internal DID record to DIDInfo.
Args:
did: The DID to get info for
Returns:
A `DIDInfo` instance for the DID
"""
info = self._local_dids[did]
return DIDInfo(did=did, verkey=info["... | [
"def",
"_get_did_info",
"(",
"self",
",",
"did",
":",
"str",
")",
"->",
"DIDInfo",
":",
"info",
"=",
"self",
".",
"_local_dids",
"[",
"did",
"]",
"return",
"DIDInfo",
"(",
"did",
"=",
"did",
",",
"verkey",
"=",
"info",
"[",
"\"verkey\"",
"]",
",",
... | [
170,
4
] | [
182,
88
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.get_local_dids | (self) |
Get list of defined local DIDs.
Returns:
A list of locally stored DIDs as `DIDInfo` instances
|
Get list of defined local DIDs. | async def get_local_dids(self) -> Sequence[DIDInfo]:
"""
Get list of defined local DIDs.
Returns:
A list of locally stored DIDs as `DIDInfo` instances
"""
ret = [self._get_did_info(did) for did in self._local_dids]
return ret | [
"async",
"def",
"get_local_dids",
"(",
"self",
")",
"->",
"Sequence",
"[",
"DIDInfo",
"]",
":",
"ret",
"=",
"[",
"self",
".",
"_get_did_info",
"(",
"did",
")",
"for",
"did",
"in",
"self",
".",
"_local_dids",
"]",
"return",
"ret"
] | [
184,
4
] | [
193,
18
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.get_local_did | (self, did: str) |
Find info for a local DID.
Args:
did: The DID to get info for
Returns:
A `DIDInfo` instance representing the found DID
Raises:
WalletNotFoundError: If the DID is not found
|
Find info for a local DID. | async def get_local_did(self, did: str) -> DIDInfo:
"""
Find info for a local DID.
Args:
did: The DID to get info for
Returns:
A `DIDInfo` instance representing the found DID
Raises:
WalletNotFoundError: If the DID is not found
"""
... | [
"async",
"def",
"get_local_did",
"(",
"self",
",",
"did",
":",
"str",
")",
"->",
"DIDInfo",
":",
"if",
"did",
"not",
"in",
"self",
".",
"_local_dids",
":",
"raise",
"WalletNotFoundError",
"(",
"\"DID not found: {}\"",
".",
"format",
"(",
"did",
")",
")",
... | [
195,
4
] | [
211,
38
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.get_local_did_for_verkey | (self, verkey: str) |
Resolve a local DID from a verkey.
Args:
verkey: The verkey to get the local DID for
Returns:
A `DIDInfo` instance representing the found DID
Raises:
WalletNotFoundError: If the verkey is not found
|
Resolve a local DID from a verkey. | async def get_local_did_for_verkey(self, verkey: str) -> DIDInfo:
"""
Resolve a local DID from a verkey.
Args:
verkey: The verkey to get the local DID for
Returns:
A `DIDInfo` instance representing the found DID
Raises:
WalletNotFoundError: ... | [
"async",
"def",
"get_local_did_for_verkey",
"(",
"self",
",",
"verkey",
":",
"str",
")",
"->",
"DIDInfo",
":",
"for",
"did",
",",
"info",
"in",
"self",
".",
"_local_dids",
".",
"items",
"(",
")",
":",
"if",
"info",
"[",
"\"verkey\"",
"]",
"==",
"verkey... | [
213,
4
] | [
230,
72
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.replace_local_did_metadata | (self, did: str, metadata: dict) |
Replace metadata for a local DID.
Args:
did: The DID to replace metadata for
metadata: The new metadata
Raises:
WalletNotFoundError: If the DID doesn't exist
|
Replace metadata for a local DID. | async def replace_local_did_metadata(self, did: str, metadata: dict):
"""
Replace metadata for a local DID.
Args:
did: The DID to replace metadata for
metadata: The new metadata
Raises:
WalletNotFoundError: If the DID doesn't exist
"""
... | [
"async",
"def",
"replace_local_did_metadata",
"(",
"self",
",",
"did",
":",
"str",
",",
"metadata",
":",
"dict",
")",
":",
"if",
"did",
"not",
"in",
"self",
".",
"_local_dids",
":",
"raise",
"WalletNotFoundError",
"(",
"\"Unknown DID: {}\"",
".",
"format",
"... | [
232,
4
] | [
246,
79
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet._get_private_key | (self, verkey: str, long=False) |
Resolve private key for a wallet DID.
Args:
verkey: The verkey to lookup
long:
Returns:
The private key
Raises:
WalletError: If the private key is not found
|
Resolve private key for a wallet DID. | def _get_private_key(self, verkey: str, long=False) -> bytes:
"""
Resolve private key for a wallet DID.
Args:
verkey: The verkey to lookup
long:
Returns:
The private key
Raises:
WalletError: If the private key is not found
... | [
"def",
"_get_private_key",
"(",
"self",
",",
"verkey",
":",
"str",
",",
"long",
"=",
"False",
")",
"->",
"bytes",
":",
"keys_and_dids",
"=",
"list",
"(",
"self",
".",
"_local_dids",
".",
"values",
"(",
")",
")",
"+",
"list",
"(",
"self",
".",
"_keys"... | [
248,
4
] | [
270,
80
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.sign_message | (self, message: bytes, from_verkey: str) |
Sign a message using the private key associated with a given verkey.
Args:
message: Message bytes to sign
from_verkey: The verkey to use to sign
Returns:
A signature
Raises:
WalletError: If the message is not provided
Wallet... |
Sign a message using the private key associated with a given verkey. | async def sign_message(self, message: bytes, from_verkey: str) -> bytes:
"""
Sign a message using the private key associated with a given verkey.
Args:
message: Message bytes to sign
from_verkey: The verkey to use to sign
Returns:
A signature
... | [
"async",
"def",
"sign_message",
"(",
"self",
",",
"message",
":",
"bytes",
",",
"from_verkey",
":",
"str",
")",
"->",
"bytes",
":",
"if",
"not",
"message",
":",
"raise",
"WalletError",
"(",
"\"Message not provided\"",
")",
"if",
"not",
"from_verkey",
":",
... | [
272,
4
] | [
294,
24
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.verify_message | (
self, message: bytes, signature: bytes, from_verkey: str
) |
Verify a signature against the public key of the signer.
Args:
message: Message to verify
signature: Signature to verify
from_verkey: Verkey to use in verification
Returns:
True if verified, else False
Raises:
WalletError: I... |
Verify a signature against the public key of the signer. | async def verify_message(
self, message: bytes, signature: bytes, from_verkey: str
) -> bool:
"""
Verify a signature against the public key of the signer.
Args:
message: Message to verify
signature: Signature to verify
from_verkey: Verkey to use i... | [
"async",
"def",
"verify_message",
"(",
"self",
",",
"message",
":",
"bytes",
",",
"signature",
":",
"bytes",
",",
"from_verkey",
":",
"str",
")",
"->",
"bool",
":",
"if",
"not",
"from_verkey",
":",
"raise",
"WalletError",
"(",
"\"Verkey not provided\"",
")",... | [
296,
4
] | [
324,
23
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.encrypt_message | (
self, message: bytes, to_verkey: str, from_verkey: str = None
) |
Apply auth_crypt or anon_crypt to a message.
Args:
message: The binary message content
to_verkey: The verkey of the recipient
from_verkey: The verkey of the sender. If provided then auth_crypt is used,
otherwise anon_crypt is used.
Returns:
... |
Apply auth_crypt or anon_crypt to a message. | async def encrypt_message(
self, message: bytes, to_verkey: str, from_verkey: str = None
) -> bytes:
"""
Apply auth_crypt or anon_crypt to a message.
Args:
message: The binary message content
to_verkey: The verkey of the recipient
from_verkey: The... | [
"async",
"def",
"encrypt_message",
"(",
"self",
",",
"message",
":",
"bytes",
",",
"to_verkey",
":",
"str",
",",
"from_verkey",
":",
"str",
"=",
"None",
")",
"->",
"bytes",
":",
"to_verkey_bytes",
"=",
"b58_to_bytes",
"(",
"to_verkey",
")",
"if",
"from_ver... | [
326,
4
] | [
348,
21
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.decrypt_message | (
self, enc_message: bytes, to_verkey: str, use_auth: bool
) |
Decrypt a message assembled by auth_crypt or anon_crypt.
Args:
message: The encrypted message content
to_verkey: The verkey of the recipient. If provided then auth_decrypt is
used, otherwise anon_decrypt is used.
use_auth: True if you would like to a... |
Decrypt a message assembled by auth_crypt or anon_crypt. | async def decrypt_message(
self, enc_message: bytes, to_verkey: str, use_auth: bool
) -> (bytes, str):
"""
Decrypt a message assembled by auth_crypt or anon_crypt.
Args:
message: The encrypted message content
to_verkey: The verkey of the recipient. If provide... | [
"async",
"def",
"decrypt_message",
"(",
"self",
",",
"enc_message",
":",
"bytes",
",",
"to_verkey",
":",
"str",
",",
"use_auth",
":",
"bool",
")",
"->",
"(",
"bytes",
",",
"str",
")",
":",
"secret",
"=",
"self",
".",
"_get_private_key",
"(",
"to_verkey",... | [
350,
4
] | [
373,
35
] | python | en | ['en', 'error', 'th'] | False |
BasicWallet.pack_message | (
self, message: str, to_verkeys: Sequence[str], from_verkey: str = None
) |
Pack a message for one or more recipients.
Args:
message: The message to pack
to_verkeys: List of verkeys to pack for
from_verkey: Sender verkey to pack from
Returns:
The resulting packed message bytes
|
Pack a message for one or more recipients. | async def pack_message(
self, message: str, to_verkeys: Sequence[str], from_verkey: str = None
) -> bytes:
"""
Pack a message for one or more recipients.
Args:
message: The message to pack
to_verkeys: List of verkeys to pack for
from_verkey: Sende... | [
"async",
"def",
"pack_message",
"(",
"self",
",",
"message",
":",
"str",
",",
"to_verkeys",
":",
"Sequence",
"[",
"str",
"]",
",",
"from_verkey",
":",
"str",
"=",
"None",
")",
"->",
"bytes",
":",
"keys_bin",
"=",
"[",
"b58_to_bytes",
"(",
"key",
")",
... | [
375,
4
] | [
393,
21
] | 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.