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
Hoverlabel.bgcolorsrc
(self)
Sets the source reference on Chart Studio Cloud for bgcolor . The 'bgcolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for bgcolor . The 'bgcolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def bgcolorsrc(self): """ Sets the source reference on Chart Studio Cloud for bgcolor . The 'bgcolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["bgcolorsrc"]
[ "def", "bgcolorsrc", "(", "self", ")", ":", "return", "self", "[", "\"bgcolorsrc\"", "]" ]
[ 129, 4 ]
[ 140, 33 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.bordercolor
(self)
Sets the border color of the hover labels for this trace. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva st...
Sets the border color of the hover labels for this trace. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva st...
def bordercolor(self): """ Sets the border color of the hover labels for this trace. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%...
[ "def", "bordercolor", "(", "self", ")", ":", "return", "self", "[", "\"bordercolor\"", "]" ]
[ 149, 4 ]
[ 200, 34 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.bordercolorsrc
(self)
Sets the source reference on Chart Studio Cloud for bordercolor . The 'bordercolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for bordercolor . The 'bordercolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def bordercolorsrc(self): """ Sets the source reference on Chart Studio Cloud for bordercolor . The 'bordercolorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["bo...
[ "def", "bordercolorsrc", "(", "self", ")", ":", "return", "self", "[", "\"bordercolorsrc\"", "]" ]
[ 209, 4 ]
[ 221, 37 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.font
(self)
Sets the font used in hover labels. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.funnelarea.hoverlabel.Font` - A dict of string/value properties that will be passed to the Font constructor ...
Sets the font used in hover labels. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.funnelarea.hoverlabel.Font` - A dict of string/value properties that will be passed to the Font constructor ...
def font(self): """ Sets the font used in hover labels. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.funnelarea.hoverlabel.Font` - A dict of string/value properties that will be passed ...
[ "def", "font", "(", "self", ")", ":", "return", "self", "[", "\"font\"", "]" ]
[ 230, 4 ]
[ 277, 27 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.namelength
(self)
Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it...
Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it...
def namelength(self): """ Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than ...
[ "def", "namelength", "(", "self", ")", ":", "return", "self", "[", "\"namelength\"", "]" ]
[ 286, 4 ]
[ 304, 33 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.namelengthsrc
(self)
Sets the source reference on Chart Studio Cloud for namelength . The 'namelengthsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for namelength . The 'namelengthsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def namelengthsrc(self): """ Sets the source reference on Chart Studio Cloud for namelength . The 'namelengthsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["name...
[ "def", "namelengthsrc", "(", "self", ")", ":", "return", "self", "[", "\"namelengthsrc\"", "]" ]
[ 313, 4 ]
[ 325, 36 ]
python
en
['en', 'error', 'th']
False
Hoverlabel.__init__
( self, arg=None, align=None, alignsrc=None, bgcolor=None, bgcolorsrc=None, bordercolor=None, bordercolorsrc=None, font=None, namelength=None, namelengthsrc=None, **kwargs )
Construct a new Hoverlabel object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.funnelarea.Hoverlabel` align Sets the horizontal alignment of the ...
Construct a new Hoverlabel object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.funnelarea.Hoverlabel` align Sets the horizontal alignment of the ...
def __init__( self, arg=None, align=None, alignsrc=None, bgcolor=None, bgcolorsrc=None, bordercolor=None, bordercolorsrc=None, font=None, namelength=None, namelengthsrc=None, **kwargs ): """ Construct a n...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "align", "=", "None", ",", "alignsrc", "=", "None", ",", "bgcolor", "=", "None", ",", "bgcolorsrc", "=", "None", ",", "bordercolor", "=", "None", ",", "bordercolorsrc", "=", "None", ",", "...
[ 370, 4 ]
[ 502, 34 ]
python
en
['en', 'error', 'th']
False
get_direction_target
(anchors, reg_targets, dir_offset=0, num_bins=2, one_hot=True)
Encode direction to 0 ~ num_bins-1. Args: anchors (torch.Tensor): Concatenated multi-level anchor. reg_targets (torch.Tensor): Bbox regression targets. dir_offset (int): Direction offset. num_bins (int): Number of bins to divide 2*PI. one_hot (bool): Whether to encode as one...
Encode direction to 0 ~ num_bins-1.
def get_direction_target(anchors, reg_targets, dir_offset=0, num_bins=2, one_hot=True): """Encode direction to 0 ~ num_bins-1. Args: anchors (torch.Tensor): Concatenated multi-level anchor. reg_t...
[ "def", "get_direction_target", "(", "anchors", ",", "reg_targets", ",", "dir_offset", "=", "0", ",", "num_bins", "=", "2", ",", "one_hot", "=", "True", ")", ":", "rot_gt", "=", "reg_targets", "[", "...", ",", "6", "]", "+", "anchors", "[", "...", ",", ...
[ 316, 0 ]
[ 345, 26 ]
python
en
['en', 'en', 'en']
True
AnchorTrainMixin.anchor_target_3d
(self, anchor_list, gt_bboxes_list, input_metas, gt_bboxes_ignore_list=None, gt_labels_list=None, label_channels=1, num_classes=1, ...
Compute regression and classification targets for anchors. Args: anchor_list (list[list]): Multi level anchors of each image. gt_bboxes_list (list[:obj:`BaseInstance3DBoxes`]): Ground truth bboxes of each image. input_metas (list[dict]): Meta info of each ima...
Compute regression and classification targets for anchors.
def anchor_target_3d(self, anchor_list, gt_bboxes_list, input_metas, gt_bboxes_ignore_list=None, gt_labels_list=None, label_channels=1, num_class...
[ "def", "anchor_target_3d", "(", "self", ",", "anchor_list", ",", "gt_bboxes_list", ",", "input_metas", ",", "gt_bboxes_ignore_list", "=", "None", ",", "gt_labels_list", "=", "None", ",", "label_channels", "=", "1", ",", "num_classes", "=", "1", ",", "sampling", ...
[ 10, 4 ]
[ 98, 45 ]
python
en
['en', 'en', 'en']
True
AnchorTrainMixin.anchor_target_3d_single
(self, anchors, gt_bboxes, gt_bboxes_ignore, gt_labels, input_meta, label_channels=1, num_classe...
Compute targets of anchors in single batch. Args: anchors (torch.Tensor): Concatenated multi-level anchor. gt_bboxes (:obj:`BaseInstance3DBoxes`): Gt bboxes. gt_bboxes_ignore (torch.Tensor): Ignored gt bboxes. gt_labels (torch.Tensor): Gt class labels. ...
Compute targets of anchors in single batch.
def anchor_target_3d_single(self, anchors, gt_bboxes, gt_bboxes_ignore, gt_labels, input_meta, label_channels=1, ...
[ "def", "anchor_target_3d_single", "(", "self", ",", "anchors", ",", "gt_bboxes", ",", "gt_bboxes_ignore", ",", "gt_labels", ",", "input_meta", ",", "label_channels", "=", "1", ",", "num_classes", "=", "1", ",", "sampling", "=", "True", ")", ":", "if", "isins...
[ 100, 4 ]
[ 234, 76 ]
python
en
['en', 'en', 'en']
True
AnchorTrainMixin.anchor_target_single_assigner
(self, bbox_assigner, anchors, gt_bboxes, gt_bboxes_ignore, gt_labels, input_meta, ...
Assign anchors and encode positive anchors. Args: bbox_assigner (BaseAssigner): assign positive and negative boxes. anchors (torch.Tensor): Concatenated multi-level anchor. gt_bboxes (:obj:`BaseInstance3DBoxes`): Gt bboxes. gt_bboxes_ignore (torch.Tensor): Ignore...
Assign anchors and encode positive anchors.
def anchor_target_single_assigner(self, bbox_assigner, anchors, gt_bboxes, gt_bboxes_ignore, gt_labels, ...
[ "def", "anchor_target_single_assigner", "(", "self", ",", "bbox_assigner", ",", "anchors", ",", "gt_bboxes", ",", "gt_bboxes_ignore", ",", "gt_labels", ",", "input_meta", ",", "num_classes", "=", "1", ",", "sampling", "=", "True", ")", ":", "anchors", "=", "an...
[ 236, 4 ]
[ 313, 48 ]
python
en
['en', 'en', 'en']
True
Font.color
(self)
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 63, 28 ]
python
en
['en', 'error', 'th']
False
Font.family
(self)
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
[ "def", "family", "(", "self", ")", ":", "return", "self", "[", "\"family\"", "]" ]
[ 72, 4 ]
[ 94, 29 ]
python
en
['en', 'error', 'th']
False
Font.size
(self)
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float """ return self["size"]
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
[ 103, 4 ]
[ 112, 27 ]
python
en
['en', 'error', 'th']
False
Font.__init__
(self, arg=None, color=None, family=None, size=None, **kwargs)
Construct a new Font object Sets the font of the update menu button text. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.updatemenu.Font` color...
Construct a new Font object Sets the font of the update menu button text.
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Font object Sets the font of the update menu button text. Parameters ---------- arg dict of properties compatible with this constructor or an ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "family", "=", "None", ",", "size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Font", ",", "self", ")", ".", "__init__", "(", "\"font\"",...
[ 143, 4 ]
[ 226, 34 ]
python
en
['en', 'error', 'th']
False
NodeMaintainer.lastActionEventInfo
(self)
action parameters of last performed action :returns: action parameters or None if there were no actions
action parameters of last performed action
def lastActionEventInfo(self): """ action parameters of last performed action :returns: action parameters or None if there were no actions """ return self._actionLog.last_event
[ "def", "lastActionEventInfo", "(", "self", ")", ":", "return", "self", ".", "_actionLog", ".", "last_event" ]
[ 66, 4 ]
[ 72, 41 ]
python
en
['en', 'error', 'th']
False
NodeMaintainer._unscheduleAction
(self)
Unschedule current action Note that it does not add record to action log and does not do required steps to resume previous action. If you need this - use _cancelScheduledAction
Unschedule current action
def _unscheduleAction(self): """ Unschedule current action Note that it does not add record to action log and does not do required steps to resume previous action. If you need this - use _cancelScheduledAction """ logger.trace("{} unscheduling actions".format(se...
[ "def", "_unscheduleAction", "(", "self", ")", ":", "logger", ".", "trace", "(", "\"{} unscheduling actions\"", ".", "format", "(", "self", ")", ")", "self", ".", "aqStash", "=", "deque", "(", ")", "self", ".", "scheduledAction", "=", "None" ]
[ 74, 4 ]
[ 85, 35 ]
python
en
['en', 'error', 'th']
False
NodeMaintainer._defaultLog
(self, dataDir, config)
Default log for store action txns :param dataDir: :param config: :return: ActionLog
Default log for store action txns :param dataDir: :param config: :return: ActionLog
def _defaultLog(self, dataDir, config): """ Default log for store action txns :param dataDir: :param config: :return: ActionLog """
[ "def", "_defaultLog", "(", "self", ",", "dataDir", ",", "config", ")", ":" ]
[ 99, 4 ]
[ 105, 11 ]
python
en
['en', 'error', 'th']
False
KnowledgeRetrieverAgent.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Add command-line arguments specifically for this agent.
Add command-line arguments specifically for this agent.
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None ) -> ParlaiParser: """ Add command-line arguments specifically for this agent. """ TorchRankerAgent.add_cmdline_args(parser, partial_opt=partial_opt) parser = parser.add_argument_group(...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "TorchRankerAgent", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt", "=", ...
[ 29, 4 ]
[ 52, 21 ]
python
en
['en', 'error', 'th']
False
KnowledgeRetrieverAgent.maintain_retriever_history
(self, obs, actor_id='apprentice')
Maintain texts retrieved by the retriever to mimic the set-up from the data collection for the task.
Maintain texts retrieved by the retriever to mimic the set-up from the data collection for the task.
def maintain_retriever_history(self, obs, actor_id='apprentice'): """ Maintain texts retrieved by the retriever to mimic the set-up from the data collection for the task. """ if actor_id == 'apprentice': if self.retriever_history['episode_done']: # cl...
[ "def", "maintain_retriever_history", "(", "self", ",", "obs", ",", "actor_id", "=", "'apprentice'", ")", ":", "if", "actor_id", "==", "'apprentice'", ":", "if", "self", ".", "retriever_history", "[", "'episode_done'", "]", ":", "# clear history", "self", ".", ...
[ 124, 4 ]
[ 152, 75 ]
python
en
['en', 'error', 'th']
False
KnowledgeRetrieverAgent.get_passages
(self, act)
Format passages retrieved by taking the first paragraph of the top `num_retrieved` passages.
Format passages retrieved by taking the first paragraph of the top `num_retrieved` passages.
def get_passages(self, act): """ Format passages retrieved by taking the first paragraph of the top `num_retrieved` passages. """ retrieved_txt = act.get('text', '') cands = act.get('text_candidates', []) if len(cands) > 0: retrieved_txts = cands[: sel...
[ "def", "get_passages", "(", "self", ",", "act", ")", ":", "retrieved_txt", "=", "act", ".", "get", "(", "'text'", ",", "''", ")", "cands", "=", "act", ".", "get", "(", "'text_candidates'", ",", "[", "]", ")", "if", "len", "(", "cands", ")", ">", ...
[ 186, 4 ]
[ 219, 42 ]
python
en
['en', 'error', 'th']
False
KnowledgeRetrieverAgent.tfidf_retriever_act
(self, history)
Combines and formats texts retrieved by the TFIDF retriever for the chosen topic, the last thing the wizard said, and the last thing the apprentice said.
Combines and formats texts retrieved by the TFIDF retriever for the chosen topic, the last thing the wizard said, and the last thing the apprentice said.
def tfidf_retriever_act(self, history): """ Combines and formats texts retrieved by the TFIDF retriever for the chosen topic, the last thing the wizard said, and the last thing the apprentice said. """ # retrieve on chosen topic chosen_topic_txts = None if self.re...
[ "def", "tfidf_retriever_act", "(", "self", ",", "history", ")", ":", "# retrieve on chosen topic", "chosen_topic_txts", "=", "None", "if", "self", ".", "retriever_history", ".", "get", "(", "'chosen_topic'", ")", ":", "(", "chosen_topic_txts", ",", "chosen_topic_txt...
[ 221, 4 ]
[ 269, 50 ]
python
en
['en', 'error', 'th']
False
KnowledgeRetrieverAgent.observe
(self, observation, actor_id='apprentice')
Observe a dialogue act. Use `actor_id` to indicate whether dialogue acts are from the 'apprentice' or the 'wizard' agent.
Observe a dialogue act.
def observe(self, observation, actor_id='apprentice'): """ Observe a dialogue act. Use `actor_id` to indicate whether dialogue acts are from the 'apprentice' or the 'wizard' agent. """ if actor_id == 'apprentice': self.observation = observation self.m...
[ "def", "observe", "(", "self", ",", "observation", ",", "actor_id", "=", "'apprentice'", ")", ":", "if", "actor_id", "==", "'apprentice'", ":", "self", ".", "observation", "=", "observation", "self", ".", "maintain_retriever_history", "(", "observation", ",", ...
[ 321, 4 ]
[ 337, 35 ]
python
en
['en', 'error', 'th']
False
Font.color
(self)
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 64, 28 ]
python
en
['en', 'error', 'th']
False
Font.colorsrc
(self)
Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def colorsrc(self): """ Sets the source reference on Chart Studio Cloud for color . The 'colorsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["colorsrc"]
[ "def", "colorsrc", "(", "self", ")", ":", "return", "self", "[", "\"colorsrc\"", "]" ]
[ 73, 4 ]
[ 84, 31 ]
python
en
['en', 'error', 'th']
False
Font.family
(self)
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
[ "def", "family", "(", "self", ")", ":", "return", "self", "[", "\"family\"", "]" ]
[ 93, 4 ]
[ 116, 29 ]
python
en
['en', 'error', 'th']
False
Font.familysrc
(self)
Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object
def familysrc(self): """ Sets the source reference on Chart Studio Cloud for family . The 'familysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["familysrc"]
[ "def", "familysrc", "(", "self", ")", ":", "return", "self", "[", "\"familysrc\"", "]" ]
[ 125, 4 ]
[ 136, 32 ]
python
en
['en', 'error', 'th']
False
Font.size
(self)
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] - A tuple, list, or one-dimensional numpy array of the above Returns ------- int|float|numpy.ndarray """ return self["size"...
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
[ 145, 4 ]
[ 155, 27 ]
python
en
['en', 'error', 'th']
False
Font.sizesrc
(self)
Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object
def sizesrc(self): """ Sets the source reference on Chart Studio Cloud for size . The 'sizesrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["sizesrc"]
[ "def", "sizesrc", "(", "self", ")", ":", "return", "self", "[", "\"sizesrc\"", "]" ]
[ 164, 4 ]
[ 175, 30 ]
python
en
['en', 'error', 'th']
False
Font.__init__
( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs )
Construct a new Font object Sets the font used in hover labels. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.choroplethmapb ox.hoverlabel.Font` colo...
Construct a new Font object Sets the font used in hover labels.
def __init__( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs ): """ Construct a new Font object Sets the font used in hover labels. Parameters ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "colorsrc", "=", "None", ",", "family", "=", "None", ",", "familysrc", "=", "None", ",", "size", "=", "None", ",", "sizesrc", "=", "None", ",", "*", "*", "kw...
[ 215, 4 ]
[ 329, 34 ]
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.layout.scene.x axis.Tickformatstop` dtickrange range [*min*, *...
Construct a new Tickformatstop object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.layout.scene.x axis.Tickformatstop` dtickrange range [*min*, *...
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
Mssp.__init__
(self, protocol)
initialize MSSP by storing protocol on ourselves and calling the client to see if it supports MSSP. Args: protocol (Protocol): The active protocol instance.
initialize MSSP by storing protocol on ourselves and calling the client to see if it supports MSSP.
def __init__(self, protocol): """ initialize MSSP by storing protocol on ourselves and calling the client to see if it supports MSSP. Args: protocol (Protocol): The active protocol instance. """ self.protocol = protocol self.protocol.will(MSSP).addCa...
[ "def", "__init__", "(", "self", ",", "protocol", ")", ":", "self", ".", "protocol", "=", "protocol", "self", ".", "protocol", ".", "will", "(", "MSSP", ")", ".", "addCallbacks", "(", "self", ".", "do_mssp", ",", "self", ".", "no_mssp", ")" ]
[ 32, 4 ]
[ 42, 73 ]
python
en
['en', 'error', 'th']
False
Mssp.get_player_count
(self)
Get number of logged-in players. Returns: count (int): The number of players in the MUD.
Get number of logged-in players.
def get_player_count(self): """ Get number of logged-in players. Returns: count (int): The number of players in the MUD. """ return str(self.protocol.sessionhandler.count_loggedin())
[ "def", "get_player_count", "(", "self", ")", ":", "return", "str", "(", "self", ".", "protocol", ".", "sessionhandler", ".", "count_loggedin", "(", ")", ")" ]
[ 44, 4 ]
[ 52, 65 ]
python
en
['en', 'error', 'th']
False
Mssp.get_uptime
(self)
Get how long the portal has been online (reloads are not counted). Returns: uptime (int): Number of seconds of uptime.
Get how long the portal has been online (reloads are not counted).
def get_uptime(self): """ Get how long the portal has been online (reloads are not counted). Returns: uptime (int): Number of seconds of uptime. """ return str(self.protocol.sessionhandler.uptime)
[ "def", "get_uptime", "(", "self", ")", ":", "return", "str", "(", "self", ".", "protocol", ".", "sessionhandler", ".", "uptime", ")" ]
[ 54, 4 ]
[ 62, 55 ]
python
en
['en', 'error', 'th']
False
Mssp.no_mssp
(self, option)
Called when mssp is not requested. This is the normal operation. Args: option (Option): Not used.
Called when mssp is not requested. This is the normal operation.
def no_mssp(self, option): """ Called when mssp is not requested. This is the normal operation. Args: option (Option): Not used. """ self.protocol.handshake_done()
[ "def", "no_mssp", "(", "self", ",", "option", ")", ":", "self", ".", "protocol", ".", "handshake_done", "(", ")" ]
[ 64, 4 ]
[ 73, 38 ]
python
en
['en', 'error', 'th']
False
Mssp.do_mssp
(self, option)
Negotiate all the information. Args: option (Option): Not used.
Negotiate all the information.
def do_mssp(self, option): """ Negotiate all the information. Args: option (Option): Not used. """ self.mssp_table = { # Required fields "NAME": "Evennia", "PLAYERS": self.get_player_count, "UPTIME": self.get_uptime...
[ "def", "do_mssp", "(", "self", ",", "option", ")", ":", "self", ".", "mssp_table", "=", "{", "# Required fields", "\"NAME\"", ":", "\"Evennia\"", ",", "\"PLAYERS\"", ":", "self", ".", "get_player_count", ",", "\"UPTIME\"", ":", "self", ".", "get_uptime", ","...
[ 75, 4 ]
[ 204, 38 ]
python
en
['en', 'error', 'th']
False
X.opacity
(self)
Sets the projection color. 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 projection color. 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 projection color. The 'opacity' property is a number and may be specified as: - An int or float in the interval [0, 1] Returns ------- int|float """ return self["opacity"]
[ "def", "opacity", "(", "self", ")", ":", "return", "self", "[", "\"opacity\"", "]" ]
[ 15, 4 ]
[ 26, 30 ]
python
en
['en', 'error', 'th']
False
X.scale
(self)
Sets the scale factor determining the size of the projection marker points. The 'scale' property is a number and may be specified as: - An int or float in the interval [0, 10] Returns ------- int|float
Sets the scale factor determining the size of the projection marker points. The 'scale' property is a number and may be specified as: - An int or float in the interval [0, 10]
def scale(self): """ Sets the scale factor determining the size of the projection marker points. The 'scale' property is a number and may be specified as: - An int or float in the interval [0, 10] Returns ------- int|float """ retur...
[ "def", "scale", "(", "self", ")", ":", "return", "self", "[", "\"scale\"", "]" ]
[ 35, 4 ]
[ 47, 28 ]
python
en
['en', 'error', 'th']
False
X.show
(self)
Sets whether or not projections are shown along the x axis. The 'show' property must be specified as a bool (either True, or False) Returns ------- bool
Sets whether or not projections are shown along the x axis. The 'show' property must be specified as a bool (either True, or False)
def show(self): """ Sets whether or not projections are shown along the x axis. The 'show' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["show"]
[ "def", "show", "(", "self", ")", ":", "return", "self", "[", "\"show\"", "]" ]
[ 56, 4 ]
[ 67, 27 ]
python
en
['en', 'error', 'th']
False
X.__init__
(self, arg=None, opacity=None, scale=None, show=None, **kwargs)
Construct a new X object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.projection.X` opacity Sets the projection color. scale ...
Construct a new X object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.projection.X` opacity Sets the projection color. scale ...
def __init__(self, arg=None, opacity=None, scale=None, show=None, **kwargs): """ Construct a new X object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "opacity", "=", "None", ",", "scale", "=", "None", ",", "show", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "X", ",", "self", ")", ".", "__init__", "(", "\"x\"", ")...
[ 88, 4 ]
[ 159, 34 ]
python
en
['en', 'error', 'th']
False
Tickfont.color
(self)
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: ...
def color(self): """ The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A name...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 63, 28 ]
python
en
['en', 'error', 'th']
False
Tickfont.family
(self)
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts ...
def family(self): """ HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the prefer...
[ "def", "family", "(", "self", ")", ":", "return", "self", "[", "\"family\"", "]" ]
[ 72, 4 ]
[ 94, 29 ]
python
en
['en', 'error', 'th']
False
Tickfont.size
(self)
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float
The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf]
def size(self): """ The 'size' property is a number and may be specified as: - An int or float in the interval [1, inf] Returns ------- int|float """ return self["size"]
[ "def", "size", "(", "self", ")", ":", "return", "self", "[", "\"size\"", "]" ]
[ 103, 4 ]
[ 112, 27 ]
python
en
['en', 'error', 'th']
False
Tickfont.__init__
(self, arg=None, color=None, family=None, size=None, **kwargs)
Construct a new Tickfont object Sets the color bar's tick label font Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scattergl.mark er.colorbar.Tickfont` ...
Construct a new Tickfont object Sets the color bar's tick label font
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Tickfont object Sets the color bar's tick label font Parameters ---------- arg dict of properties compatible with this constructor or an insta...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "family", "=", "None", ",", "size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Tickfont", ",", "self", ")", ".", "__init__", "(", "\"tick...
[ 143, 4 ]
[ 226, 34 ]
python
en
['en', 'error', 'th']
False
DefaultTeacher.act
(self)
Use DialogTeacher act but set id to "Teacher" for intro message.
Use DialogTeacher act but set id to "Teacher" for intro message.
def act(self): """ Use DialogTeacher act but set id to "Teacher" for intro message. """ reply = super().act() if reply.get('text', '').startswith('You have the following friends'): reply['id'] = 'Teacher' return reply
[ "def", "act", "(", "self", ")", ":", "reply", "=", "super", "(", ")", ".", "act", "(", ")", "if", "reply", ".", "get", "(", "'text'", ",", "''", ")", ".", "startswith", "(", "'You have the following friends'", ")", ":", "reply", "[", "'id'", "]", "...
[ 29, 4 ]
[ 36, 20 ]
python
en
['en', 'error', 'th']
False
DefaultTeacher.setup_data
(self, path)
Load json data of conversations.
Load json data of conversations.
def setup_data(self, path): """ Load json data of conversations. """ print('loading: ' + path) with PathManager.open(path) as data_file: self.loaded_data = json.load(data_file) for ex in self.loaded_data: if len(ex['events']) > 0: #...
[ "def", "setup_data", "(", "self", ",", "path", ")", ":", "print", "(", "'loading: '", "+", "path", ")", "with", "PathManager", ".", "open", "(", "path", ")", "as", "data_file", ":", "self", ".", "loaded_data", "=", "json", ".", "load", "(", "data_file"...
[ 38, 4 ]
[ 86, 75 ]
python
en
['en', 'error', 'th']
False
StyleGenAgent.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Add command-line arguments specifically for this agent.
Add command-line arguments specifically for this agent.
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None ) -> ParlaiParser: """ Add command-line arguments specifically for this agent. """ StyleAgentMixin.add_cmdline_args(parser, partial_opt=partial_opt) TransformerGeneratorAgent.add_cmdlin...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "StyleAgentMixin", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt", "=", ...
[ 22, 4 ]
[ 30, 21 ]
python
en
['en', 'error', 'th']
False
ModelImageChatWorld._run_initial_turn
(self)
Show the image to the human and bot, and show the bot's response to the human.
Show the image to the human and bot, and show the bot's response to the human.
def _run_initial_turn(self) -> None: """ Show the image to the human and bot, and show the bot's response to the human. """ system_id = 'SYSTEM' system_agent_idx = None # Show the image to the human image_act_for_human = { 'episode_done': False, ...
[ "def", "_run_initial_turn", "(", "self", ")", "->", "None", ":", "system_id", "=", "'SYSTEM'", "system_agent_idx", "=", "None", "# Show the image to the human", "image_act_for_human", "=", "{", "'episode_done'", ":", "False", ",", "'id'", ":", "system_id", ",", "'...
[ 41, 4 ]
[ 91, 41 ]
python
en
['en', 'error', 'th']
False
ModelImageChatWorld._postprocess_acts
(self, acts: List[Message], agent_idx: int)
Show the bot the image again on every turn.
Show the bot the image again on every turn.
def _postprocess_acts(self, acts: List[Message], agent_idx: int): """ Show the bot the image again on every turn. """ if agent_idx == 0: # Add the image to every human act, seen by the bot. Also adds in any other # image-related fields needed by the model ...
[ "def", "_postprocess_acts", "(", "self", ",", "acts", ":", "List", "[", "Message", "]", ",", "agent_idx", ":", "int", ")", ":", "if", "agent_idx", "==", "0", ":", "# Add the image to every human act, seen by the bot. Also adds in any other", "# image-related fields need...
[ 93, 4 ]
[ 102, 57 ]
python
en
['en', 'error', 'th']
False
ModelImageChatWorld.get_final_chat_data
(self)
Add image-specific fields to the final chat data.
Add image-specific fields to the final chat data.
def get_final_chat_data(self) -> Dict[str, Any]: """ Add image-specific fields to the final chat data. """ data = super().get_final_chat_data() data['image_idx'] = self.image_idx return data
[ "def", "get_final_chat_data", "(", "self", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "data", "=", "super", "(", ")", ".", "get_final_chat_data", "(", ")", "data", "[", "'image_idx'", "]", "=", "self", ".", "image_idx", "return", "data" ]
[ 104, 4 ]
[ 110, 19 ]
python
en
['en', 'error', 'th']
False
ModelImageChatWorld._prepare_acceptability_checking
(self)
Apply acceptability checking params specific to image-chat conversation. The conversation starts with an image, so the human shouldn't be starting their first message with "Hi", etc.
Apply acceptability checking params specific to image-chat conversation.
def _prepare_acceptability_checking(self) -> Tuple[List[str], List[str]]: """ Apply acceptability checking params specific to image-chat conversation. The conversation starts with an image, so the human shouldn't be starting their first message with "Hi", etc. """ human_...
[ "def", "_prepare_acceptability_checking", "(", "self", ")", "->", "Tuple", "[", "List", "[", "str", "]", ",", "List", "[", "str", "]", "]", ":", "human_messages", ",", "violation_types", "=", "super", "(", ")", ".", "_prepare_acceptability_checking", "(", ")...
[ 112, 4 ]
[ 121, 46 ]
python
en
['en', 'error', 'th']
False
validate
(observation)
Make sure the observation table is valid, or raise an error.
Make sure the observation table is valid, or raise an error.
def validate(observation): """ Make sure the observation table is valid, or raise an error. """ if observation is not None and isinstance(observation, dict): return observation else: raise RuntimeError('Must return dictionary or Message object from act().')
[ "def", "validate", "(", "observation", ")", ":", "if", "observation", "is", "not", "None", "and", "isinstance", "(", "observation", ",", "dict", ")", ":", "return", "observation", "else", ":", "raise", "RuntimeError", "(", "'Must return dictionary or Message objec...
[ 54, 0 ]
[ 61, 82 ]
python
en
['en', 'error', 'th']
False
_override_opts_in_shared
(table, overrides)
Override all shared dicts. Looks recursively for ``opt`` dictionaries within shared dict and overrides any key- value pairs with pairs from the overrides dict.
Override all shared dicts.
def _override_opts_in_shared(table, overrides): """ Override all shared dicts. Looks recursively for ``opt`` dictionaries within shared dict and overrides any key- value pairs with pairs from the overrides dict. """ if 'opt' in table: # change values if an 'opt' dict is available ...
[ "def", "_override_opts_in_shared", "(", "table", ",", "overrides", ")", ":", "if", "'opt'", "in", "table", ":", "# change values if an 'opt' dict is available", "for", "k", ",", "v", "in", "overrides", ".", "items", "(", ")", ":", "table", "[", "'opt'", "]", ...
[ 717, 0 ]
[ 740, 16 ]
python
en
['en', 'error', 'th']
False
_create_task_agents
(opt: Opt)
Create task agent(s) for the given task name. It does this by calling the create_agent function in agents.py of the given task. If create_agents function does not exist, it just looks for the teacher (agent) class defined by the task name directly. (This saves the task creator bothering to define ...
Create task agent(s) for the given task name.
def _create_task_agents(opt: Opt): """ Create task agent(s) for the given task name. It does this by calling the create_agent function in agents.py of the given task. If create_agents function does not exist, it just looks for the teacher (agent) class defined by the task name directly. (This save...
[ "def", "_create_task_agents", "(", "opt", ":", "Opt", ")", ":", "if", "opt", ".", "get", "(", "'interactive_task'", ",", "False", ")", "or", "opt", ".", "get", "(", "'selfchat_task'", ",", "False", ")", ":", "# do not need task agents in interactive or self chat...
[ 1195, 0 ]
[ 1217, 22 ]
python
en
['en', 'error', 'th']
False
create_task_world
(opt: Opt, user_agents, default_world=None)
Instantiate a world with the supplied options and user agents. (A world factory.)
Instantiate a world with the supplied options and user agents.
def create_task_world(opt: Opt, user_agents, default_world=None): """ Instantiate a world with the supplied options and user agents. (A world factory.) """ task_agents = _create_task_agents(opt) world_class = load_world_module( opt['task'], interactive_task=opt.get('interactive_...
[ "def", "create_task_world", "(", "opt", ":", "Opt", ",", "user_agents", ",", "default_world", "=", "None", ")", ":", "task_agents", "=", "_create_task_agents", "(", "opt", ")", "world_class", "=", "load_world_module", "(", "opt", "[", "'task'", "]", ",", "in...
[ 1220, 0 ]
[ 1235, 54 ]
python
en
['en', 'error', 'th']
False
create_task
(opt: Opt, user_agents, default_world=None)
Create a world + task_agents (aka a task). Assuming ``opt['task']="task_dir:teacher_class:options"`` e.g. ``"babi:Task1k:1"`` or ``"#babi-1k"`` or ``"#QA"``, see ``parlai/tasks/tasks.py`` and see ``parlai/tasks/task_list.py`` for list of tasks.
Create a world + task_agents (aka a task).
def create_task(opt: Opt, user_agents, default_world=None): """ Create a world + task_agents (aka a task). Assuming ``opt['task']="task_dir:teacher_class:options"`` e.g. ``"babi:Task1k:1"`` or ``"#babi-1k"`` or ``"#QA"``, see ``parlai/tasks/tasks.py`` and see ``parlai/tasks/task_list.py`` for list ...
[ "def", "create_task", "(", "opt", ":", "Opt", ",", "user_agents", ",", "default_world", "=", "None", ")", ":", "task", "=", "opt", ".", "get", "(", "'task'", ")", "if", "not", "task", ":", "raise", "RuntimeError", "(", "'No task specified. Please select a ta...
[ 1238, 0 ]
[ 1274, 16 ]
python
en
['en', 'error', 'th']
False
World.parley
(self)
Perform one step of actions for the agents in the world. This is empty in the base class.
Perform one step of actions for the agents in the world.
def parley(self): """ Perform one step of actions for the agents in the world. This is empty in the base class. """ # TODO: mark as abstract? pass
[ "def", "parley", "(", "self", ")", ":", "# TODO: mark as abstract?", "pass" ]
[ 86, 4 ]
[ 93, 12 ]
python
en
['en', 'error', 'th']
False
World.getID
(self)
Return the name of the world, typically the task the world encodes.
Return the name of the world, typically the task the world encodes.
def getID(self): """ Return the name of the world, typically the task the world encodes. """ return self.id
[ "def", "getID", "(", "self", ")", ":", "return", "self", ".", "id" ]
[ 95, 4 ]
[ 99, 22 ]
python
en
['en', 'error', 'th']
False
World.display
(self)
Return a string describing the current state of the world. Useful for monitoring and debugging. By default, display the messages between the agents.
Return a string describing the current state of the world.
def display(self): """ Return a string describing the current state of the world. Useful for monitoring and debugging. By default, display the messages between the agents. """ if not hasattr(self, 'acts'): return '' return display_messages( ...
[ "def", "display", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'acts'", ")", ":", "return", "''", "return", "display_messages", "(", "self", ".", "acts", ",", "ignore_agent_reply", "=", "self", ".", "opt", ".", "get", "(", "'ignore...
[ 101, 4 ]
[ 117, 9 ]
python
en
['en', 'error', 'th']
False
World.episode_done
(self)
Whether the episode is done or not.
Whether the episode is done or not.
def episode_done(self): """ Whether the episode is done or not. """ return False
[ "def", "episode_done", "(", "self", ")", ":", "return", "False" ]
[ 119, 4 ]
[ 123, 20 ]
python
en
['en', 'error', 'th']
False
World.epoch_done
(self)
Whether the epoch is done or not. Not all worlds have the notion of an epoch, but this is useful for fixed training, validation or test sets.
Whether the epoch is done or not.
def epoch_done(self): """ Whether the epoch is done or not. Not all worlds have the notion of an epoch, but this is useful for fixed training, validation or test sets. """ return False
[ "def", "epoch_done", "(", "self", ")", ":", "return", "False" ]
[ 125, 4 ]
[ 132, 20 ]
python
en
['en', 'error', 'th']
False
World.share
(self)
Share the world.
Share the world.
def share(self): """ Share the world. """ shared_data = {} shared_data['world_class'] = type(self) shared_data['opt'] = self.opt shared_data['agents'] = self._share_agents() return shared_data
[ "def", "share", "(", "self", ")", ":", "shared_data", "=", "{", "}", "shared_data", "[", "'world_class'", "]", "=", "type", "(", "self", ")", "shared_data", "[", "'opt'", "]", "=", "self", ".", "opt", "shared_data", "[", "'agents'", "]", "=", "self", ...
[ 134, 4 ]
[ 142, 26 ]
python
en
['en', 'error', 'th']
False
World.clone
(self)
Create a duplicate of the world.
Create a duplicate of the world.
def clone(self): """ Create a duplicate of the world. """ return type(self)(opt=self.opt, agents=None, shared=self.share())
[ "def", "clone", "(", "self", ")", ":", "return", "type", "(", "self", ")", "(", "opt", "=", "self", ".", "opt", ",", "agents", "=", "None", ",", "shared", "=", "self", ".", "share", "(", ")", ")" ]
[ 144, 4 ]
[ 148, 73 ]
python
en
['en', 'error', 'th']
False
World._share_agents
(self)
Create shared data for agents. Allows other classes to create the same agents without duplicating the data (i.e. sharing parameters).
Create shared data for agents.
def _share_agents(self): """ Create shared data for agents. Allows other classes to create the same agents without duplicating the data (i.e. sharing parameters). """ if not hasattr(self, 'agents'): return None shared_agents = [a.share() for a in self...
[ "def", "_share_agents", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'agents'", ")", ":", "return", "None", "shared_agents", "=", "[", "a", ".", "share", "(", ")", "for", "a", "in", "self", ".", "agents", "]", "return", "shared_a...
[ 150, 4 ]
[ 160, 28 ]
python
en
['en', 'error', 'th']
False
World.get_agents
(self)
Return the list of agents.
Return the list of agents.
def get_agents(self): """ Return the list of agents. """ return self.agents
[ "def", "get_agents", "(", "self", ")", ":", "return", "self", ".", "agents" ]
[ 162, 4 ]
[ 166, 26 ]
python
en
['en', 'error', 'th']
False
World.get_task_agent
(self)
Return task agent, if applicable.
Return task agent, if applicable.
def get_task_agent(self): """ Return task agent, if applicable. """ raise NotImplementedError('Implement in subworld')
[ "def", "get_task_agent", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Implement in subworld'", ")" ]
[ 168, 4 ]
[ 172, 58 ]
python
en
['en', 'error', 'th']
False
World.get_model_agent
(self)
Return model agent, if applicable.
Return model agent, if applicable.
def get_model_agent(self): """ Return model agent, if applicable. """ raise NotImplementedError('Implement in subworld')
[ "def", "get_model_agent", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'Implement in subworld'", ")" ]
[ 174, 4 ]
[ 178, 58 ]
python
en
['en', 'error', 'th']
False
World.get_acts
(self)
Return the last act of each agent.
Return the last act of each agent.
def get_acts(self): """ Return the last act of each agent. """ return self.acts
[ "def", "get_acts", "(", "self", ")", ":", "return", "self", ".", "acts" ]
[ 180, 4 ]
[ 184, 24 ]
python
en
['en', 'error', 'th']
False
World.get_time
(self)
Return total training time.
Return total training time.
def get_time(self): """ Return total training time. """ return self.time.time()
[ "def", "get_time", "(", "self", ")", ":", "return", "self", ".", "time", ".", "time", "(", ")" ]
[ 186, 4 ]
[ 190, 31 ]
python
en
['en', 'error', 'th']
False
World.get_total_exs
(self)
Return total amount of examples seen by world.
Return total amount of examples seen by world.
def get_total_exs(self): """ Return total amount of examples seen by world. """ return self.total_exs
[ "def", "get_total_exs", "(", "self", ")", ":", "return", "self", ".", "total_exs" ]
[ 192, 4 ]
[ 196, 29 ]
python
en
['en', 'error', 'th']
False
World.get_total_epochs
(self)
Return total amount of epochs on which the world has trained.
Return total amount of epochs on which the world has trained.
def get_total_epochs(self): """ Return total amount of epochs on which the world has trained. """ return self.total_epochs
[ "def", "get_total_epochs", "(", "self", ")", ":", "return", "self", ".", "total_epochs" ]
[ 198, 4 ]
[ 202, 32 ]
python
en
['en', 'error', 'th']
False
World.get_total_parleys
(self)
Return total number of parleys.
Return total number of parleys.
def get_total_parleys(self): """ Return total number of parleys. """ return self.total_parleys
[ "def", "get_total_parleys", "(", "self", ")", ":", "return", "self", ".", "total_parleys" ]
[ 204, 4 ]
[ 208, 33 ]
python
en
['en', 'error', 'th']
False
World.__enter__
(self)
Empty enter provided for use with ``with`` statement. e.g: .. code-block:: python with World() as world: for n in range(10): n.parley()
Empty enter provided for use with ``with`` statement.
def __enter__(self): """ Empty enter provided for use with ``with`` statement. e.g: .. code-block:: python with World() as world: for n in range(10): n.parley() """ return self
[ "def", "__enter__", "(", "self", ")", ":", "return", "self" ]
[ 210, 4 ]
[ 222, 19 ]
python
en
['en', 'error', 'th']
False
World.__exit__
(self, exc_type, exc_value, exc_traceback)
After ``with`` statement, call shutdown.
After ``with`` statement, call shutdown.
def __exit__(self, exc_type, exc_value, exc_traceback): """ After ``with`` statement, call shutdown. """ self.shutdown() return False
[ "def", "__exit__", "(", "self", ",", "exc_type", ",", "exc_value", ",", "exc_traceback", ")", ":", "self", ".", "shutdown", "(", ")", "return", "False" ]
[ 224, 4 ]
[ 229, 20 ]
python
en
['en', 'error', 'th']
False
World.num_examples
(self)
Return the number of examples. Always 0 in the abstract world.
Return the number of examples.
def num_examples(self): """ Return the number of examples. Always 0 in the abstract world. """ # TODO: mark as abstract? return 0
[ "def", "num_examples", "(", "self", ")", ":", "# TODO: mark as abstract?", "return", "0" ]
[ 231, 4 ]
[ 238, 16 ]
python
en
['en', 'error', 'th']
False
World.num_episodes
(self)
Return the number of episodes. Always 0 in the abstract world.
Return the number of episodes.
def num_episodes(self): """ Return the number of episodes. Always 0 in the abstract world. """ # TODO: mark as abstract? return 0
[ "def", "num_episodes", "(", "self", ")", ":", "# TODO: mark as abstract?", "return", "0" ]
[ 240, 4 ]
[ 247, 16 ]
python
en
['en', 'error', 'th']
False
World.reset
(self)
Reset all agents in the world, and world statistics.
Reset all agents in the world, and world statistics.
def reset(self): """ Reset all agents in the world, and world statistics. """ for a in self.agents: a.reset() self.max_exs = None self.total_exs = 0 self.total_epochs = 0 self.total_parleys = 0 self.time.reset()
[ "def", "reset", "(", "self", ")", ":", "for", "a", "in", "self", ".", "agents", ":", "a", ".", "reset", "(", ")", "self", ".", "max_exs", "=", "None", "self", ".", "total_exs", "=", "0", "self", ".", "total_epochs", "=", "0", "self", ".", "total_...
[ 249, 4 ]
[ 259, 25 ]
python
en
['en', 'error', 'th']
False
World.reset_metrics
(self)
Reset metrics for all agents.
Reset metrics for all agents.
def reset_metrics(self): """ Reset metrics for all agents. """ for a in self.agents: a.reset_metrics()
[ "def", "reset_metrics", "(", "self", ")", ":", "for", "a", "in", "self", ".", "agents", ":", "a", ".", "reset_metrics", "(", ")" ]
[ 261, 4 ]
[ 266, 29 ]
python
en
['en', 'error', 'th']
False
World.shutdown
(self)
Perform any cleanup, if appropriate.
Perform any cleanup, if appropriate.
def shutdown(self): """ Perform any cleanup, if appropriate. """ pass
[ "def", "shutdown", "(", "self", ")", ":", "pass" ]
[ 268, 4 ]
[ 272, 12 ]
python
en
['en', 'error', 'th']
False
World.update_counters
(self)
Update how many epochs have completed.
Update how many epochs have completed.
def update_counters(self): """ Update how many epochs have completed. """ self.total_parleys += 1 if self.max_exs is None: if 'num_epochs' in self.opt and self.opt['num_epochs'] > 0: if self.num_examples: self.max_exs = self.num_exa...
[ "def", "update_counters", "(", "self", ")", ":", "self", ".", "total_parleys", "+=", "1", "if", "self", ".", "max_exs", "is", "None", ":", "if", "'num_epochs'", "in", "self", ".", "opt", "and", "self", ".", "opt", "[", "'num_epochs'", "]", ">", "0", ...
[ 274, 4 ]
[ 295, 38 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.get_task_agent
(self)
Return task agent.
Return task agent.
def get_task_agent(self): """ Return task agent. """ return self.get_agents()[0]
[ "def", "get_task_agent", "(", "self", ")", ":", "return", "self", ".", "get_agents", "(", ")", "[", "0", "]" ]
[ 323, 4 ]
[ 327, 35 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.get_model_agent
(self)
Return model agent, if applicable.
Return model agent, if applicable.
def get_model_agent(self): """ Return model agent, if applicable. """ return self.get_agents()[1]
[ "def", "get_model_agent", "(", "self", ")", ":", "return", "self", ".", "get_agents", "(", ")", "[", "1", "]" ]
[ 329, 4 ]
[ 333, 35 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.parley
(self)
Agent 0 goes first. Alternate between the two agents.
Agent 0 goes first.
def parley(self): """ Agent 0 goes first. Alternate between the two agents. """ acts = self.acts agents = self.agents acts[0] = agents[0].act() agents[1].observe(validate(acts[0])) acts[1] = agents[1].act() agents[0].observe(validate(acts[...
[ "def", "parley", "(", "self", ")", ":", "acts", "=", "self", ".", "acts", "agents", "=", "self", ".", "agents", "acts", "[", "0", "]", "=", "agents", "[", "0", "]", ".", "act", "(", ")", "agents", "[", "1", "]", ".", "observe", "(", "validate",...
[ 335, 4 ]
[ 347, 30 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.episode_done
(self)
Only the first agent indicates when the episode is done.
Only the first agent indicates when the episode is done.
def episode_done(self): """ Only the first agent indicates when the episode is done. """ if self.acts[0] is not None: return self.acts[0].get('episode_done', False) else: return False
[ "def", "episode_done", "(", "self", ")", ":", "if", "self", ".", "acts", "[", "0", "]", "is", "not", "None", ":", "return", "self", ".", "acts", "[", "0", "]", ".", "get", "(", "'episode_done'", ",", "False", ")", "else", ":", "return", "False" ]
[ 349, 4 ]
[ 356, 24 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.epoch_done
(self)
Only the first agent indicates when the epoch is done.
Only the first agent indicates when the epoch is done.
def epoch_done(self): """ Only the first agent indicates when the epoch is done. """ return self.get_task_agent().epoch_done()
[ "def", "epoch_done", "(", "self", ")", ":", "return", "self", ".", "get_task_agent", "(", ")", ".", "epoch_done", "(", ")" ]
[ 358, 4 ]
[ 362, 49 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.report
(self)
Report all metrics of all subagents.
Report all metrics of all subagents.
def report(self): """ Report all metrics of all subagents. """ from parlai.core.metrics import Metric, LegacyMetric metrics = {} for a in self.agents: if hasattr(a, 'report'): m = a.report() for k, v in m.items(): ...
[ "def", "report", "(", "self", ")", ":", "from", "parlai", ".", "core", ".", "metrics", "import", "Metric", ",", "LegacyMetric", "metrics", "=", "{", "}", "for", "a", "in", "self", ".", "agents", ":", "if", "hasattr", "(", "a", ",", "'report'", ")", ...
[ 364, 4 ]
[ 383, 22 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.num_examples
(self)
Return number of examples.
Return number of examples.
def num_examples(self): """ Return number of examples. """ if hasattr(self.get_task_agent(), 'num_examples'): return self.get_task_agent().num_examples() return 0
[ "def", "num_examples", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "get_task_agent", "(", ")", ",", "'num_examples'", ")", ":", "return", "self", ".", "get_task_agent", "(", ")", ".", "num_examples", "(", ")", "return", "0" ]
[ 385, 4 ]
[ 391, 16 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.num_episodes
(self)
Return number of episodes.
Return number of episodes.
def num_episodes(self): """ Return number of episodes. """ if hasattr(self.get_task_agent(), 'num_episodes'): return self.get_task_agent().num_episodes() return 0
[ "def", "num_episodes", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "get_task_agent", "(", ")", ",", "'num_episodes'", ")", ":", "return", "self", ".", "get_task_agent", "(", ")", ".", "num_episodes", "(", ")", "return", "0" ]
[ 393, 4 ]
[ 399, 16 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.shutdown
(self)
Shutdown each agent.
Shutdown each agent.
def shutdown(self): """ Shutdown each agent. """ for a in self.agents: a.shutdown()
[ "def", "shutdown", "(", "self", ")", ":", "for", "a", "in", "self", ".", "agents", ":", "a", ".", "shutdown", "(", ")" ]
[ 401, 4 ]
[ 406, 24 ]
python
en
['en', 'error', 'th']
False
DialogPartnerWorld.update_counters
(self)
Ensure all counters are synchronized across threads.
Ensure all counters are synchronized across threads.
def update_counters(self): """ Ensure all counters are synchronized across threads. """ super().update_counters() for a in self.agents: if hasattr(a, 'update_counters'): a.update_counters()
[ "def", "update_counters", "(", "self", ")", ":", "super", "(", ")", ".", "update_counters", "(", ")", "for", "a", "in", "self", ".", "agents", ":", "if", "hasattr", "(", "a", ",", "'update_counters'", ")", ":", "a", ".", "update_counters", "(", ")" ]
[ 408, 4 ]
[ 415, 35 ]
python
en
['en', 'error', 'th']
False
MultiAgentDialogWorld.parley
(self)
Perform a turn for every agent. For each agent, get an observation of the last action each of the other agents took. Then take an action yourself.
Perform a turn for every agent.
def parley(self): """ Perform a turn for every agent. For each agent, get an observation of the last action each of the other agents took. Then take an action yourself. """ acts = self.acts for index, agent in enumerate(self.agents): acts[index] = age...
[ "def", "parley", "(", "self", ")", ":", "acts", "=", "self", ".", "acts", "for", "index", ",", "agent", "in", "enumerate", "(", "self", ".", "agents", ")", ":", "acts", "[", "index", "]", "=", "agent", ".", "act", "(", ")", "for", "other_agent", ...
[ 435, 4 ]
[ 448, 30 ]
python
en
['en', 'error', 'th']
False
MultiAgentDialogWorld.get_task_agent
(self)
Return task agent.
Return task agent.
def get_task_agent(self): """ Return task agent. """ return self.get_agents()[0]
[ "def", "get_task_agent", "(", "self", ")", ":", "return", "self", ".", "get_agents", "(", ")", "[", "0", "]" ]
[ 450, 4 ]
[ 454, 35 ]
python
en
['en', 'error', 'th']
False
MultiAgentDialogWorld.get_model_agent
(self)
Return model agent.
Return model agent.
def get_model_agent(self): """ Return model agent. """ return self.get_agents()[1]
[ "def", "get_model_agent", "(", "self", ")", ":", "return", "self", ".", "get_agents", "(", ")", "[", "1", "]" ]
[ 456, 4 ]
[ 460, 35 ]
python
en
['en', 'error', 'th']
False
MultiAgentDialogWorld.epoch_done
(self)
Return if the epoch is done for any subagent.
Return if the epoch is done for any subagent.
def epoch_done(self): """ Return if the epoch is done for any subagent. """ done = False for a in self.agents: if a.epoch_done(): done = True return done
[ "def", "epoch_done", "(", "self", ")", ":", "done", "=", "False", "for", "a", "in", "self", ".", "agents", ":", "if", "a", ".", "epoch_done", "(", ")", ":", "done", "=", "True", "return", "done" ]
[ 462, 4 ]
[ 470, 19 ]
python
en
['en', 'error', 'th']
False
MultiAgentDialogWorld.episode_done
(self)
Return if the episode is done for any subagent.
Return if the episode is done for any subagent.
def episode_done(self): """ Return if the episode is done for any subagent. """ done = False for a in self.agents: if a.episode_done(): done = True return done
[ "def", "episode_done", "(", "self", ")", ":", "done", "=", "False", "for", "a", "in", "self", ".", "agents", ":", "if", "a", ".", "episode_done", "(", ")", ":", "done", "=", "True", "return", "done" ]
[ 472, 4 ]
[ 480, 19 ]
python
en
['en', 'error', 'th']
False