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
Dimension.tickvals
(self)
Sets the values at which ticks on this axis appear. The 'tickvals' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- numpy.ndarray
Sets the values at which ticks on this axis appear. The 'tickvals' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
def tickvals(self): """ Sets the values at which ticks on this axis appear. The 'tickvals' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- numpy.ndarray """ return self["tickvals"]
[ "def", "tickvals", "(", "self", ")", ":", "return", "self", "[", "\"tickvals\"", "]" ]
[ 257, 4 ]
[ 268, 31 ]
python
en
['en', 'error', 'th']
False
Dimension.tickvalssrc
(self)
Sets the source reference on Chart Studio Cloud for tickvals . The 'tickvalssrc' 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 tickvals . The 'tickvalssrc' property must be specified as a string or as a plotly.grid_objs.Column object
def tickvalssrc(self): """ Sets the source reference on Chart Studio Cloud for tickvals . The 'tickvalssrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["tickvalssrc"]
[ "def", "tickvalssrc", "(", "self", ")", ":", "return", "self", "[", "\"tickvalssrc\"", "]" ]
[ 277, 4 ]
[ 288, 34 ]
python
en
['en', 'error', 'th']
False
Dimension.values
(self)
Dimension values. `values[n]` represents the value of the `n`th point in the dataset, therefore the `values` vector for all dimensions must be the same (longer vectors will be truncated). Each value must be a finite number. The 'values' property is an array that may be spec...
Dimension values. `values[n]` represents the value of the `n`th point in the dataset, therefore the `values` vector for all dimensions must be the same (longer vectors will be truncated). Each value must be a finite number. The 'values' property is an array that may be spec...
def values(self): """ Dimension values. `values[n]` represents the value of the `n`th point in the dataset, therefore the `values` vector for all dimensions must be the same (longer vectors will be truncated). Each value must be a finite number. The 'values' property...
[ "def", "values", "(", "self", ")", ":", "return", "self", "[", "\"values\"", "]" ]
[ 297, 4 ]
[ 311, 29 ]
python
en
['en', 'error', 'th']
False
Dimension.valuessrc
(self)
Sets the source reference on Chart Studio Cloud for values . The 'valuessrc' 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 values . The 'valuessrc' property must be specified as a string or as a plotly.grid_objs.Column object
def valuessrc(self): """ Sets the source reference on Chart Studio Cloud for values . The 'valuessrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["valuessrc"]
[ "def", "valuessrc", "(", "self", ")", ":", "return", "self", "[", "\"valuessrc\"", "]" ]
[ 320, 4 ]
[ 331, 32 ]
python
en
['en', 'error', 'th']
False
Dimension.visible
(self)
Shows the dimension when set to `true` (the default). Hides the dimension for `false`. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool
Shows the dimension when set to `true` (the default). Hides the dimension for `false`. The 'visible' property must be specified as a bool (either True, or False)
def visible(self): """ Shows the dimension when set to `true` (the default). Hides the dimension for `false`. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["visible"]
[ "def", "visible", "(", "self", ")", ":", "return", "self", "[", "\"visible\"", "]" ]
[ 340, 4 ]
[ 352, 30 ]
python
en
['en', 'error', 'th']
False
Dimension.__init__
( self, arg=None, constraintrange=None, label=None, multiselect=None, name=None, range=None, templateitemname=None, tickformat=None, ticktext=None, ticktextsrc=None, tickvals=None, tickvalssrc=None, values=No...
Construct a new Dimension object The dimensions (variables) of the parallel coordinates chart. 2..60 dimensions are supported. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :c...
Construct a new Dimension object The dimensions (variables) of the parallel coordinates chart. 2..60 dimensions are supported.
def __init__( self, arg=None, constraintrange=None, label=None, multiselect=None, name=None, range=None, templateitemname=None, tickformat=None, ticktext=None, ticktextsrc=None, tickvals=None, tickvalssrc=None, ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "constraintrange", "=", "None", ",", "label", "=", "None", ",", "multiselect", "=", "None", ",", "name", "=", "None", ",", "range", "=", "None", ",", "templateitemname", "=", "None", ",", ...
[ 436, 4 ]
[ 635, 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 font for the `category` labels. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.parcats.Tickfont` color ...
Construct a new Tickfont object Sets the font for the `category` labels.
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Tickfont object Sets the font for the `category` labels. Parameters ---------- arg dict of properties compatible with this constructor or an i...
[ "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
Stream.maxpoints
(self)
Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to 50, only the newest 50 points will be displayed on the plot. The 'maxpoints' property is a number and may be specified as: - An int or float in the interval [0, 10000]...
Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to 50, only the newest 50 points will be displayed on the plot. The 'maxpoints' property is a number and may be specified as: - An int or float in the interval [0, 10000]
def maxpoints(self): """ Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to 50, only the newest 50 points will be displayed on the plot. The 'maxpoints' property is a number and may be specified as: - An int or ...
[ "def", "maxpoints", "(", "self", ")", ":", "return", "self", "[", "\"maxpoints\"", "]" ]
[ 15, 4 ]
[ 28, 32 ]
python
en
['en', 'error', 'th']
False
Stream.token
(self)
The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details. The 'token' property is a string and must be specified as: - A non-empty string Returns ------- str
The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details. The 'token' property is a string and must be specified as: - A non-empty string
def token(self): """ The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details. The 'token' property is a string and must be specified as: - A non-empty string Returns ------- ...
[ "def", "token", "(", "self", ")", ":", "return", "self", "[", "\"token\"", "]" ]
[ 37, 4 ]
[ 50, 28 ]
python
en
['en', 'error', 'th']
False
Stream.__init__
(self, arg=None, maxpoints=None, token=None, **kwargs)
Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.histogram2d.Stream` maxpoints Sets the maximum number of points to kee...
Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.histogram2d.Stream` maxpoints Sets the maximum number of points to kee...
def __init__(self, arg=None, maxpoints=None, token=None, **kwargs): """ Construct a new Stream object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.histogram2d...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "maxpoints", "=", "None", ",", "token", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Stream", ",", "self", ")", ".", "__init__", "(", "\"stream\"", ")", "if", "\"_paren...
[ 72, 4 ]
[ 140, 34 ]
python
en
['en', 'error', 'th']
False
register_agent
(name: str)
Register an agent to be available in command line calls. >>> @register_agent("my_agent") ... class MyAgent: ... pass
Register an agent to be available in command line calls.
def register_agent(name: str) -> Callable[[Type], Type]: """ Register an agent to be available in command line calls. >>> @register_agent("my_agent") ... class MyAgent: ... pass """ def _inner(cls_): global AGENT_REGISTRY AGENT_REGISTRY[name] = cls_ return cls_ ...
[ "def", "register_agent", "(", "name", ":", "str", ")", "->", "Callable", "[", "[", "Type", "]", ",", "Type", "]", ":", "def", "_inner", "(", "cls_", ")", ":", "global", "AGENT_REGISTRY", "AGENT_REGISTRY", "[", "name", "]", "=", "cls_", "return", "cls_"...
[ 30, 0 ]
[ 44, 17 ]
python
en
['en', 'error', 'th']
False
register_script
(name: str, aliases=None, hidden=False)
Register an agent to be available in command line calls. >>> @register_script("my_script") ... class MyScript: ... pass
Register an agent to be available in command line calls.
def register_script(name: str, aliases=None, hidden=False): """ Register an agent to be available in command line calls. >>> @register_script("my_script") ... class MyScript: ... pass """ if aliases is None: aliases = [] def _inner(cls_): global SCRIPT_REGISTRY ...
[ "def", "register_script", "(", "name", ":", "str", ",", "aliases", "=", "None", ",", "hidden", "=", "False", ")", ":", "if", "aliases", "is", "None", ":", "aliases", "=", "[", "]", "def", "_inner", "(", "cls_", ")", ":", "global", "SCRIPT_REGISTRY", ...
[ 47, 0 ]
[ 63, 17 ]
python
en
['en', 'error', 'th']
False
register_teacher
(name: str)
Register a teacher to be available as a command line. >>> @register_teacher("my_teacher") ... class MyTeacher: ... pass
Register a teacher to be available as a command line.
def register_teacher(name: str) -> Callable[[Type], Type]: """ Register a teacher to be available as a command line. >>> @register_teacher("my_teacher") ... class MyTeacher: ... pass """ def _inner(cls_): global TEACHER_REGISTRY TEACHER_REGISTRY[name] = cls_ retu...
[ "def", "register_teacher", "(", "name", ":", "str", ")", "->", "Callable", "[", "[", "Type", "]", ",", "Type", "]", ":", "def", "_inner", "(", "cls_", ")", ":", "global", "TEACHER_REGISTRY", "TEACHER_REGISTRY", "[", "name", "]", "=", "cls_", "return", ...
[ 66, 0 ]
[ 80, 17 ]
python
en
['en', 'error', 'th']
False
_name_to_agent_class
(name: str)
Convert agent name to class. This adds "Agent" to the end of the name and uppercases the first letter and the first letter appearing after each underscore (underscores are removed). :param name: name of agent, e.g. local_human :return: class of agent, e.g. LocalHumanAgent. ...
Convert agent name to class.
def _name_to_agent_class(name: str): """ Convert agent name to class. This adds "Agent" to the end of the name and uppercases the first letter and the first letter appearing after each underscore (underscores are removed). :param name: name of agent, e.g. local_human :return: ...
[ "def", "_name_to_agent_class", "(", "name", ":", "str", ")", ":", "words", "=", "name", ".", "split", "(", "'_'", ")", "class_name", "=", "''", "for", "w", "in", "words", ":", "# capitalize the first letter", "class_name", "+=", "w", "[", "0", "]", ".", ...
[ 86, 0 ]
[ 107, 21 ]
python
en
['en', 'error', 'th']
False
load_agent_module
(agent_path: str)
Return the module for an agent specified by ``--model``. Can be formatted in several different ways: * full: `-m parlai.agents.seq2seq.seq2seq:Seq2seqAgent` * shorthand: -m seq2seq, which will check both paths ``parlai.agents.seq2seq.seq2seq:Seq2seqAgent`` and ``parlai.agents.seq2seq.agen...
Return the module for an agent specified by ``--model``.
def load_agent_module(agent_path: str): """ Return the module for an agent specified by ``--model``. Can be formatted in several different ways: * full: `-m parlai.agents.seq2seq.seq2seq:Seq2seqAgent` * shorthand: -m seq2seq, which will check both paths ``parlai.agents.seq2seq.seq2seq:Seq2se...
[ "def", "load_agent_module", "(", "agent_path", ":", "str", ")", ":", "global", "AGENT_REGISTRY", "if", "agent_path", "in", "AGENT_REGISTRY", ":", "return", "AGENT_REGISTRY", "[", "agent_path", "]", "repo", "=", "'parlai'", "if", "agent_path", ".", "startswith", ...
[ 110, 0 ]
[ 190, 22 ]
python
en
['en', 'error', 'th']
False
_get_task_path_and_repo
(taskname: str)
Returns the task path list and repository containing the task as specified by `--task`. :param taskname: path to task class (specified in format detailed below)
Returns the task path list and repository containing the task as specified by `--task`.
def _get_task_path_and_repo(taskname: str): """ Returns the task path list and repository containing the task as specified by `--task`. :param taskname: path to task class (specified in format detailed below) """ task = taskname.strip() repo = 'parlai' if task.startswith('internal:'): ...
[ "def", "_get_task_path_and_repo", "(", "taskname", ":", "str", ")", ":", "task", "=", "taskname", ".", "strip", "(", ")", "repo", "=", "'parlai'", "if", "task", ".", "startswith", "(", "'internal:'", ")", ":", "# To switch to local repo, useful for non-public proj...
[ 196, 0 ]
[ 216, 31 ]
python
en
['en', 'error', 'th']
False
load_task_module
(taskname: str)
Get the module containing all teacher agents for the task specified by `--task`. :param taskname: path to task class in one of the formats The valid formats for taskname are: - full: ``-t parlai.tasks.babi.agents:DefaultTeacher`` - shorthand: ``-t babi``, which will check ``p...
Get the module containing all teacher agents for the task specified by `--task`.
def load_task_module(taskname: str): """ Get the module containing all teacher agents for the task specified by `--task`. :param taskname: path to task class in one of the formats The valid formats for taskname are: - full: ``-t parlai.tasks.babi.agents:DefaultTeacher`` - shorthan...
[ "def", "load_task_module", "(", "taskname", ":", "str", ")", ":", "task_path_list", ",", "repo", "=", "_get_task_path_and_repo", "(", "taskname", ")", "task_path", "=", "task_path_list", "[", "0", "]", "if", "'.'", "in", "task_path", ":", "module_name", "=", ...
[ 219, 0 ]
[ 248, 22 ]
python
en
['en', 'error', 'th']
False
load_teacher_module
(taskname: str)
Get the module of the teacher agent specified by `--task`. Can be formatted in several different ways: * full: ``-t parlai.tasks.babi.agents:DefaultTeacher`` * shorthand: ``-t babi``, which will check ``parlai.tasks.babi.agents:DefaultTeacher`` * shorthand specific: ``-t babi:task10k``, whi...
Get the module of the teacher agent specified by `--task`.
def load_teacher_module(taskname: str): """ Get the module of the teacher agent specified by `--task`. Can be formatted in several different ways: * full: ``-t parlai.tasks.babi.agents:DefaultTeacher`` * shorthand: ``-t babi``, which will check ``parlai.tasks.babi.agents:DefaultTeacher`` ...
[ "def", "load_teacher_module", "(", "taskname", ":", "str", ")", ":", "global", "TEACHER_REGISTRY", "if", "taskname", "in", "TEACHER_REGISTRY", ":", "return", "TEACHER_REGISTRY", "[", "taskname", "]", "task_module", "=", "load_task_module", "(", "taskname", ")", "t...
[ 251, 0 ]
[ 298, 24 ]
python
en
['en', 'error', 'th']
False
_get_default_world
(default_world=None, num_agents=None)
Get default world if a world is not already specified by the task. If a default world is provided, return this. Otherwise, return DialogPartnerWorld if there are 2 agents and MultiAgentDialogWorld if there are more. :param default_world: default world to return :param num_agents: ...
Get default world if a world is not already specified by the task.
def _get_default_world(default_world=None, num_agents=None): """ Get default world if a world is not already specified by the task. If a default world is provided, return this. Otherwise, return DialogPartnerWorld if there are 2 agents and MultiAgentDialogWorld if there are more. :param defaul...
[ "def", "_get_default_world", "(", "default_world", "=", "None", ",", "num_agents", "=", "None", ")", ":", "if", "default_world", "is", "not", "None", ":", "world_class", "=", "default_world", "elif", "num_agents", "is", "not", "None", ":", "import", "parlai", ...
[ 304, 0 ]
[ 329, 22 ]
python
en
['en', 'error', 'th']
False
load_world_module
( taskname: str, interactive_task: bool = False, selfchat_task: bool = False, num_agents: int = None, # a priori may not know the number of agents default_world=None, )
Load the world module for the specific environment. If not enough information is to determine which world should be loaded, returns None. :param taskname: path to task class in one of the above formats :param interactive_task: whether or not the task is interactive :param num_agent...
Load the world module for the specific environment. If not enough information is to determine which world should be loaded, returns None.
def load_world_module( taskname: str, interactive_task: bool = False, selfchat_task: bool = False, num_agents: int = None, # a priori may not know the number of agents default_world=None, ): """ Load the world module for the specific environment. If not enough information is to determin...
[ "def", "load_world_module", "(", "taskname", ":", "str", ",", "interactive_task", ":", "bool", "=", "False", ",", "selfchat_task", ":", "bool", "=", "False", ",", "num_agents", ":", "int", "=", "None", ",", "# a priori may not know the number of agents", "default_...
[ 332, 0 ]
[ 392, 22 ]
python
en
['en', 'error', 'th']
False
EndToEndAgent.batchify
(self, obs_batch)
Wizard custom batchify, which passes along the knowledge/title. Following the docstring of TorchAgent.batchify, it calls super, then uses an extended version of the torch_agent.Batch namedtuple. The purpose of extending the info is to keep track of some custom metrics. ...
Wizard custom batchify, which passes along the knowledge/title.
def batchify(self, obs_batch): """ Wizard custom batchify, which passes along the knowledge/title. Following the docstring of TorchAgent.batchify, it calls super, then uses an extended version of the torch_agent.Batch namedtuple. The purpose of extending the info is to keep tra...
[ "def", "batchify", "(", "self", ",", "obs_batch", ")", ":", "batch", "=", "super", "(", ")", ".", "batchify", "(", "obs_batch", ")", "reordered_observations", "=", "[", "obs_batch", "[", "i", "]", "for", "i", "in", "batch", ".", "valid_indices", "]", "...
[ 213, 4 ]
[ 293, 20 ]
python
en
['en', 'error', 'th']
False
ErrorZ.array
(self)
Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data. The 'array' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- numpy.ndarray
Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data. The 'array' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
def array(self): """ Sets the data corresponding the length of each error bar. Values are plotted relative to the underlying data. The 'array' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- ...
[ "def", "array", "(", "self", ")", ":", "return", "self", "[", "\"array\"", "]" ]
[ 30, 4 ]
[ 42, 28 ]
python
en
['en', 'error', 'th']
False
ErrorZ.arrayminus
(self)
Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data. The 'arrayminus' property is an array that may be specified as a tuple, list, numpy array, or pandas Se...
Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data. The 'arrayminus' property is an array that may be specified as a tuple, list, numpy array, or pandas Se...
def arrayminus(self): """ Sets the data corresponding the length of each error bar in the bottom (left) direction for vertical (horizontal) bars Values are plotted relative to the underlying data. The 'arrayminus' property is an array that may be specified as a tuple, ...
[ "def", "arrayminus", "(", "self", ")", ":", "return", "self", "[", "\"arrayminus\"", "]" ]
[ 51, 4 ]
[ 64, 33 ]
python
en
['en', 'error', 'th']
False
ErrorZ.arrayminussrc
(self)
Sets the source reference on Chart Studio Cloud for arrayminus . The 'arrayminussrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for arrayminus . The 'arrayminussrc' property must be specified as a string or as a plotly.grid_objs.Column object
def arrayminussrc(self): """ Sets the source reference on Chart Studio Cloud for arrayminus . The 'arrayminussrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["arra...
[ "def", "arrayminussrc", "(", "self", ")", ":", "return", "self", "[", "\"arrayminussrc\"", "]" ]
[ 73, 4 ]
[ 85, 36 ]
python
en
['en', 'error', 'th']
False
ErrorZ.arraysrc
(self)
Sets the source reference on Chart Studio Cloud for array . The 'arraysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str
Sets the source reference on Chart Studio Cloud for array . The 'arraysrc' property must be specified as a string or as a plotly.grid_objs.Column object
def arraysrc(self): """ Sets the source reference on Chart Studio Cloud for array . The 'arraysrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["arraysrc"]
[ "def", "arraysrc", "(", "self", ")", ":", "return", "self", "[", "\"arraysrc\"", "]" ]
[ 94, 4 ]
[ 105, 31 ]
python
en
['en', 'error', 'th']
False
ErrorZ.color
(self)
Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,1...
Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,1...
def color(self): """ Sets the stoke color of the error bars. The 'color' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsv...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 114, 4 ]
[ 164, 28 ]
python
en
['en', 'error', 'th']
False
ErrorZ.symmetric
(self)
Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars. The 'symmetric' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars. The 'symmetric' property must be specified as a bool (either True, or False)
def symmetric(self): """ Determines whether or not the error bars have the same length in both direction (top/bottom for vertical bars, left/right for horizontal bars. The 'symmetric' property must be specified as a bool (either True, or False) Returns ...
[ "def", "symmetric", "(", "self", ")", ":", "return", "self", "[", "\"symmetric\"", "]" ]
[ 173, 4 ]
[ 186, 32 ]
python
en
['en', 'error', 'th']
False
ErrorZ.thickness
(self)
Sets the thickness (in px) of the error bars. The 'thickness' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the thickness (in px) of the error bars. The 'thickness' property is a number and may be specified as: - An int or float in the interval [0, inf]
def thickness(self): """ Sets the thickness (in px) of the error bars. The 'thickness' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["thickness"]
[ "def", "thickness", "(", "self", ")", ":", "return", "self", "[", "\"thickness\"", "]" ]
[ 195, 4 ]
[ 206, 32 ]
python
en
['en', 'error', 'th']
False
ErrorZ.traceref
(self)
The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int
The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807]
def traceref(self): """ The 'traceref' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int """ return self["traceref"]
[ "def", "traceref", "(", "self", ")", ":", "return", "self", "[", "\"traceref\"", "]" ]
[ 215, 4 ]
[ 225, 31 ]
python
en
['en', 'error', 'th']
False
ErrorZ.tracerefminus
(self)
The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int
The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807]
def tracerefminus(self): """ The 'tracerefminus' property is a integer and may be specified as: - An int (or float that will be cast to an int) in the interval [0, 9223372036854775807] Returns ------- int """ return self["tracerefminus"]
[ "def", "tracerefminus", "(", "self", ")", ":", "return", "self", "[", "\"tracerefminus\"", "]" ]
[ 234, 4 ]
[ 244, 36 ]
python
en
['en', 'error', 'th']
False
ErrorZ.type
(self)
Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths corr...
Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "sqrt", the bar lengths corr...
def type(self): """ Determines the rule used to generate the error bars. If *constant`, the bar lengths are of a constant value. Set this constant in `value`. If "percent", the bar lengths correspond to a percentage of underlying data. Set this percentage in `value`. If "...
[ "def", "type", "(", "self", ")", ":", "return", "self", "[", "\"type\"", "]" ]
[ 253, 4 ]
[ 271, 27 ]
python
en
['en', 'error', 'th']
False
ErrorZ.value
(self)
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float in the interval [0, inf] ...
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float in the interval [0, inf]
def value(self): """ Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars. The 'value' property is a number and may be specified as: - An int or float...
[ "def", "value", "(", "self", ")", ":", "return", "self", "[", "\"value\"", "]" ]
[ 280, 4 ]
[ 293, 28 ]
python
en
['en', 'error', 'th']
False
ErrorZ.valueminus
(self)
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valueminus' property is a number and ma...
Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valueminus' property is a number and ma...
def valueminus(self): """ Sets the value of either the percentage (if `type` is set to "percent") or the constant (if `type` is set to "constant") corresponding to the lengths of the error bars in the bottom (left) direction for vertical (horizontal) bars The 'valuem...
[ "def", "valueminus", "(", "self", ")", ":", "return", "self", "[", "\"valueminus\"", "]" ]
[ 302, 4 ]
[ 316, 33 ]
python
en
['en', 'error', 'th']
False
ErrorZ.visible
(self)
Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False)
def visible(self): """ Determines whether or not this set of error bars is visible. The 'visible' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["visible"]
[ "def", "visible", "(", "self", ")", ":", "return", "self", "[", "\"visible\"", "]" ]
[ 325, 4 ]
[ 336, 30 ]
python
en
['en', 'error', 'th']
False
ErrorZ.width
(self)
Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf]
def width(self): """ Sets the width (in px) of the cross-bar at both ends of the error bars. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return s...
[ "def", "width", "(", "self", ")", ":", "return", "self", "[", "\"width\"", "]" ]
[ 345, 4 ]
[ 357, 28 ]
python
en
['en', 'error', 'th']
False
ErrorZ.__init__
( self, arg=None, array=None, arrayminus=None, arrayminussrc=None, arraysrc=None, color=None, symmetric=None, thickness=None, traceref=None, tracerefminus=None, type=None, value=None, valueminus=None, ...
Construct a new ErrorZ object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.ErrorZ` array Sets the data corresponding the length of each...
Construct a new ErrorZ object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scatter3d.ErrorZ` array Sets the data corresponding the length of each...
def __init__( self, arg=None, array=None, arrayminus=None, arrayminussrc=None, arraysrc=None, color=None, symmetric=None, thickness=None, traceref=None, tracerefminus=None, type=None, value=None, valueminus=N...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "array", "=", "None", ",", "arrayminus", "=", "None", ",", "arrayminussrc", "=", "None", ",", "arraysrc", "=", "None", ",", "color", "=", "None", ",", "symmetric", "=", "None", ",", "thick...
[ 423, 4 ]
[ 601, 34 ]
python
en
['en', 'error', 'th']
False
parse_config
(config_strings)
Parse config from strings. Args: config_strings (string): strings of model config. Returns: Config: model config
Parse config from strings.
def parse_config(config_strings): """Parse config from strings. Args: config_strings (string): strings of model config. Returns: Config: model config """ temp_file = tempfile.NamedTemporaryFile() config_path = f'{temp_file.name}.py' with open(config_path, 'w') as f: ...
[ "def", "parse_config", "(", "config_strings", ")", ":", "temp_file", "=", "tempfile", ".", "NamedTemporaryFile", "(", ")", "config_path", "=", "f'{temp_file.name}.py'", "with", "open", "(", "config_path", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "...
[ 18, 0 ]
[ 65, 17 ]
python
en
['en', 'en', 'en']
True
main
()
Convert keys in checkpoints for VoteNet. There can be some breaking changes during the development of mmdetection3d, and this tool is used for upgrading checkpoints trained with old versions (before v0.6.0) to the latest one.
Convert keys in checkpoints for VoteNet.
def main(): """Convert keys in checkpoints for VoteNet. There can be some breaking changes during the development of mmdetection3d, and this tool is used for upgrading checkpoints trained with old versions (before v0.6.0) to the latest one. """ args = parse_args() checkpoint = torch.load(ar...
[ "def", "main", "(", ")", ":", "args", "=", "parse_args", "(", ")", "checkpoint", "=", "torch", ".", "load", "(", "args", ".", "checkpoint", ")", "cfg", "=", "parse_config", "(", "checkpoint", "[", "'meta'", "]", "[", "'config'", "]", ")", "# Build the ...
[ 68, 0 ]
[ 146, 36 ]
python
en
['en', 'no', 'en']
True
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.choroplethmapb ox.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
Upgrader.processLedger
(self)
Checks ledger for planned but not yet performed upgrades and schedules upgrade for the most recent one Assumption: Only version is enough to identify a release, no hash checking is done :return:
Checks ledger for planned but not yet performed upgrades and schedules upgrade for the most recent one
def processLedger(self) -> None: """ Checks ledger for planned but not yet performed upgrades and schedules upgrade for the most recent one Assumption: Only version is enough to identify a release, no hash checking is done :return: """ logger.debug( ...
[ "def", "processLedger", "(", "self", ")", "->", "None", ":", "logger", ".", "debug", "(", "'{} processing config ledger for any upgrades'", ".", "format", "(", "self", ")", ")", "last_pool_upgrade_txn_start", "=", "self", ".", "get_upgrade_txn", "(", "lambda", "tx...
[ 151, 4 ]
[ 180, 62 ]
python
en
['en', 'error', 'th']
False
Upgrader.didLastExecutedUpgradeSucceeded
(self)
Checks last record in upgrade log to find out whether it is about scheduling upgrade. If so - checks whether current version is equals to the one in that record :returns: upgrade execution result
Checks last record in upgrade log to find out whether it is about scheduling upgrade. If so - checks whether current version is equals to the one in that record
def didLastExecutedUpgradeSucceeded(self) -> bool: """ Checks last record in upgrade log to find out whether it is about scheduling upgrade. If so - checks whether current version is equals to the one in that record :returns: upgrade execution result """ lastEven...
[ "def", "didLastExecutedUpgradeSucceeded", "(", "self", ")", "->", "bool", ":", "lastEventInfo", "=", "self", ".", "lastActionEventInfo", "if", "lastEventInfo", ":", "ev_data", "=", "lastEventInfo", ".", "data", "currentPkgVersion", "=", "NodeControlUtil", ".", "curr...
[ 184, 4 ]
[ 204, 20 ]
python
en
['en', 'error', 'th']
False
Upgrader.handleUpgradeTxn
(self, txn)
Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn:
Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time
def handleUpgradeTxn(self, txn) -> None: """ Handles transaction of type POOL_UPGRADE Can schedule or cancel upgrade to a newer version at specified time :param txn: """ FINALIZING_EVENT_TYPES = [UpgradeLog.Events.succeeded, UpgradeLog.Events.failed] if ...
[ "def", "handleUpgradeTxn", "(", "self", ",", "txn", ")", "->", "None", ":", "FINALIZING_EVENT_TYPES", "=", "[", "UpgradeLog", ".", "Events", ".", "succeeded", ",", "UpgradeLog", ".", "Events", ".", "failed", "]", "if", "get_type", "(", "txn", ")", "!=", ...
[ 249, 4 ]
[ 330, 38 ]
python
en
['en', 'error', 'th']
False
Upgrader._scheduleUpgrade
(self, ev_data: UpgradeLogData, failTimeout)
Schedules node upgrade to a newer version :param ev_data: upgrade event parameters
Schedules node upgrade to a newer version
def _scheduleUpgrade(self, ev_data: UpgradeLogData, failTimeout) -> None: """ Schedules node upgrade to a newer version :param ev_data: upgrade event parameters """ logger.info( "{}'s upgrader processing upgrade for v...
[ "def", "_scheduleUpgrade", "(", "self", ",", "ev_data", ":", "UpgradeLogData", ",", "failTimeout", ")", "->", "None", ":", "logger", ".", "info", "(", "\"{}'s upgrader processing upgrade for version {}={}\"", ".", "format", "(", "self", ",", "ev_data", ".", "pkg_n...
[ 332, 4 ]
[ 357, 40 ]
python
en
['en', 'error', 'th']
False
Upgrader._cancelScheduledUpgrade
(self, justification=None)
Cancels scheduled upgrade :param when: time upgrade was scheduled to :param version: version upgrade scheduled for
Cancels scheduled upgrade
def _cancelScheduledUpgrade(self, justification=None) -> None: """ Cancels scheduled upgrade :param when: time upgrade was scheduled to :param version: version upgrade scheduled for """ if self.scheduledAction: why_prefix = ": " why = justificati...
[ "def", "_cancelScheduledUpgrade", "(", "self", ",", "justification", "=", "None", ")", "->", "None", ":", "if", "self", ".", "scheduledAction", ":", "why_prefix", "=", "\": \"", "why", "=", "justification", "if", "justification", "is", "None", ":", "why_prefix...
[ 359, 4 ]
[ 395, 46 ]
python
en
['en', 'error', 'th']
False
Upgrader._callUpgradeAgent
(self, ev_data, failTimeout)
Callback which is called when upgrade time come. Writes upgrade record to upgrade log and asks node control service to perform upgrade :param when: upgrade time :param version: version to upgrade to
Callback which is called when upgrade time come. Writes upgrade record to upgrade log and asks node control service to perform upgrade
def _callUpgradeAgent(self, ev_data, failTimeout) -> None: """ Callback which is called when upgrade time come. Writes upgrade record to upgrade log and asks node control service to perform upgrade :param when: upgrade time :param version: version to upgrade to "...
[ "def", "_callUpgradeAgent", "(", "self", ",", "ev_data", ",", "failTimeout", ")", "->", "None", ":", "logger", ".", "info", "(", "\"{}'s upgrader calling agent for upgrade\"", ".", "format", "(", "self", ")", ")", "self", ".", "_actionLog", ".", "append_started"...
[ 397, 4 ]
[ 412, 59 ]
python
en
['en', 'error', 'th']
False
Upgrader._declareTimeoutExceeded
(self, ev_data: UpgradeLogData)
This function is called when time for upgrade is up
This function is called when time for upgrade is up
def _declareTimeoutExceeded(self, ev_data: UpgradeLogData): """ This function is called when time for upgrade is up """ logger.info("Timeout exceeded for {}:{}" .format(ev_data.when, ev_data.version)) last = self._actionLog.last_event # TODO test this ...
[ "def", "_declareTimeoutExceeded", "(", "self", ",", "ev_data", ":", "UpgradeLogData", ")", ":", "logger", ".", "info", "(", "\"Timeout exceeded for {}:{}\"", ".", "format", "(", "ev_data", ".", "when", ",", "ev_data", ".", "version", ")", ")", "last", "=", "...
[ 439, 4 ]
[ 453, 36 ]
python
en
['en', 'error', 'th']
False
Upgrader.isScheduleValid
(self, schedule, node_srvs, force)
Validates schedule of planned node upgrades :param schedule: dictionary of node ids and upgrade times :param node_srvs: dictionary of node ids and services :return: a 2-tuple of whether schedule valid or not and the reason
Validates schedule of planned node upgrades
def isScheduleValid(self, schedule, node_srvs, force) -> (bool, str): """ Validates schedule of planned node upgrades :param schedule: dictionary of node ids and upgrade times :param node_srvs: dictionary of node ids and services :return: a 2-tuple of whether schedule valid or n...
[ "def", "isScheduleValid", "(", "self", ",", "schedule", ",", "node_srvs", ",", "force", ")", "->", "(", "bool", ",", "str", ")", ":", "# flag \"force=True\" ignore basic checks! only datetime format is", "# checked", "times", "=", "[", "]", "non_demoted_nodes", "=",...
[ 478, 4 ]
[ 511, 23 ]
python
en
['en', 'error', 'th']
False
_create_version
()
Helper function for building the version string
Helper function for building the version string
def _create_version(): """ Helper function for building the version string """ import os from subprocess import check_output, CalledProcessError, STDOUT version = "Unknown" root = os.path.dirname(os.path.abspath(__file__)) try: with open(os.path.join(root, "VERSION.txt"), 'r') a...
[ "def", "_create_version", "(", ")", ":", "import", "os", "from", "subprocess", "import", "check_output", ",", "CalledProcessError", ",", "STDOUT", "version", "=", "\"Unknown\"", "root", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "...
[ 91, 0 ]
[ 110, 18 ]
python
en
['en', 'error', 'th']
False
_init
()
This function is called automatically by the launcher only after Evennia has fully initialized all its models. It sets up the API in a safe environment where all models are available already.
This function is called automatically by the launcher only after Evennia has fully initialized all its models. It sets up the API in a safe environment where all models are available already.
def _init(): """ This function is called automatically by the launcher only after Evennia has fully initialized all its models. It sets up the API in a safe environment where all models are available already. """ global DefaultAccount, DefaultObject, DefaultGuest, DefaultCharacter global Def...
[ "def", "_init", "(", ")", ":", "global", "DefaultAccount", ",", "DefaultObject", ",", "DefaultGuest", ",", "DefaultCharacter", "global", "DefaultRoom", ",", "DefaultExit", ",", "DefaultChannel", ",", "DefaultScript", "global", "ObjectDB", ",", "AccountDB", ",", "S...
[ 117, 0 ]
[ 315, 20 ]
python
en
['en', 'error', 'th']
False
set_trace
(debugger="auto", term_size=(140, 40))
Helper function for running a debugger inside the Evennia event loop. Args: debugger (str, optional): One of 'auto', 'pdb' or 'pudb'. Pdb is the standard debugger. Pudb is an external package with a different, more 'graphical', ncurses-based UI. With 'auto', will use pudb if po...
Helper function for running a debugger inside the Evennia event loop.
def set_trace(debugger="auto", term_size=(140, 40)): """ Helper function for running a debugger inside the Evennia event loop. Args: debugger (str, optional): One of 'auto', 'pdb' or 'pudb'. Pdb is the standard debugger. Pudb is an external package with a different, more 'graphical', nc...
[ "def", "set_trace", "(", "debugger", "=", "\"auto\"", ",", "term_size", "=", "(", "140", ",", "40", ")", ")", ":", "import", "sys", "dbg", "=", "None", "pudb_mode", "=", "False", "if", "debugger", "in", "(", "'auto'", ",", "'pudb'", ")", ":", "try", ...
[ 323, 0 ]
[ 376, 45 ]
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 ]
[ 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 this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. Parameters ---------- arg dict of properties compatible with this constructor or an inst...
Construct a new Font object Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute.
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Font object Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. Parameters ---------- arg...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "family", "=", "None", ",", "size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Font", ",", "self", ")", ".", "__init__", "(", "\"font\"",...
[ 143, 4 ]
[ 227, 34 ]
python
en
['en', 'error', 'th']
False
ActionLog._append
(self, ev_type: Enum, data: ActionLogData)
Appends event to log Be careful it opens file every time!
Appends event to log Be careful it opens file every time!
def _append(self, ev_type: Enum, data: ActionLogData) -> None: """ Appends event to log Be careful it opens file every time! """ event = ActionLogEvent(None, ev_type, data, types=self._event_types) with open(self._file_path, mode='a+', newline='') as f: f.writ...
[ "def", "_append", "(", "self", ",", "ev_type", ":", "Enum", ",", "data", ":", "ActionLogData", ")", "->", "None", ":", "event", "=", "ActionLogEvent", "(", "None", ",", "ev_type", ",", "data", ",", "types", "=", "self", ".", "_event_types", ")", "with"...
[ 178, 4 ]
[ 186, 33 ]
python
en
['en', 'error', 'th']
False
InboundMessage.__init__
( self, payload: Union[str, bytes], receipt: MessageReceipt, *, connection_id: str = None, session_id: str = None, transport_type: str = None, )
Initialize the inbound message.
Initialize the inbound message.
def __init__( self, payload: Union[str, bytes], receipt: MessageReceipt, *, connection_id: str = None, session_id: str = None, transport_type: str = None, ): """Initialize the inbound message.""" self.connection_id = connection_id self....
[ "def", "__init__", "(", "self", ",", "payload", ":", "Union", "[", "str", ",", "bytes", "]", ",", "receipt", ":", "MessageReceipt", ",", "*", ",", "connection_id", ":", "str", "=", "None", ",", "session_id", ":", "str", "=", "None", ",", "transport_typ...
[ 10, 4 ]
[ 24, 44 ]
python
en
['en', 'en', 'en']
True
get_context_generator
( override_opt: Optional[Dict[str, Any]] = None )
Return an object to return BlendedSkillTalk-style context info (personas, etc.).
Return an object to return BlendedSkillTalk-style context info (personas, etc.).
def get_context_generator( override_opt: Optional[Dict[str, Any]] = None ) -> ContextGenerator: """ Return an object to return BlendedSkillTalk-style context info (personas, etc.). """ argparser = ParlaiParser(False, False) argparser.add_parlai_data_path() if override_opt is not None: ...
[ "def", "get_context_generator", "(", "override_opt", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ")", "->", "ContextGenerator", ":", "argparser", "=", "ParlaiParser", "(", "False", ",", "False", ")", "argparser", ".", "add_...
[ 412, 0 ]
[ 426, 28 ]
python
en
['en', 'error', 'th']
False
get_image_src
( image: Optional[Image.Image] = None, path: Optional[str] = None )
Given an image or the path to an image, return a string of the encoded image that can be used as the src field in an HTML img tag.
Given an image or the path to an image, return a string of the encoded image that can be used as the src field in an HTML img tag.
def get_image_src( image: Optional[Image.Image] = None, path: Optional[str] = None ) -> str: """ Given an image or the path to an image, return a string of the encoded image that can be used as the src field in an HTML img tag. """ if image is None: image = Image.open(path) rgb_image...
[ "def", "get_image_src", "(", "image", ":", "Optional", "[", "Image", ".", "Image", "]", "=", "None", ",", "path", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "if", "image", "is", "None", ":", "image", "=", "Image", ".", ...
[ 429, 0 ]
[ 443, 20 ]
python
en
['en', 'error', 'th']
False
ImageStack.get_pointer
(self)
Return the index of the first entry in the stack that needs more conversations.
Return the index of the first entry in the stack that needs more conversations.
def get_pointer(self) -> int: """ Return the index of the first entry in the stack that needs more conversations. """ pointer = 0 found = False while not found: if self._need_more_convos(self.stack[pointer]): found = True else: ...
[ "def", "get_pointer", "(", "self", ")", "->", "int", ":", "pointer", "=", "0", "found", "=", "False", "while", "not", "found", ":", "if", "self", ".", "_need_more_convos", "(", "self", ".", "stack", "[", "pointer", "]", ")", ":", "found", "=", "True"...
[ 129, 4 ]
[ 140, 22 ]
python
en
['en', 'error', 'th']
False
ImageStack.stretch_stack
(self)
"Stretch" the stack to handle the current set of models. The goal is to preserve as many existing stack entries as possible while matching the set of models in the stack with the new set of models in self.models: - (1) All stack entries belonging to models that are still in sel...
"Stretch" the stack to handle the current set of models.
def stretch_stack(self) -> int: """ "Stretch" the stack to handle the current set of models. The goal is to preserve as many existing stack entries as possible while matching the set of models in the stack with the new set of models in self.models: - (1) All stack entrie...
[ "def", "stretch_stack", "(", "self", ")", "->", "int", ":", "# Stretch the stack", "existing_models", "=", "set", "(", "self", ".", "stack", "[", "0", "]", ".", "keys", "(", ")", ")", "new_models", "=", "set", "(", "self", ".", "models", ")", "models_t...
[ 142, 4 ]
[ 181, 22 ]
python
en
['en', 'error', 'th']
False
ImageStack.save_stack
(self)
Save the stack to its regular location. Mark down the save time.
Save the stack to its regular location.
def save_stack(self): """ Save the stack to its regular location. Mark down the save time. """ self._save_stack_to_path(self.save_path) self.last_save_time = time.time()
[ "def", "save_stack", "(", "self", ")", ":", "self", ".", "_save_stack_to_path", "(", "self", ".", "save_path", ")", "self", ".", "last_save_time", "=", "time", ".", "time", "(", ")" ]
[ 187, 4 ]
[ 194, 41 ]
python
en
['en', 'error', 'th']
False
ImageStack.save_stack_backup
(self)
Save a backup copy of the stack to a path with a datetime suffix.
Save a backup copy of the stack to a path with a datetime suffix.
def save_stack_backup(self): """ Save a backup copy of the stack to a path with a datetime suffix. """ suffix = datetime.datetime.now().strftime('%Y_%m_%d__%H_%M_%S') backup_path = os.path.join( self.backup_save_folder, f'{self.save_name}.{suffix}' ) s...
[ "def", "save_stack_backup", "(", "self", ")", ":", "suffix", "=", "datetime", ".", "datetime", ".", "now", "(", ")", ".", "strftime", "(", "'%Y_%m_%d__%H_%M_%S'", ")", "backup_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "backup_save_folde...
[ 196, 4 ]
[ 204, 45 ]
python
en
['en', 'error', 'th']
False
ImageStack._save_stack_to_path
(self, path: str)
Save stack to the specified path.
Save stack to the specified path.
def _save_stack_to_path(self, path: str): """ Save stack to the specified path. """ with self.save_lock: print(f'Saving all data to {path}.') data = json.dumps(self.stack) with open(path, 'w') as f: f.write(data)
[ "def", "_save_stack_to_path", "(", "self", ",", "path", ":", "str", ")", ":", "with", "self", ".", "save_lock", ":", "print", "(", "f'Saving all data to {path}.'", ")", "data", "=", "json", ".", "dumps", "(", "self", ".", "stack", ")", "with", "open", "(...
[ 206, 4 ]
[ 214, 29 ]
python
en
['en', 'error', 'th']
False
ImageStack._need_more_convos
(self, workers_by_model: Dict[str, list])
Returns True if, for the given image, we need at least 1 more conversation with any of the models that we're testing.
Returns True if, for the given image, we need at least 1 more conversation with any of the models that we're testing.
def _need_more_convos(self, workers_by_model: Dict[str, list]) -> bool: """ Returns True if, for the given image, we need at least 1 more conversation with any of the models that we're testing. """ return any( len(workers) < self.evals_per_combo for workers in workers...
[ "def", "_need_more_convos", "(", "self", ",", "workers_by_model", ":", "Dict", "[", "str", ",", "list", "]", ")", "->", "bool", ":", "return", "any", "(", "len", "(", "workers", ")", "<", "self", ".", "evals_per_combo", "for", "workers", "in", "workers_b...
[ 216, 4 ]
[ 223, 9 ]
python
en
['en', 'error', 'th']
False
ImageStack._get_stack_entry
(self, idx: int)
Return a stack entry if the input index is less than the length of the stack; return None otherwise.
Return a stack entry if the input index is less than the length of the stack; return None otherwise.
def _get_stack_entry(self, idx: int) -> Optional[Dict[str, Any]]: """ Return a stack entry if the input index is less than the length of the stack; return None otherwise. """ if idx < len(self.stack): return self.stack[idx] else: return None
[ "def", "_get_stack_entry", "(", "self", ",", "idx", ":", "int", ")", "->", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "if", "idx", "<", "len", "(", "self", ".", "stack", ")", ":", "return", "self", ".", "stack", "[", "idx", ...
[ 239, 4 ]
[ 247, 23 ]
python
en
['en', 'error', 'th']
False
ImageStack.get_next_image
(self, worker: str)
Returns the image name, persona strings, model name, etc. for the next HIT. Finds an image that we don't currently have enough conversations for, ensuring that the given worker will not have had a conversation employing this image before, with any model. Returns the index of the given ...
Returns the image name, persona strings, model name, etc. for the next HIT.
def get_next_image(self, worker: str) -> Tuple[int, str, bool]: """ Returns the image name, persona strings, model name, etc. for the next HIT. Finds an image that we don't currently have enough conversations for, ensuring that the given worker will not have had a conversation employing...
[ "def", "get_next_image", "(", "self", ",", "worker", ":", "str", ")", "->", "Tuple", "[", "int", ",", "str", ",", "bool", "]", ":", "with", "self", ".", "next_image_lock", ":", "no_more_work", "=", "False", "# Find the next entry in the stack that needs more wor...
[ 249, 4 ]
[ 313, 61 ]
python
en
['en', 'error', 'th']
False
AbstractModelChatTest._check_output_key
(self, key: str, actual_value: Any, expected_value: Any)
Special logic for handling the 'final_chat_data' key.
Special logic for handling the 'final_chat_data' key.
def _check_output_key(self, key: str, actual_value: Any, expected_value: Any): """ Special logic for handling the 'final_chat_data' key. """ if key == 'final_chat_data': self._check_final_chat_data( actual_value=actual_value, expected_value=expected_value ...
[ "def", "_check_output_key", "(", "self", ",", "key", ":", "str", ",", "actual_value", ":", "Any", ",", "expected_value", ":", "Any", ")", ":", "if", "key", "==", "'final_chat_data'", ":", "self", ".", "_check_final_chat_data", "(", "actual_value", "=", "actu...
[ 336, 4 ]
[ 347, 13 ]
python
en
['en', 'error', 'th']
False
AbstractModelChatTest._check_final_chat_data
( self, actual_value: Dict[str, Any], expected_value: Dict[str, Any] )
Check the actual and expected values of the final chat data.
Check the actual and expected values of the final chat data.
def _check_final_chat_data( self, actual_value: Dict[str, Any], expected_value: Dict[str, Any] ): """ Check the actual and expected values of the final chat data. """ for key_inner, expected_value_inner in expected_value.items(): if key_inner == 'dialog': ...
[ "def", "_check_final_chat_data", "(", "self", ",", "actual_value", ":", "Dict", "[", "str", ",", "Any", "]", ",", "expected_value", ":", "Dict", "[", "str", ",", "Any", "]", ")", ":", "for", "key_inner", ",", "expected_value_inner", "in", "expected_value", ...
[ 349, 4 ]
[ 409, 17 ]
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 ]
[ 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 Set the font used to display the title Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.indicator.title.Font` color ...
Construct a new Font object Set the font used to display the title
def __init__(self, arg=None, color=None, family=None, size=None, **kwargs): """ Construct a new Font object Set the font used to display the title Parameters ---------- arg dict of properties compatible with this constructor or an instanc...
[ "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
__init__
(self, topic_name: str, **kwargs)
SNS Access :param topic_name: SNS topic :param kwargs: kwargs
SNS Access
def __init__(self, topic_name: str, **kwargs): """ SNS Access :param topic_name: SNS topic :param kwargs: kwargs """ super().__init__(resource_name="sns", **kwargs) self.topic_name = topic_name
[ "def", "__init__", "(", "self", ",", "topic_name", ":", "str", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "resource_name", "=", "\"sns\"", ",", "*", "*", "kwargs", ")", "self", ".", "topic_name", "=", "topic_name" ]
[ 13, 4 ]
[ 21, 36 ]
python
en
['en', 'error', 'th']
False
get_topic
(self)
gets the associated SNS Topic instance :param topic_name: topic name :return: sns.Topic instance
gets the associated SNS Topic instance
def get_topic(self): """ gets the associated SNS Topic instance :param topic_name: topic name :return: sns.Topic instance """ topic = None for t in self.resource.topics.all(): if t.arn.split(":")[-1] == self.topic_name: topic = t ...
[ "def", "get_topic", "(", "self", ")", ":", "topic", "=", "None", "for", "t", "in", "self", ".", "resource", ".", "topics", ".", "all", "(", ")", ":", "if", "t", ".", "arn", ".", "split", "(", "\":\"", ")", "[", "-", "1", "]", "==", "self", "....
[ 23, 4 ]
[ 34, 20 ]
python
en
['en', 'error', 'th']
False
get_arn
(self)
get topic ARN from topic name :param topic_name: topic name string :return: topic ARN
get topic ARN from topic name
def get_arn(self) -> str: """ get topic ARN from topic name :param topic_name: topic name string :return: topic ARN """ return self.get_topic().arn
[ "def", "get_arn", "(", "self", ")", "->", "str", ":", "return", "self", ".", "get_topic", "(", ")", ".", "arn" ]
[ 37, 4 ]
[ 44, 35 ]
python
en
['en', 'error', 'th']
False
create_topic
(self)
create an SNS topic :return: the SNS topic's arn
create an SNS topic
def create_topic(self) -> str: """ create an SNS topic :return: the SNS topic's arn """ response = self.client.create_topic(Name=self.topic_name, Attributes={"DisplayName": self.topic_name}) # todo: see if there are any waiters for SNS topic creation # https://st...
[ "def", "create_topic", "(", "self", ")", "->", "str", ":", "response", "=", "self", ".", "client", ".", "create_topic", "(", "Name", "=", "self", ".", "topic_name", ",", "Attributes", "=", "{", "\"DisplayName\"", ":", "self", ".", "topic_name", "}", ")",...
[ 47, 4 ]
[ 56, 35 ]
python
en
['en', 'error', 'th']
False
delete_topic
(self)
delete SNS topic
delete SNS topic
def delete_topic(self): """ delete SNS topic """ self.client.delete_topic(TopicArn=self.get_arn())
[ "def", "delete_topic", "(", "self", ")", ":", "self", ".", "client", ".", "delete_topic", "(", "TopicArn", "=", "self", ".", "get_arn", "(", ")", ")" ]
[ 58, 4 ]
[ 63, 57 ]
python
en
['en', 'error', 'th']
False
WizardTransformerRankerAgent.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. """ super().add_cmdline_args(parser, partial_opt=partial_opt) agent = parser.add_argument_group('Wizard Tr...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "super", "(", ")", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt", "="...
[ 25, 4 ]
[ 68, 20 ]
python
en
['en', 'error', 'th']
False
WizardTransformerRankerAgent.__init__
(self, opt, shared=None)
Set up model.
Set up model.
def __init__(self, opt, shared=None): """ Set up model. """ super().__init__(opt, shared) self.use_knowledge = opt.get('use_knowledge', False) if self.use_knowledge: self.opt['use_memories'] = True self.chosen_sentence = opt.get('chosen_sentence', Fal...
[ "def", "__init__", "(", "self", ",", "opt", ",", "shared", "=", "None", ")", ":", "super", "(", ")", ".", "__init__", "(", "opt", ",", "shared", ")", "self", ".", "use_knowledge", "=", "opt", ".", "get", "(", "'use_knowledge'", ",", "False", ")", "...
[ 70, 4 ]
[ 81, 67 ]
python
en
['en', 'error', 'th']
False
WizardTransformerRankerAgent._set_text_vec
(self, *args, **kwargs)
Sets the 'text_vec' field in the observation. Useful to override to change vectorization behavior
Sets the 'text_vec' field in the observation.
def _set_text_vec(self, *args, **kwargs): """ Sets the 'text_vec' field in the observation. Useful to override to change vectorization behavior """ obs = super()._set_text_vec(*args, **kwargs) if self.opt.get('legacy') and 'text_vec' in obs: if obs['text_vec'...
[ "def", "_set_text_vec", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "obs", "=", "super", "(", ")", ".", "_set_text_vec", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "self", ".", "opt", ".", "get", "(", "'legacy'", ...
[ 83, 4 ]
[ 94, 18 ]
python
en
['en', 'error', 'th']
False
WizardTransformerRankerAgent._vectorize_memories
(self, observation)
Override abstract method from TransformerRankerAgent to use knowledge field as memories.
Override abstract method from TransformerRankerAgent to use knowledge field as memories.
def _vectorize_memories(self, observation): """ Override abstract method from TransformerRankerAgent to use knowledge field as memories. """ if not self.use_knowledge: return observation observation['memory_vecs'] = [] checked = observation.get('che...
[ "def", "_vectorize_memories", "(", "self", ",", "observation", ")", ":", "if", "not", "self", ".", "use_knowledge", ":", "return", "observation", "observation", "[", "'memory_vecs'", "]", "=", "[", "]", "checked", "=", "observation", ".", "get", "(", "'check...
[ 96, 4 ]
[ 139, 26 ]
python
en
['en', 'error', 'th']
False
WizardTransformerRankerAgent.load
(self, path)
Return opt and model states. Override this method from TorchAgent to allow us to load partial weights from pre-trained models.
Return opt and model states.
def load(self, path): """ Return opt and model states. Override this method from TorchAgent to allow us to load partial weights from pre-trained models. """ with PathManager.open(path, 'rb') as f: states = torch.load(f, map_location=lambda cpu, _: cpu) ...
[ "def", "load", "(", "self", ",", "path", ")", ":", "with", "PathManager", ".", "open", "(", "path", ",", "'rb'", ")", "as", "f", ":", "states", "=", "torch", ".", "load", "(", "f", ",", "map_location", "=", "lambda", "cpu", ",", "_", ":", "cpu", ...
[ 141, 4 ]
[ 165, 21 ]
python
en
['en', 'error', 'th']
False
StyleAgentMixin.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Add command-line arguments specifically for this agent. Does not add arguments from its superclass because it's a mixin.
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. Does not add arguments from its superclass because it's a mixin. """ agent = parser.add_argument_group('S...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "agent", "=", "parser", ".", "add_argument_group", "(", "'StyleAgentMixin arguments'", ...
[ 38, 4 ]
[ 53, 20 ]
python
en
['en', 'error', 'th']
False
StyleAgentMixin.get_temp_history
(self, observation: Message)
Conditionally return a style-token string to temporarily insert into history.
Conditionally return a style-token string to temporarily insert into history.
def get_temp_history(self, observation: Message) -> Optional[str]: """ Conditionally return a style-token string to temporarily insert into history. """ use_style_rand = random.random() if use_style_rand < self.use_style_frac: # Use the style style = obser...
[ "def", "get_temp_history", "(", "self", ",", "observation", ":", "Message", ")", "->", "Optional", "[", "str", "]", ":", "use_style_rand", "=", "random", ".", "random", "(", ")", "if", "use_style_rand", "<", "self", ".", "use_style_frac", ":", "# Use the sty...
[ 59, 4 ]
[ 73, 42 ]
python
en
['en', 'error', 'th']
False
ClassifierOnGeneratorModel.build_decoder
( cls, opt, dictionary, embedding=None, padding_idx=None, n_positions=1024, n_segments=0, )
Return TransformerDecoderWithEmbeds instead of TransformerDecoder.
Return TransformerDecoderWithEmbeds instead of TransformerDecoder.
def build_decoder( cls, opt, dictionary, embedding=None, padding_idx=None, n_positions=1024, n_segments=0, ): """ Return TransformerDecoderWithEmbeds instead of TransformerDecoder. """ n_layers = ( opt['n_decoder_lay...
[ "def", "build_decoder", "(", "cls", ",", "opt", ",", "dictionary", ",", "embedding", "=", "None", ",", "padding_idx", "=", "None", ",", "n_positions", "=", "1024", ",", "n_segments", "=", "0", ",", ")", ":", "n_layers", "=", "(", "opt", "[", "'n_decode...
[ 84, 4 ]
[ 118, 9 ]
python
en
['en', 'error', 'th']
False
ClassifierOnGeneratorModel.forward
(self, *xs)
Get output class logits from the model. :param xs: - list of inputs to the encoder/decoder. Elements: - text_vec: (LongTensor[bsz, text seqlen]) :return: - the model's predicted per-class scores. (FloatTensor[bsz, len(class_list)])
Get output class logits from the model.
def forward(self, *xs): """ Get output class logits from the model. :param xs: - list of inputs to the encoder/decoder. Elements: - text_vec: (LongTensor[bsz, text seqlen]) :return: - the model's predicted per-class scores. (FloatTenso...
[ "def", "forward", "(", "self", ",", "*", "xs", ")", ":", "# All tokens go into the encoder and classification is learned from that.", "assert", "len", "(", "xs", ")", "==", "1", "# Only one input allowed", "bsz", "=", "xs", "[", "0", "]", ".", "size", "(", "0", ...
[ 124, 4 ]
[ 147, 21 ]
python
en
['en', 'error', 'th']
False
TransformerDecoderWithEmbeds.forward
(self, input, encoder_state, embedded_input=None, incr_state=None)
Forward pass with the ability to pass in token-embedded inputs.
Forward pass with the ability to pass in token-embedded inputs.
def forward(self, input, encoder_state, embedded_input=None, incr_state=None): """ Forward pass with the ability to pass in token-embedded inputs. """ encoder_output, encoder_mask = encoder_state if input is not None: seq_len = input.size(1) positions = ...
[ "def", "forward", "(", "self", ",", "input", ",", "encoder_state", ",", "embedded_input", "=", "None", ",", "incr_state", "=", "None", ")", ":", "encoder_output", ",", "encoder_mask", "=", "encoder_state", "if", "input", "is", "not", "None", ":", "seq_len", ...
[ 151, 4 ]
[ 212, 37 ]
python
en
['en', 'error', 'th']
False
ClassificationMixin._update_confusion_matrix
( self, predictions: List[Optional[str]], labels: List[Optional[List[str]]] )
Update the confusion matrix given the batch and predictions. :param predictions: List of strings of length batchsize. Each string is a label predicted by the classifier. A string will be None if the corresponding observation is empty. :param labels: List of label fields...
Update the confusion matrix given the batch and predictions.
def _update_confusion_matrix( self, predictions: List[Optional[str]], labels: List[Optional[List[str]]] ): """ Update the confusion matrix given the batch and predictions. :param predictions: List of strings of length batchsize. Each string is a label predicted by the cl...
[ "def", "_update_confusion_matrix", "(", "self", ",", "predictions", ":", "List", "[", "Optional", "[", "str", "]", "]", ",", "labels", ":", "List", "[", "Optional", "[", "List", "[", "str", "]", "]", "]", ")", ":", "f1_dict", "=", "{", "}", "explode_...
[ 225, 4 ]
[ 271, 87 ]
python
en
['en', 'error', 'th']
False
_init_command
(cls, **kwargs)
Helper command. Makes sure all data are stored as lowercase and do checking on all properties that should be in list form. Sets up locks to be more forgiving. This is used both by the metaclass and (optionally) at instantiation time. If kwargs are given, these are set as instance-specific prop...
Helper command. Makes sure all data are stored as lowercase and do checking on all properties that should be in list form. Sets up locks to be more forgiving. This is used both by the metaclass and (optionally) at instantiation time.
def _init_command(cls, **kwargs): """ Helper command. Makes sure all data are stored as lowercase and do checking on all properties that should be in list form. Sets up locks to be more forgiving. This is used both by the metaclass and (optionally) at instantiation time. If kwargs are given...
[ "def", "_init_command", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "for", "i", "in", "range", "(", "len", "(", "kwargs", ")", ")", ":", "# used for dynamic creation of commands", "key", ",", "value", "=", "kwargs", ".", "popitem", "(", ")", "setattr"...
[ 17, 0 ]
[ 75, 49 ]
python
en
['en', 'error', 'th']
False
Command.__init__
(self, **kwargs)
The lockhandler works the same as for objects. optional kwargs will be set as properties on the Command at runtime, overloading evential same-named class properties.
The lockhandler works the same as for objects. optional kwargs will be set as properties on the Command at runtime, overloading evential same-named class properties.
def __init__(self, **kwargs): """ The lockhandler works the same as for objects. optional kwargs will be set as properties on the Command at runtime, overloading evential same-named class properties. """ if kwargs: _init_command(self, **kwargs)
[ "def", "__init__", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ":", "_init_command", "(", "self", ",", "*", "*", "kwargs", ")" ]
[ 163, 4 ]
[ 171, 41 ]
python
en
['en', 'error', 'th']
False
Command.__str__
(self)
Print the command key
Print the command key
def __str__(self): """ Print the command key """ return self.key
[ "def", "__str__", "(", "self", ")", ":", "return", "self", ".", "key" ]
[ 177, 4 ]
[ 181, 23 ]
python
en
['en', 'error', 'th']
False
Command.__eq__
(self, cmd)
Compare two command instances to each other by matching their key and aliases. Args: cmd (Command or str): Allows for equating both Command objects and their keys. Returns: equal (bool): If the commands are equal or not.
Compare two command instances to each other by matching their key and aliases.
def __eq__(self, cmd): """ Compare two command instances to each other by matching their key and aliases. Args: cmd (Command or str): Allows for equating both Command objects and their keys. Returns: equal (bool): If the commands are equa...
[ "def", "__eq__", "(", "self", ",", "cmd", ")", ":", "try", ":", "# first assume input is a command (the most common case)", "return", "self", ".", "_matchset", ".", "intersection", "(", "cmd", ".", "_matchset", ")", "except", "AttributeError", ":", "# probably got a...
[ 183, 4 ]
[ 201, 40 ]
python
en
['en', 'error', 'th']
False
Command.__ne__
(self, cmd)
The logical negation of __eq__. Since this is one of the most called methods in Evennia (along with __eq__) we do some code-duplication here rather than issuing a method-lookup to __eq__.
The logical negation of __eq__. Since this is one of the most called methods in Evennia (along with __eq__) we do some code-duplication here rather than issuing a method-lookup to __eq__.
def __ne__(self, cmd): """ The logical negation of __eq__. Since this is one of the most called methods in Evennia (along with __eq__) we do some code-duplication here rather than issuing a method-lookup to __eq__. """ try: return self._matchset.isdisj...
[ "def", "__ne__", "(", "self", ",", "cmd", ")", ":", "try", ":", "return", "self", ".", "_matchset", ".", "isdisjoint", "(", "cmd", ".", "_matchset", ")", "except", "AttributeError", ":", "return", "cmd", "not", "in", "self", ".", "_matchset" ]
[ 203, 4 ]
[ 213, 44 ]
python
en
['en', 'error', 'th']
False
Command.__contains__
(self, query)
This implements searches like 'if query in cmd'. It's a fuzzy matching used by the help system, returning True if query can be found as a substring of the commands key or its aliases. Args: query (str): query to match against. Should be lower case. Returns: ...
This implements searches like 'if query in cmd'. It's a fuzzy matching used by the help system, returning True if query can be found as a substring of the commands key or its aliases.
def __contains__(self, query): """ This implements searches like 'if query in cmd'. It's a fuzzy matching used by the help system, returning True if query can be found as a substring of the commands key or its aliases. Args: query (str): query to match against. Shoul...
[ "def", "__contains__", "(", "self", ",", "query", ")", ":", "return", "any", "(", "query", "in", "keyalias", "for", "keyalias", "in", "self", ".", "_keyaliases", ")" ]
[ 215, 4 ]
[ 228, 70 ]
python
en
['en', 'error', 'th']
False