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
PresAttrSpec.satisfies
(self, pred_spec: PresPredSpec)
Whether current specified attribute satisfied input specified predicate.
Whether current specified attribute satisfied input specified predicate.
def satisfies(self, pred_spec: PresPredSpec): """Whether current specified attribute satisfied input specified predicate.""" return bool( self.value and not self.mime_type and self.name == pred_spec.name and self.cred_def_id == pred_spec.cred_def_id ...
[ "def", "satisfies", "(", "self", ",", "pred_spec", ":", "PresPredSpec", ")", ":", "return", "bool", "(", "self", ".", "value", "and", "not", "self", ".", "mime_type", "and", "self", ".", "name", "==", "pred_spec", ".", "name", "and", "self", ".", "cred...
[ 155, 4 ]
[ 166, 9 ]
python
en
['en', 'en', 'en']
True
PresAttrSpec.__eq__
(self, other)
Equality comparator.
Equality comparator.
def __eq__(self, other): """Equality comparator.""" if self.name != other.name: return False # distinct attribute names (canonicalized on init) if self.cred_def_id != other.cred_def_id: return False # distinct attribute cred def ids if self.mime_type != other...
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "if", "self", ".", "name", "!=", "other", ".", "name", ":", "return", "False", "# distinct attribute names (canonicalized on init)", "if", "self", ".", "cred_def_id", "!=", "other", ".", "cred_def_id", ":",...
[ 168, 4 ]
[ 180, 68 ]
python
en
['en', 'en', 'it']
False
PresentationPreview.__init__
( self, *, _type: str = None, attributes: Sequence[PresAttrSpec] = None, predicates: Sequence[PresPredSpec] = None, **kwargs, )
Initialize presentation preview object. Args: _type: formalism for Marshmallow model creation: ignored attributes: list of attribute specifications predicates: list of predicate specifications
Initialize presentation preview object.
def __init__( self, *, _type: str = None, attributes: Sequence[PresAttrSpec] = None, predicates: Sequence[PresPredSpec] = None, **kwargs, ): """ Initialize presentation preview object. Args: _type: formalism for Marshmallow model c...
[ "def", "__init__", "(", "self", ",", "*", ",", "_type", ":", "str", "=", "None", ",", "attributes", ":", "Sequence", "[", "PresAttrSpec", "]", "=", "None", ",", "predicates", ":", "Sequence", "[", "PresPredSpec", "]", "=", "None", ",", "*", "*", "kwa...
[ 213, 4 ]
[ 232, 64 ]
python
en
['en', 'error', 'th']
False
PresentationPreview._type
(self)
Accessor for message type.
Accessor for message type.
def _type(self): """Accessor for message type.""" return PresentationPreview.Meta.message_type
[ "def", "_type", "(", "self", ")", ":", "return", "PresentationPreview", ".", "Meta", ".", "message_type" ]
[ 235, 4 ]
[ 238, 52 ]
python
en
['da', 'en', 'en']
True
PresentationPreview.indy_proof_request
( self, name: str = None, version: str = None, nonce: str = None, ledger: IndyLedger = None, timestamps: Mapping[str, int] = None, )
Return indy proof request corresponding to presentation preview. Typically the verifier turns the proof preview into a proof request. Args: name: for proof request version: version for proof request nonce: nonce for proof request ledger: ledger ...
Return indy proof request corresponding to presentation preview.
async def indy_proof_request( self, name: str = None, version: str = None, nonce: str = None, ledger: IndyLedger = None, timestamps: Mapping[str, int] = None, ) -> dict: """ Return indy proof request corresponding to presentation preview. Typi...
[ "async", "def", "indy_proof_request", "(", "self", ",", "name", ":", "str", "=", "None", ",", "version", ":", "str", "=", "None", ",", "nonce", ":", "str", "=", "None", ",", "ledger", ":", "IndyLedger", "=", "None", ",", "timestamps", ":", "Mapping", ...
[ 240, 4 ]
[ 348, 24 ]
python
en
['en', 'error', 'th']
False
PresentationPreview.__eq__
(self, other)
Equality comparator.
Equality comparator.
def __eq__(self, other): """Equality comparator.""" for part in vars(self): if getattr(self, part, None) != getattr(other, part, None): return False return True
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "for", "part", "in", "vars", "(", "self", ")", ":", "if", "getattr", "(", "self", ",", "part", ",", "None", ")", "!=", "getattr", "(", "other", ",", "part", ",", "None", ")", ":", "return", ...
[ 350, 4 ]
[ 356, 19 ]
python
en
['en', 'en', 'it']
False
RunWithFlag
(flag)
Runs gtest_help_test_ with the given flag. Returns: the exit code and the text output as a tuple. Args: flag: the command-line flag to pass to gtest_help_test_, or None.
Runs gtest_help_test_ with the given flag.
def RunWithFlag(flag): """Runs gtest_help_test_ with the given flag. Returns: the exit code and the text output as a tuple. Args: flag: the command-line flag to pass to gtest_help_test_, or None. """ if flag is None: command = [PROGRAM_PATH] else: command = [PROGRAM_PATH, flag] child = g...
[ "def", "RunWithFlag", "(", "flag", ")", ":", "if", "flag", "is", "None", ":", "command", "=", "[", "PROGRAM_PATH", "]", "else", ":", "command", "=", "[", "PROGRAM_PATH", ",", "flag", "]", "child", "=", "gtest_test_utils", ".", "Subprocess", "(", "command...
[ 80, 0 ]
[ 94, 38 ]
python
en
['en', 'en', 'en']
True
GTestHelpTest.TestHelpFlag
(self, flag)
Verifies correct behavior when help flag is specified. The right message must be printed and the tests must skipped when the given flag is specified. Args: flag: A flag to pass to the binary or None.
Verifies correct behavior when help flag is specified.
def TestHelpFlag(self, flag): """Verifies correct behavior when help flag is specified. The right message must be printed and the tests must skipped when the given flag is specified. Args: flag: A flag to pass to the binary or None. """ exit_code, output = RunWithFlag(flag) self.as...
[ "def", "TestHelpFlag", "(", "self", ",", "flag", ")", ":", "exit_code", ",", "output", "=", "RunWithFlag", "(", "flag", ")", "self", ".", "assertEquals", "(", "0", ",", "exit_code", ")", "self", ".", "assert_", "(", "HELP_REGEX", ".", "search", "(", "o...
[ 100, 2 ]
[ 122, 63 ]
python
en
['en', 'en', 'en']
True
GTestHelpTest.TestNonHelpFlag
(self, flag)
Verifies correct behavior when no help flag is specified. Verifies that when no help flag is specified, the tests are run and the help message is not printed. Args: flag: A flag to pass to the binary or None.
Verifies correct behavior when no help flag is specified.
def TestNonHelpFlag(self, flag): """Verifies correct behavior when no help flag is specified. Verifies that when no help flag is specified, the tests are run and the help message is not printed. Args: flag: A flag to pass to the binary or None. """ exit_code, output = RunWithFlag(flag)...
[ "def", "TestNonHelpFlag", "(", "self", ",", "flag", ")", ":", "exit_code", ",", "output", "=", "RunWithFlag", "(", "flag", ")", "self", ".", "assert_", "(", "exit_code", "!=", "0", ")", "self", ".", "assert_", "(", "not", "HELP_REGEX", ".", "search", "...
[ 124, 2 ]
[ 136, 55 ]
python
en
['en', 'en', 'en']
True
GTestHelpTest.testRunsTestsWithoutHelpFlag
(self)
Verifies that when no help flag is specified, the tests are run and the help message is not printed.
Verifies that when no help flag is specified, the tests are run and the help message is not printed.
def testRunsTestsWithoutHelpFlag(self): """Verifies that when no help flag is specified, the tests are run and the help message is not printed.""" self.TestNonHelpFlag(None)
[ "def", "testRunsTestsWithoutHelpFlag", "(", "self", ")", ":", "self", ".", "TestNonHelpFlag", "(", "None", ")" ]
[ 157, 2 ]
[ 161, 30 ]
python
en
['en', 'en', 'en']
True
GTestHelpTest.testRunsTestsWithGtestInternalFlag
(self)
Verifies that the tests are run and no help message is printed when a flag starting with Google Test prefix and 'internal_' is supplied.
Verifies that the tests are run and no help message is printed when a flag starting with Google Test prefix and 'internal_' is supplied.
def testRunsTestsWithGtestInternalFlag(self): """Verifies that the tests are run and no help message is printed when a flag starting with Google Test prefix and 'internal_' is supplied.""" self.TestNonHelpFlag(INTERNAL_FLAG_FOR_TESTING)
[ "def", "testRunsTestsWithGtestInternalFlag", "(", "self", ")", ":", "self", ".", "TestNonHelpFlag", "(", "INTERNAL_FLAG_FOR_TESTING", ")" ]
[ 163, 2 ]
[ 167, 51 ]
python
en
['en', 'en', 'en']
True
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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
Insidetextfont.__init__
( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs )
Construct a new Insidetextfont object Sets the font used for `textinfo` lying inside the sector. Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.pie.Insidetext...
Construct a new Insidetextfont object Sets the font used for `textinfo` lying inside the sector.
def __init__( self, arg=None, color=None, colorsrc=None, family=None, familysrc=None, size=None, sizesrc=None, **kwargs ): """ Construct a new Insidetextfont object Sets the font used for `textinfo` lying inside...
[ "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
read_port_table
(filename)
Open a file and find all PORT_TABLE_REGEX matches. Args: filename (str): file name Returns: set: all PORT_TABLE_REGEX matches
Open a file and find all PORT_TABLE_REGEX matches.
def read_port_table(filename): """Open a file and find all PORT_TABLE_REGEX matches. Args: filename (str): file name Returns: set: all PORT_TABLE_REGEX matches """ with open(filename, 'r') as fp: return set(PORT_TABLE_REGEX.findall(fp.read()))
[ "def", "read_port_table", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "fp", ":", "return", "set", "(", "PORT_TABLE_REGEX", ".", "findall", "(", "fp", ".", "read", "(", ")", ")", ")" ]
[ 21, 0 ]
[ 31, 55 ]
python
en
['en', 'en', 'en']
True
read_port_dirs
()
Check Ports directory for unexpected files and check each port has a package.sh file. Returns: list: all ports (set), no errors encountered (bool)
Check Ports directory for unexpected files and check each port has a package.sh file.
def read_port_dirs(): """Check Ports directory for unexpected files and check each port has a package.sh file. Returns: list: all ports (set), no errors encountered (bool) """ ports = set() all_good = True for entry in os.listdir(): if entry in IGNORE_FILES: continu...
[ "def", "read_port_dirs", "(", ")", ":", "ports", "=", "set", "(", ")", "all_good", "=", "True", "for", "entry", "in", "os", ".", "listdir", "(", ")", ":", "if", "entry", "in", "IGNORE_FILES", ":", "continue", "if", "not", "os", ".", "path", ".", "i...
[ 34, 0 ]
[ 56, 26 ]
python
en
['en', 'en', 'en']
True
check_package_files
(ports)
Check port package.sh file for required properties. Args: ports (set): List of all ports to check Returns: bool: no errors encountered
Check port package.sh file for required properties.
def check_package_files(ports): """Check port package.sh file for required properties. Args: ports (set): List of all ports to check Returns: bool: no errors encountered """ packages = set() all_good = True for port in ports: package_file = f"{port}/package.sh" ...
[ "def", "check_package_files", "(", "ports", ")", ":", "packages", "=", "set", "(", ")", "all_good", "=", "True", "for", "port", "in", "ports", ":", "package_file", "=", "f\"{port}/package.sh\"", "if", "not", "os", ".", "path", ".", "exists", "(", "package_...
[ 59, 0 ]
[ 86, 19 ]
python
en
['en', 'en', 'en']
True
run
()
Check Ports directory and package files for errors.
Check Ports directory and package files for errors.
def run(): """Check Ports directory and package files for errors.""" from_table = read_port_table(PORT_TABLE_FILE) ports, all_good = read_port_dirs() if from_table - ports: all_good = False print('AvailablePorts.md lists ports that do not appear in the file system:') for port i...
[ "def", "run", "(", ")", ":", "from_table", "=", "read_port_table", "(", "PORT_TABLE_FILE", ")", "ports", ",", "all_good", "=", "read_port_dirs", "(", ")", "if", "from_table", "-", "ports", ":", "all_good", "=", "False", "print", "(", "'AvailablePorts.md lists ...
[ 89, 0 ]
[ 113, 29 ]
python
en
['en', 'en', 'en']
True
at_search_result
(matches, caller, query="", quiet=False, **kwargs)
This is a generic hook for handling all processing of a search result, including error reporting. Args: matches (list): This is a list of 0, 1 or more typeclass instances, the matched result of the search. If 0, a nomatch error should be echoed, and if >1, multimatch errors...
This is a generic hook for handling all processing of a search result, including error reporting.
def at_search_result(matches, caller, query="", quiet=False, **kwargs): """ This is a generic hook for handling all processing of a search result, including error reporting. Args: matches (list): This is a list of 0, 1 or more typeclass instances, the matched result of the search. I...
[ "def", "at_search_result", "(", "matches", ",", "caller", ",", "query", "=", "\"\"", ",", "quiet", "=", "False", ",", "*", "*", "kwargs", ")", ":" ]
[ 28, 0 ]
[ 53, 7 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Override to add personality-override option.
Override to add personality-override option.
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None ) -> ParlaiParser: """ Override to add personality-override option. """ TransresnetMultimodalModel.add_cmdline_args(parser, partial_opt=partial_opt) super().add_cmdline_args(parser, par...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "TransresnetMultimodalModel", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt"...
[ 43, 4 ]
[ 66, 24 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent._setup_cands
(self)
Override for different call to model.
Override for different call to model.
def _setup_cands(self): """ Override for different call to model. """ self.fixed_cands = None self.fixed_cands_enc = None if self.fcp is not None: with PathManager.open(self.fcp) as f: self.fixed_cands = [c.replace("\n", "") for c in f.readline...
[ "def", "_setup_cands", "(", "self", ")", ":", "self", ".", "fixed_cands", "=", "None", "self", ".", "fixed_cands_enc", "=", "None", "if", "self", ".", "fcp", "is", "not", "None", ":", "with", "PathManager", ".", "open", "(", "self", ".", "fcp", ")", ...
[ 102, 4 ]
[ 138, 77 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.share
(self)
Override to share optimizer.
Override to share optimizer.
def share(self): """ Override to share optimizer. """ shared = super().share() shared["optimizer"] = self.optimizer return shared
[ "def", "share", "(", "self", ")", ":", "shared", "=", "super", "(", ")", ".", "share", "(", ")", "shared", "[", "\"optimizer\"", "]", "=", "self", ".", "optimizer", "return", "shared" ]
[ 140, 4 ]
[ 146, 21 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.observe
(self, observation)
Observe an observation. Additionally retrieves the dialogue history for the observation. :param observation: observation :return: the observation, with dialogue history included.
Observe an observation.
def observe(self, observation): """ Observe an observation. Additionally retrieves the dialogue history for the observation. :param observation: observation :return: the observation, with dialogue history included. """ observation = Mess...
[ "def", "observe", "(", "self", ",", "observation", ")", ":", "observation", "=", "Message", "(", "observation", ")", "# TODO: eventually this will not be", "# necessary as we migrate all teachers to return Message objects", "self", ".", "observation", "=", "self", ".", "g...
[ 148, 4 ]
[ 163, 31 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.train_step
(self, valid_obs, image_feats, personalities, dialogue_histories)
Model train step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per example :param dialogue_histories: list of dialogue...
Model train step.
def train_step(self, valid_obs, image_feats, personalities, dialogue_histories): """ Model train step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of per...
[ "def", "train_step", "(", "self", ",", "valid_obs", ",", "image_feats", ",", "personalities", ",", "dialogue_histories", ")", ":", "self", ".", "model", ".", "train", "(", ")", "labels", "=", "[", "random", ".", "choice", "(", "v", "[", "\"labels\"", "]"...
[ 165, 4 ]
[ 193, 32 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.eval_step
(self, valid_obs, image_feats, personalities, dialogue_histories)
Model eval step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of personalities, one per example :param dialogue_histories: list of dialogue ...
Model eval step.
def eval_step(self, valid_obs, image_feats, personalities, dialogue_histories): """ Model eval step. :param valid_obs: list of valid observations :param image_feats: list of image features, one per example :param personalities: list of perso...
[ "def", "eval_step", "(", "self", ",", "valid_obs", ",", "image_feats", ",", "personalities", ",", "dialogue_histories", ")", ":", "self", ".", "model", ".", "eval", "(", ")", "med_rank", "=", "None", "chosen_responses", "=", "None", "candidates_encoded", "=", ...
[ 195, 4 ]
[ 253, 60 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.batch_act
(self, observations)
Act on a batch of observations. :param observations: list of observations :return: A list of acts, one for each observation
Act on a batch of observations.
def batch_act(self, observations): """ Act on a batch of observations. :param observations: list of observations :return: A list of acts, one for each observation """ is_training = any(["labels" in obs for obs in observations]) valid_obs,...
[ "def", "batch_act", "(", "self", ",", "observations", ")", ":", "is_training", "=", "any", "(", "[", "\"labels\"", "in", "obs", "for", "obs", "in", "observations", "]", ")", "valid_obs", ",", "valid_indexes", "=", "self", ".", "filter_valid_obs", "(", "obs...
[ 255, 4 ]
[ 293, 21 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.extract_texts
(self, obs)
Extract the personalities and dialogue histories from observations. Additionally determine which dialogue round we are in. Note that this function assumes that the personality is the last line of the `text` field in the observation. :param obs: list of observation...
Extract the personalities and dialogue histories from observations.
def extract_texts(self, obs): """ Extract the personalities and dialogue histories from observations. Additionally determine which dialogue round we are in. Note that this function assumes that the personality is the last line of the `text` field in the observation. :p...
[ "def", "extract_texts", "(", "self", ",", "obs", ")", ":", "splits", "=", "[", "v", ".", "get", "(", "\"text\"", ")", ".", "split", "(", "\"\\n\"", ")", "for", "v", "in", "obs", "]", "if", "self", ".", "personality_override", ":", "splits", "=", "[...
[ 295, 4 ]
[ 321, 64 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.get_dialogue_history
(self, obs)
Get dialogue history for an observation. :param obs: observation :return: the observation with the dialogue history in the `text` field
Get dialogue history for an observation.
def get_dialogue_history(self, obs): """ Get dialogue history for an observation. :param obs: observation :return: the observation with the dialogue history in the `text` field """ if len(self.history) > 0: obs.force_set("text", "\n"....
[ "def", "get_dialogue_history", "(", "self", ",", "obs", ")", ":", "if", "len", "(", "self", ".", "history", ")", ">", "0", ":", "obs", ".", "force_set", "(", "\"text\"", ",", "\"\\n\"", ".", "join", "(", "self", ".", "history", ")", "+", "\"\\n\"", ...
[ 323, 4 ]
[ 343, 18 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.update_metrics
( self, loss, num_correct, num_samples, dialogue_round, med_rank=None )
Update Metrics. Overriden to include dialogue round :param loss: float loss :param num_correct: number of examples for which chosen caption is correct :param num_samples: total number of examples :param med_rank: rank of ...
Update Metrics.
def update_metrics( self, loss, num_correct, num_samples, dialogue_round, med_rank=None ): """ Update Metrics. Overriden to include dialogue round :param loss: float loss :param num_correct: number of examples for which chosen caption is corr...
[ "def", "update_metrics", "(", "self", ",", "loss", ",", "num_correct", ",", "num_samples", ",", "dialogue_round", ",", "med_rank", "=", "None", ")", ":", "self", ".", "metrics", "[", "dialogue_round", "]", "[", "\"hits@1/100\"", "]", "+=", "num_correct", "se...
[ 345, 4 ]
[ 366, 64 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.receive_metrics
(self, metrics_dict)
Receive the metrics from validation. Unfreeze text encoder weights after a certain number of rounds without improvement. Override to account for different dialogue rounds. :param metrics_dict: the metrics dictionary
Receive the metrics from validation.
def receive_metrics(self, metrics_dict): """ Receive the metrics from validation. Unfreeze text encoder weights after a certain number of rounds without improvement. Override to account for different dialogue rounds. :param metrics_dict: the metrics dictionary ...
[ "def", "receive_metrics", "(", "self", ",", "metrics_dict", ")", ":", "if", "\"tasks\"", "in", "metrics_dict", ":", "metrics_dict", "=", "metrics_dict", "[", "\"tasks\"", "]", "[", "\"internal:comment_battle:imageDialog\"", "]", "if", "self", ".", "freeze_patience",...
[ 368, 4 ]
[ 406, 33 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.reset
(self)
Override to reset dialogue history.
Override to reset dialogue history.
def reset(self): """ Override to reset dialogue history. """ super().reset() self.history.clear()
[ "def", "reset", "(", "self", ")", ":", "super", "(", ")", ".", "reset", "(", ")", "self", ".", "history", ".", "clear", "(", ")" ]
[ 408, 4 ]
[ 413, 28 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.reset_metrics
(self)
Reset per-dialogue round metrics.
Reset per-dialogue round metrics.
def reset_metrics(self): """ Reset per-dialogue round metrics. """ for v in self.metrics.values(): v["hits@1/100"] = 0.0 v["loss"] = 0.0 v["num_samples"] = 0.0 if "med_rank" in v: v["med_rank"] = []
[ "def", "reset_metrics", "(", "self", ")", ":", "for", "v", "in", "self", ".", "metrics", ".", "values", "(", ")", ":", "v", "[", "\"hits@1/100\"", "]", "=", "0.0", "v", "[", "\"loss\"", "]", "=", "0.0", "v", "[", "\"num_samples\"", "]", "=", "0.0",...
[ 415, 4 ]
[ 424, 34 ]
python
en
['en', 'error', 'th']
False
TransresnetMultimodalAgent.report
(self)
Report per-dialogue round metrics.
Report per-dialogue round metrics.
def report(self): """ Report per-dialogue round metrics. """ m = {} for k, v in self.metrics.items(): if "num_samples" not in v: print(self.metrics) print(k) __import__("ipdb").set_trace() # FIXME if v["num_...
[ "def", "report", "(", "self", ")", ":", "m", "=", "{", "}", "for", "k", ",", "v", "in", "self", ".", "metrics", ".", "items", "(", ")", ":", "if", "\"num_samples\"", "not", "in", "v", ":", "print", "(", "self", ".", "metrics", ")", "print", "("...
[ 426, 4 ]
[ 443, 16 ]
python
en
['en', 'error', 'th']
False
download
(datapath)
Download the model.
Download the model.
def download(datapath): """ Download the model. """ opt = {'datapath': datapath, 'model_type': 'transresnet'} fnames = ['transresnet.tgz'] download_models(opt, fnames, 'personality_captions')
[ "def", "download", "(", "datapath", ")", ":", "opt", "=", "{", "'datapath'", ":", "datapath", ",", "'model_type'", ":", "'transresnet'", "}", "fnames", "=", "[", "'transresnet.tgz'", "]", "download_models", "(", "opt", ",", "fnames", ",", "'personality_caption...
[ 12, 0 ]
[ 18, 56 ]
python
en
['en', 'error', 'th']
False
TestUpgradeOpt.test_inference
(self)
Test --inference with simple options.
Test --inference with simple options.
def test_inference(self): """ Test --inference with simple options. """ upgraded = TorchGeneratorAgent.upgrade_opt({'beam_size': 1}) self.assertEqual(upgraded['inference'], 'greedy') upgraded = TorchGeneratorAgent.upgrade_opt({'beam_size': 5}) self.assertEqual(up...
[ "def", "test_inference", "(", "self", ")", ":", "upgraded", "=", "TorchGeneratorAgent", ".", "upgrade_opt", "(", "{", "'beam_size'", ":", "1", "}", ")", "self", ".", "assertEqual", "(", "upgraded", "[", "'inference'", "]", ",", "'greedy'", ")", "upgraded", ...
[ 20, 4 ]
[ 28, 55 ]
python
en
['en', 'error', 'th']
False
TestUpgradeOpt.test_no_greedy_largebeam
(self)
Ensures that --beam-size > 1 and --inference greedy causes a failure.
Ensures that --beam-size > 1 and --inference greedy causes a failure.
def test_no_greedy_largebeam(self): """ Ensures that --beam-size > 1 and --inference greedy causes a failure. """ # we should have an exception if we mix beam size > 1 with inference greedy with self.assertRaises(ValueError): testing_utils.display_model( ...
[ "def", "test_no_greedy_largebeam", "(", "self", ")", ":", "# we should have an exception if we mix beam size > 1 with inference greedy", "with", "self", ".", "assertRaises", "(", "ValueError", ")", ":", "testing_utils", ".", "display_model", "(", "dict", "(", "task", "=",...
[ 30, 4 ]
[ 53, 9 ]
python
en
['en', 'error', 'th']
False
TestUpgradeOpt.test_file_inference
(self)
Test --inference with older model files.
Test --inference with older model files.
def test_file_inference(self): """ Test --inference with older model files. """ pp = ParlaiParser(True, True) opt = pp.parse_args( ['--model-file', 'zoo:unittest/transformer_generator2/model'] ) agent = create_agent(opt, True) self.assertEqual(...
[ "def", "test_file_inference", "(", "self", ")", ":", "pp", "=", "ParlaiParser", "(", "True", ",", "True", ")", "opt", "=", "pp", ".", "parse_args", "(", "[", "'--model-file'", ",", "'zoo:unittest/transformer_generator2/model'", "]", ")", "agent", "=", "create_...
[ 55, 4 ]
[ 76, 56 ]
python
en
['en', 'error', 'th']
False
TestUpgradeOpt.test_block_full_context
(self)
Test --beam-block-full-context with older model files.
Test --beam-block-full-context with older model files.
def test_block_full_context(self): """ Test --beam-block-full-context with older model files. """ # old model file == beam block full context false pp = ParlaiParser(True, True) opt = pp.parse_args( ['--model-file', 'zoo:unittest/transformer_generator2/model']...
[ "def", "test_block_full_context", "(", "self", ")", ":", "# old model file == beam block full context false", "pp", "=", "ParlaiParser", "(", "True", ",", "True", ")", "opt", "=", "pp", ".", "parse_args", "(", "[", "'--model-file'", ",", "'zoo:unittest/transformer_gen...
[ 78, 4 ]
[ 96, 61 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.__init__
( self, *, thid: str = None, pthid: str = None, sender_order: int = None, received_orders: Mapping = None, )
Initialize a ThreadDecorator instance. Args: thid: The ID of the message that serves as the thread start pthid: An optional parent thid. Used when branching or nesting a new interaction off of an existing one. sender_order:A number th...
Initialize a ThreadDecorator instance.
def __init__( self, *, thid: str = None, pthid: str = None, sender_order: int = None, received_orders: Mapping = None, ): """ Initialize a ThreadDecorator instance. Args: thid: The ID of the message that serves as the ...
[ "def", "__init__", "(", "self", ",", "*", ",", "thid", ":", "str", "=", "None", ",", "pthid", ":", "str", "=", "None", ",", "sender_order", ":", "int", "=", "None", ",", "received_orders", ":", "Mapping", "=", "None", ",", ")", ":", "super", "(", ...
[ 23, 4 ]
[ 53, 81 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.thid
(self)
Accessor for thread identifier. Returns: This thread's `thid`
Accessor for thread identifier.
def thid(self): """ Accessor for thread identifier. Returns: This thread's `thid` """ return self._thid
[ "def", "thid", "(", "self", ")", ":", "return", "self", ".", "_thid" ]
[ 56, 4 ]
[ 64, 25 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.pthid
(self)
Accessor for parent thread identifier. Returns: This thread's `pthid`
Accessor for parent thread identifier.
def pthid(self): """ Accessor for parent thread identifier. Returns: This thread's `pthid` """ return self._pthid
[ "def", "pthid", "(", "self", ")", ":", "return", "self", ".", "_pthid" ]
[ 67, 4 ]
[ 75, 26 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.pthid
(self, val: str)
Setter for parent thread identifier. Args: val: The new pthid
Setter for parent thread identifier.
def pthid(self, val: str): """ Setter for parent thread identifier. Args: val: The new pthid """ self._pthid = val
[ "def", "pthid", "(", "self", ",", "val", ":", "str", ")", ":", "self", ".", "_pthid", "=", "val" ]
[ 78, 4 ]
[ 85, 25 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.received_orders
(self)
Get received orders. Returns: The highest sender_order value that the sender has seen from other sender(s) on the thread.
Get received orders.
def received_orders(self) -> dict: """ Get received orders. Returns: The highest sender_order value that the sender has seen from other sender(s) on the thread. """ return self._received_orders
[ "def", "received_orders", "(", "self", ")", "->", "dict", ":", "return", "self", ".", "_received_orders" ]
[ 88, 4 ]
[ 97, 36 ]
python
en
['en', 'error', 'th']
False
ThreadDecorator.sender_order
(self)
Get sender order. Returns: A number that tells where this message fits in the sequence of all messages that the current sender has contributed to this thread
Get sender order.
def sender_order(self) -> int: """ Get sender order. Returns: A number that tells where this message fits in the sequence of all messages that the current sender has contributed to this thread """ return self._sender_order
[ "def", "sender_order", "(", "self", ")", "->", "int", ":", "return", "self", ".", "_sender_order" ]
[ 100, 4 ]
[ 109, 33 ]
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.treemap.hoverlabel.Font` color ...
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
Textfont.color
(self)
Sets the text font color of unselected points, applied only when a selection exists. 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%)...
Sets the text font color of unselected points, applied only when a selection exists. 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%)...
def color(self): """ Sets the text font color of unselected points, applied only when a selection exists. 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 s...
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 66, 28 ]
python
en
['en', 'error', 'th']
False
Textfont.__init__
(self, arg=None, color=None, **kwargs)
Construct a new Textfont object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scattergl.unse lected.Textfont` color Sets the text font color of un...
Construct a new Textfont object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scattergl.unse lected.Textfont` color Sets the text font color of un...
def __init__(self, arg=None, color=None, **kwargs): """ Construct a new Textfont object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.scattergl.unse lected.Tex...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Textfont", ",", "self", ")", ".", "__init__", "(", "\"textfont\"", ")", "if", "\"_parent\"", "in", "kwargs", ":", ...
[ 82, 4 ]
[ 140, 34 ]
python
en
['en', 'error', 'th']
False
Title.font
(self)
Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.cone.colorbar.title.Font` - A...
Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.cone.colorbar.title.Font` - A...
def font(self): """ Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. The 'font' property is an instance of Font that may be specified as: - An instance of :class:`plotly.graph_objs.cone.colorba...
[ "def", "font", "(", "self", ")", ":", "return", "self", "[", "\"font\"", "]" ]
[ 15, 4 ]
[ 53, 27 ]
python
en
['en', 'error', 'th']
False
Title.side
(self)
Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the following enumeration values...
Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the following enumeration values...
def side(self): """ Determines the location of color bar's title with respect to the color bar. Note that the title's location used to be set by the now deprecated `titleside` attribute. The 'side' property is an enumeration that may be specified as: - One of the f...
[ "def", "side", "(", "self", ")", ":", "return", "self", "[", "\"side\"", "]" ]
[ 62, 4 ]
[ 76, 27 ]
python
en
['en', 'error', 'th']
False
Title.text
(self)
Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A ...
Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: - A string - A ...
def text(self): """ Sets the title of the color bar. Note that before the existence of `title.text`, the title's contents used to be defined as the `title` attribute itself. This behavior has been deprecated. The 'text' property is a string and must be specified as: ...
[ "def", "text", "(", "self", ")", ":", "return", "self", "[", "\"text\"", "]" ]
[ 85, 4 ]
[ 99, 27 ]
python
en
['en', 'error', 'th']
False
Title.__init__
(self, arg=None, font=None, side=None, text=None, **kwargs)
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.cone.colorbar.Title` font Sets this color bar's title font. Note that t...
Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.cone.colorbar.Title` font Sets this color bar's title font. Note that t...
def __init__(self, arg=None, font=None, side=None, text=None, **kwargs): """ Construct a new Title object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.cone.co...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "font", "=", "None", ",", "side", "=", "None", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Title", ",", "self", ")", ".", "__init__", "(", "\"title\"", ...
[ 126, 4 ]
[ 203, 34 ]
python
en
['en', 'error', 'th']
False
RouteQueryRequestHandler.handle
(self, context: RequestContext, responder: BaseResponder)
Message handler implementation.
Message handler implementation.
async def handle(self, context: RequestContext, responder: BaseResponder): """Message handler implementation.""" self._logger.debug( "%s called with context %s", self.__class__.__name__, context ) assert isinstance(context.message, RouteQueryRequest) if not context.c...
[ "async", "def", "handle", "(", "self", ",", "context", ":", "RequestContext", ",", "responder", ":", "BaseResponder", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"%s called with context %s\"", ",", "self", ".", "__class__", ".", "__name__", ",", "...
[ 17, 4 ]
[ 34, 44 ]
python
da
['da', 'da', 'en']
True
PingResponseHandler.handle
(self, context: RequestContext, responder: BaseResponder)
Handle ping response message. Args: context: Request context responder: Responder used to reply
Handle ping response message.
async def handle(self, context: RequestContext, responder: BaseResponder): """ Handle ping response message. Args: context: Request context responder: Responder used to reply """ self._logger.debug("PingResponseHandler called with context: %s", context)...
[ "async", "def", "handle", "(", "self", ",", "context", ":", "RequestContext", ",", "responder", ":", "BaseResponder", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"PingResponseHandler called with context: %s\"", ",", "context", ")", "assert", "isinstance...
[ 10, 4 ]
[ 36, 13 ]
python
en
['en', 'error', 'th']
False
test_check_rule_for_add_action_changing
(looper, sdk_wallet_trustee, sdk_wallet_steward, sdk_pool_handle)
Adding new steward for old auth rules
Adding new steward for old auth rules
def test_check_rule_for_add_action_changing(looper, sdk_wallet_trustee, sdk_wallet_steward, sdk_pool_handle): wh, _ = sdk_wallet_trustee did1, verkey1 = create_verkey_did(looper, w...
[ "def", "test_check_rule_for_add_action_changing", "(", "looper", ",", "sdk_wallet_trustee", ",", "sdk_wallet_steward", ",", "sdk_pool_handle", ")", ":", "wh", ",", "_", "=", "sdk_wallet_trustee", "did1", ",", "verkey1", "=", "create_verkey_did", "(", "looper", ",", ...
[ 11, 0 ]
[ 47, 46 ]
python
en
['en', 'en', 'en']
True
timeformat
(when=None)
This helper function will format the current time in the same way as the twisted logger does, including time zone info. Only difference from official logger is that we only use two digits for the year and don't show timezone for CET times. Args: when (int, optional): This is a time in POSI...
This helper function will format the current time in the same way as the twisted logger does, including time zone info. Only difference from official logger is that we only use two digits for the year and don't show timezone for CET times.
def timeformat(when=None): """ This helper function will format the current time in the same way as the twisted logger does, including time zone info. Only difference from official logger is that we only use two digits for the year and don't show timezone for CET times. Args: when (int,...
[ "def", "timeformat", "(", "when", "=", "None", ")", ":", "when", "=", "when", "if", "when", "else", "time", ".", "time", "(", ")", "# time zone offset: UTC - the actual offset", "tz_offset", "=", "datetime", ".", "utcfromtimestamp", "(", "when", ")", "-", "d...
[ 35, 0 ]
[ 69, 48 ]
python
en
['en', 'error', 'th']
False
log_msg
(msg)
Wrapper around log.msg call to catch any exceptions that might occur in logging. If an exception is raised, we'll print to stdout instead. Args: msg: The message that was passed to log.msg
Wrapper around log.msg call to catch any exceptions that might occur in logging. If an exception is raised, we'll print to stdout instead.
def log_msg(msg): """ Wrapper around log.msg call to catch any exceptions that might occur in logging. If an exception is raised, we'll print to stdout instead. Args: msg: The message that was passed to log.msg """ try: log.msg(msg) except Exception: print("Exce...
[ "def", "log_msg", "(", "msg", ")", ":", "try", ":", "log", ".", "msg", "(", "msg", ")", "except", "Exception", ":", "print", "(", "\"Exception raised while writing message to log. Original message: %s\"", "%", "msg", ")" ]
[ 123, 0 ]
[ 136, 90 ]
python
en
['en', 'error', 'th']
False
log_trace
(errmsg=None)
Log a traceback to the log. This should be called from within an exception. Args: errmsg (str, optional): Adds an extra line with added info at the end of the traceback in the log.
Log a traceback to the log. This should be called from within an exception.
def log_trace(errmsg=None): """ Log a traceback to the log. This should be called from within an exception. Args: errmsg (str, optional): Adds an extra line with added info at the end of the traceback in the log. """ tracestring = format_exc() try: if tracestrin...
[ "def", "log_trace", "(", "errmsg", "=", "None", ")", ":", "tracestring", "=", "format_exc", "(", ")", "try", ":", "if", "tracestring", ":", "for", "line", "in", "tracestring", ".", "splitlines", "(", ")", ":", "log", ".", "msg", "(", "'[::] %s'", "%", ...
[ 139, 0 ]
[ 162, 35 ]
python
en
['en', 'error', 'th']
False
log_err
(errmsg)
Prints/logs an error message to the server log. Args: errmsg (str): The message to be logged.
Prints/logs an error message to the server log.
def log_err(errmsg): """ Prints/logs an error message to the server log. Args: errmsg (str): The message to be logged. """ try: errmsg = str(errmsg) except Exception as e: errmsg = str(e) for line in errmsg.splitlines(): log_msg('[EE] %s' % line)
[ "def", "log_err", "(", "errmsg", ")", ":", "try", ":", "errmsg", "=", "str", "(", "errmsg", ")", "except", "Exception", "as", "e", ":", "errmsg", "=", "str", "(", "e", ")", "for", "line", "in", "errmsg", ".", "splitlines", "(", ")", ":", "log_msg",...
[ 168, 0 ]
[ 181, 33 ]
python
en
['en', 'error', 'th']
False
log_server
(servermsg)
This is for the Portal to log captured Server stdout messages (it's usually only used during startup, before Server log is open)
This is for the Portal to log captured Server stdout messages (it's usually only used during startup, before Server log is open)
def log_server(servermsg): """ This is for the Portal to log captured Server stdout messages (it's usually only used during startup, before Server log is open) """ try: servermsg = str(servermsg) except Exception as e: servermsg = str(e) for line in servermsg.splitlines(): ...
[ "def", "log_server", "(", "servermsg", ")", ":", "try", ":", "servermsg", "=", "str", "(", "servermsg", ")", "except", "Exception", "as", "e", ":", "servermsg", "=", "str", "(", "e", ")", "for", "line", "in", "servermsg", ".", "splitlines", "(", ")", ...
[ 188, 0 ]
[ 199, 37 ]
python
en
['en', 'error', 'th']
False
log_warn
(warnmsg)
Prints/logs any warnings that aren't critical but should be noted. Args: warnmsg (str): The message to be logged.
Prints/logs any warnings that aren't critical but should be noted.
def log_warn(warnmsg): """ Prints/logs any warnings that aren't critical but should be noted. Args: warnmsg (str): The message to be logged. """ try: warnmsg = str(warnmsg) except Exception as e: warnmsg = str(e) for line in warnmsg.splitlines(): log_msg('[W...
[ "def", "log_warn", "(", "warnmsg", ")", ":", "try", ":", "warnmsg", "=", "str", "(", "warnmsg", ")", "except", "Exception", "as", "e", ":", "warnmsg", "=", "str", "(", "e", ")", "for", "line", "in", "warnmsg", ".", "splitlines", "(", ")", ":", "log...
[ 202, 0 ]
[ 215, 33 ]
python
en
['en', 'error', 'th']
False
log_info
(infomsg)
Prints any generic debugging/informative info that should appear in the log. infomsg: (string) The message to be logged.
Prints any generic debugging/informative info that should appear in the log.
def log_info(infomsg): """ Prints any generic debugging/informative info that should appear in the log. infomsg: (string) The message to be logged. """ try: infomsg = str(infomsg) except Exception as e: infomsg = str(e) for line in infomsg.splitlines(): log_msg('[..]...
[ "def", "log_info", "(", "infomsg", ")", ":", "try", ":", "infomsg", "=", "str", "(", "infomsg", ")", "except", "Exception", "as", "e", ":", "infomsg", "=", "str", "(", "e", ")", "for", "line", "in", "infomsg", ".", "splitlines", "(", ")", ":", "log...
[ 222, 0 ]
[ 233, 33 ]
python
en
['en', 'error', 'th']
False
log_dep
(depmsg)
Prints a deprecation message. Args: depmsg (str): The deprecation message to log.
Prints a deprecation message.
def log_dep(depmsg): """ Prints a deprecation message. Args: depmsg (str): The deprecation message to log. """ try: depmsg = str(depmsg) except Exception as e: depmsg = str(e) for line in depmsg.splitlines(): log_msg('[DP] %s' % line)
[ "def", "log_dep", "(", "depmsg", ")", ":", "try", ":", "depmsg", "=", "str", "(", "depmsg", ")", "except", "Exception", "as", "e", ":", "depmsg", "=", "str", "(", "e", ")", "for", "line", "in", "depmsg", ".", "splitlines", "(", ")", ":", "log_msg",...
[ 239, 0 ]
[ 251, 33 ]
python
en
['en', 'error', 'th']
False
log_sec
(secmsg)
Prints a security-related message. Args: secmsg (str): The security message to log.
Prints a security-related message.
def log_sec(secmsg): """ Prints a security-related message. Args: secmsg (str): The security message to log. """ try: secmsg = str(secmsg) except Exception as e: secmsg = str(e) for line in secmsg.splitlines(): log_msg('[SS] %s' % line)
[ "def", "log_sec", "(", "secmsg", ")", ":", "try", ":", "secmsg", "=", "str", "(", "secmsg", ")", "except", "Exception", "as", "e", ":", "secmsg", "=", "str", "(", "e", ")", "for", "line", "in", "secmsg", ".", "splitlines", "(", ")", ":", "log_msg",...
[ 256, 0 ]
[ 268, 33 ]
python
en
['en', 'error', 'th']
False
_open_log_file
(filename)
Helper to open the log file (always in the log dir) and cache its handle. Will create a new file in the log dir if one didn't exist. To avoid keeping the filehandle open indefinitely we reset it every _LOG_FILE_HANDLE_RESET accesses. This may help resolve issues for very long uptimes and heav...
Helper to open the log file (always in the log dir) and cache its handle. Will create a new file in the log dir if one didn't exist.
def _open_log_file(filename): """ Helper to open the log file (always in the log dir) and cache its handle. Will create a new file in the log dir if one didn't exist. To avoid keeping the filehandle open indefinitely we reset it every _LOG_FILE_HANDLE_RESET accesses. This may help resolve issu...
[ "def", "_open_log_file", "(", "filename", ")", ":", "# we delay import of settings to keep logger module as free", "# from django as possible.", "global", "_LOG_FILE_HANDLES", ",", "_LOG_FILE_HANDLE_COUNTS", ",", "_LOGDIR", ",", "_LOG_ROTATE_SIZE", "if", "not", "_LOGDIR", ":", ...
[ 334, 0 ]
[ 371, 15 ]
python
en
['en', 'error', 'th']
False
log_file
(msg, filename="game.log")
Arbitrary file logger using threads. Args: msg (str): String to append to logfile. filename (str, optional): Defaults to 'game.log'. All logs will appear in the logs directory and log entries will start on new lines following datetime info.
Arbitrary file logger using threads.
def log_file(msg, filename="game.log"): """ Arbitrary file logger using threads. Args: msg (str): String to append to logfile. filename (str, optional): Defaults to 'game.log'. All logs will appear in the logs directory and log entries will start on new lines followi...
[ "def", "log_file", "(", "msg", ",", "filename", "=", "\"game.log\"", ")", ":", "def", "callback", "(", "filehandle", ",", "msg", ")", ":", "\"\"\"Writing to file and flushing result\"\"\"", "msg", "=", "\"\\n%s [-] %s\"", "%", "(", "timeformat", "(", ")", ",", ...
[ 374, 0 ]
[ 401, 68 ]
python
en
['en', 'error', 'th']
False
tail_log_file
(filename, offset, nlines, callback=None)
Return the tail of the log file. Args: filename (str): The name of the log file, presumed to be in the Evennia log dir. offset (int): The line offset *from the end of the file* to start reading from. 0 means to start at the latest entry. nlines (int): How many l...
Return the tail of the log file.
def tail_log_file(filename, offset, nlines, callback=None): """ Return the tail of the log file. Args: filename (str): The name of the log file, presumed to be in the Evennia log dir. offset (int): The line offset *from the end of the file* to start reading from. 0 m...
[ "def", "tail_log_file", "(", "filename", ",", "offset", ",", "nlines", ",", "callback", "=", "None", ")", ":", "def", "seek_file", "(", "filehandle", ",", "offset", ",", "nlines", ",", "callback", ")", ":", "\"\"\"step backwards in chunks and stop only when we hav...
[ 404, 0 ]
[ 460, 19 ]
python
en
['en', 'error', 'th']
False
WeeklyLogFile.shouldRotate
(self)
Rotate when the date has changed since last write
Rotate when the date has changed since last write
def shouldRotate(self): """Rotate when the date has changed since last write""" # all dates here are tuples (year, month, day) now = self.toDate() then = self.lastDate return now[0] > then[0] or now[1] > then[1] or now[2] > (then[2] + self.day_rotation)
[ "def", "shouldRotate", "(", "self", ")", ":", "# all dates here are tuples (year, month, day)", "now", "=", "self", ".", "toDate", "(", ")", "then", "=", "self", ".", "lastDate", "return", "now", "[", "0", "]", ">", "then", "[", "0", "]", "or", "now", "[...
[ 79, 4 ]
[ 84, 93 ]
python
en
['en', 'en', 'en']
True
WeeklyLogFile.write
(self, data)
Write data to log file
Write data to log file
def write(self, data): "Write data to log file" logfile.BaseLogFile.write(self, data) self.lastDate = max(self.lastDate, self.toDate())
[ "def", "write", "(", "self", ",", "data", ")", ":", "logfile", ".", "BaseLogFile", ".", "write", "(", "self", ",", "data", ")", "self", ".", "lastDate", "=", "max", "(", "self", ".", "lastDate", ",", "self", ".", "toDate", "(", ")", ")" ]
[ 86, 4 ]
[ 89, 57 ]
python
en
['en', 'jv', 'en']
True
PortalLogObserver.emit
(self, eventDict)
Copied from Twisted parent, to change logging output
Copied from Twisted parent, to change logging output
def emit(self, eventDict): """ Copied from Twisted parent, to change logging output """ text = log.textFromEventDict(eventDict) if text is None: return # timeStr = self.formatTime(eventDict["time"]) timeStr = timeformat(eventDict["time"]) fmt...
[ "def", "emit", "(", "self", ",", "eventDict", ")", ":", "text", "=", "log", ".", "textFromEventDict", "(", "eventDict", ")", "if", "text", "is", "None", ":", "return", "# timeStr = self.formatTime(eventDict[\"time\"])", "timeStr", "=", "timeformat", "(", "eventD...
[ 99, 4 ]
[ 116, 47 ]
python
en
['en', 'error', 'th']
False
EvenniaLogFile.rotate
(self)
Rotates our log file and appends some number of lines from the previous log to the start of the new one.
Rotates our log file and appends some number of lines from the previous log to the start of the new one.
def rotate(self): """ Rotates our log file and appends some number of lines from the previous log to the start of the new one. """ append_tail = self.num_lines_to_append > 0 if not append_tail: logfile.LogFile.rotate(self) return lines = ta...
[ "def", "rotate", "(", "self", ")", ":", "append_tail", "=", "self", ".", "num_lines_to_append", ">", "0", "if", "not", "append_tail", ":", "logfile", ".", "LogFile", ".", "rotate", "(", "self", ")", "return", "lines", "=", "tail_log_file", "(", "self", "...
[ 291, 4 ]
[ 303, 28 ]
python
en
['en', 'error', 'th']
False
EvenniaLogFile.seek
(self, *args, **kwargs)
Convenience method for accessing our _file attribute's seek method, which is used in tail_log_function. Args: *args: Same args as file.seek **kwargs: Same kwargs as file.seek
Convenience method for accessing our _file attribute's seek method, which is used in tail_log_function. Args: *args: Same args as file.seek **kwargs: Same kwargs as file.seek
def seek(self, *args, **kwargs): """ Convenience method for accessing our _file attribute's seek method, which is used in tail_log_function. Args: *args: Same args as file.seek **kwargs: Same kwargs as file.seek """ return self._file.seek(*args, **...
[ "def", "seek", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_file", ".", "seek", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 305, 4 ]
[ 313, 47 ]
python
en
['en', 'error', 'th']
False
EvenniaLogFile.readlines
(self, *args, **kwargs)
Convenience method for accessing our _file attribute's readlines method, which is used in tail_log_function. Args: *args: same args as file.readlines **kwargs: same kwargs as file.readlines Returns: lines (list): lines from our _file attribute. ...
Convenience method for accessing our _file attribute's readlines method, which is used in tail_log_function. Args: *args: same args as file.readlines **kwargs: same kwargs as file.readlines
def readlines(self, *args, **kwargs): """ Convenience method for accessing our _file attribute's readlines method, which is used in tail_log_function. Args: *args: same args as file.readlines **kwargs: same kwargs as file.readlines Returns: li...
[ "def", "readlines", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_file", ".", "readlines", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
[ 315, 4 ]
[ 326, 52 ]
python
en
['en', 'error', 'th']
False
RetrieverReaderAgent.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. """ agent = parser.add_argument_group('RetrieverReader Arguments') agent.add_argument('--retriever-model-f...
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "agent", "=", "parser", ".", "add_argument_group", "(", "'RetrieverReader Arguments'", ...
[ 34, 4 ]
[ 52, 20 ]
python
en
['en', 'error', 'th']
False
RetrieverReaderAgent._split_doc
(self, doc)
Given a doc, split it into chunks (by paragraph).
Given a doc, split it into chunks (by paragraph).
def _split_doc(self, doc): """ Given a doc, split it into chunks (by paragraph). """ GROUP_LENGTH = 0 docs = [] curr = [] curr_len = 0 for split in regex.split(r'\n+', doc): split = split.strip() if len(split) == 0: ...
[ "def", "_split_doc", "(", "self", ",", "doc", ")", ":", "GROUP_LENGTH", "=", "0", "docs", "=", "[", "]", "curr", "=", "[", "]", "curr_len", "=", "0", "for", "split", "in", "regex", ".", "split", "(", "r'\\n+'", ",", "doc", ")", ":", "split", "=",...
[ 58, 4 ]
[ 81, 19 ]
python
en
['en', 'error', 'th']
False
Slices.x
(self)
The 'x' property is an instance of X that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.X` - A dict of string/value properties that will be passed to the X constructor Supported dict properties: ...
The 'x' property is an instance of X that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.X` - A dict of string/value properties that will be passed to the X constructor Supported dict properties: ...
def x(self): """ The 'x' property is an instance of X that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.X` - A dict of string/value properties that will be passed to the X constructor Supported dict properties: ...
[ "def", "x", "(", "self", ")", ":", "return", "self", "[", "\"x\"", "]" ]
[ 15, 4 ]
[ 48, 24 ]
python
en
['en', 'error', 'th']
False
Slices.y
(self)
The 'y' property is an instance of Y that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Y` - A dict of string/value properties that will be passed to the Y constructor Supported dict properties: ...
The 'y' property is an instance of Y that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Y` - A dict of string/value properties that will be passed to the Y constructor Supported dict properties: ...
def y(self): """ The 'y' property is an instance of Y that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Y` - A dict of string/value properties that will be passed to the Y constructor Supported dict properties: ...
[ "def", "y", "(", "self", ")", ":", "return", "self", "[", "\"y\"", "]" ]
[ 57, 4 ]
[ 90, 24 ]
python
en
['en', 'error', 'th']
False
Slices.z
(self)
The 'z' property is an instance of Z that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Z` - A dict of string/value properties that will be passed to the Z constructor Supported dict properties: ...
The 'z' property is an instance of Z that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Z` - A dict of string/value properties that will be passed to the Z constructor Supported dict properties: ...
def z(self): """ The 'z' property is an instance of Z that may be specified as: - An instance of :class:`plotly.graph_objs.volume.slices.Z` - A dict of string/value properties that will be passed to the Z constructor Supported dict properties: ...
[ "def", "z", "(", "self", ")", ":", "return", "self", "[", "\"z\"", "]" ]
[ 99, 4 ]
[ 132, 24 ]
python
en
['en', 'error', 'th']
False
Slices.__init__
(self, arg=None, x=None, y=None, z=None, **kwargs)
Construct a new Slices object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.volume.Slices` x :class:`plotly.graph_objects.volume.slices.X` instance ...
Construct a new Slices object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.volume.Slices` x :class:`plotly.graph_objects.volume.slices.X` instance ...
def __init__(self, arg=None, x=None, y=None, z=None, **kwargs): """ Construct a new Slices object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.volume.Slices` x ...
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "x", "=", "None", ",", "y", "=", "None", ",", "z", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Slices", ",", "self", ")", ".", "__init__", "(", "\"slices\"", ")", ...
[ 154, 4 ]
[ 225, 34 ]
python
en
['en', 'error', 'th']
False
fast_confusion
(true, pred, label_values=None)
Fast confusion matrix (100x faster than Scikit learn). But only works if labels are la :param true: :param false: :param num_classes: :return:
Fast confusion matrix (100x faster than Scikit learn). But only works if labels are la :param true: :param false: :param num_classes: :return:
def fast_confusion(true, pred, label_values=None): """ Fast confusion matrix (100x faster than Scikit learn). But only works if labels are la :param true: :param false: :param num_classes: :return: """ # Ensure data is in the right format # print("Before ", true.shape) true = np...
[ "def", "fast_confusion", "(", "true", ",", "pred", ",", "label_values", "=", "None", ")", ":", "# Ensure data is in the right format", "# print(\"Before \", true.shape)", "true", "=", "np", ".", "squeeze", "(", "true", ")", "# print(\"After \", true.shape)", "pred", "...
[ 34, 0 ]
[ 123, 59 ]
python
en
['en', 'error', 'th']
False
metrics
(confusions, ignore_unclassified=False)
Computes different metrics from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). True if the the first class should be ignored in the results ...
Computes different metrics from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). True if the the first class should be ignored in the results ...
def metrics(confusions, ignore_unclassified=False): """ Computes different metrics from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). Tr...
[ "def", "metrics", "(", "confusions", ",", "ignore_unclassified", "=", "False", ")", ":", "# If the first class (often \"unclassified\") should be ignored, erase it from the confusion.", "if", "(", "ignore_unclassified", ")", ":", "confusions", "[", "...", ",", "0", ",", "...
[ 125, 0 ]
[ 159, 33 ]
python
en
['en', 'error', 'th']
False
smooth_metrics
(confusions, smooth_n=0, ignore_unclassified=False)
Computes different metrics from confusion matrices. Smoothed over a number of epochs. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param smooth_n: (int). smooth extent :param ignore_unclass...
Computes different metrics from confusion matrices. Smoothed over a number of epochs. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param smooth_n: (int). smooth extent :param ignore_unclass...
def smooth_metrics(confusions, smooth_n=0, ignore_unclassified=False): """ Computes different metrics from confusion matrices. Smoothed over a number of epochs. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number ...
[ "def", "smooth_metrics", "(", "confusions", ",", "smooth_n", "=", "0", ",", "ignore_unclassified", "=", "False", ")", ":", "# If the first class (often \"unclassified\") should be ignored, erase it from the confusion.", "if", "ignore_unclassified", ":", "confusions", "[", ".....
[ 162, 0 ]
[ 205, 33 ]
python
en
['en', 'error', 'th']
False
IoU_from_confusions
(confusions)
Computes IoU from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). True if the the first class should be ignored in the results :return: (...
Computes IoU from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). True if the the first class should be ignored in the results :return: (...
def IoU_from_confusions(confusions): """ Computes IoU from confusion matrices. :param confusions: ([..., n_c, n_c] np.int32). Can be any dimension, the confusion matrices should be described by the last axes. n_c = number of classes :param ignore_unclassified: (bool). True if the the first class sho...
[ "def", "IoU_from_confusions", "(", "confusions", ")", ":", "# Compute TP, FP, FN. This assume that the second to last axis counts the truths (like the first axis of a", "# confusion matrix), and that the last axis counts the predictions (like the second axis of a confusion matrix)", "TP", "=", "...
[ 208, 0 ]
[ 234, 14 ]
python
en
['en', 'error', 'th']
False
_list_repr_elided
(v, threshold=200, edgeitems=3, indent=0, width=80)
Return a string representation for of a list where list is elided if it has more than n elements Parameters ---------- v : list Input list threshold : Maximum number of elements to display Returns ------- str
Return a string representation for of a list where list is elided if it has more than n elements
def _list_repr_elided(v, threshold=200, edgeitems=3, indent=0, width=80): """ Return a string representation for of a list where list is elided if it has more than n elements Parameters ---------- v : list Input list threshold : Maximum number of elements to display Ret...
[ "def", "_list_repr_elided", "(", "v", ",", "threshold", "=", "200", ",", "edgeitems", "=", "3", ",", "indent", "=", "0", ",", "width", "=", "80", ")", ":", "if", "isinstance", "(", "v", ",", "list", ")", ":", "open_char", ",", "close_char", "=", "\...
[ 9, 0 ]
[ 47, 20 ]
python
en
['en', 'error', 'th']
False
node_generator
(node, path=())
General, node-yielding generator. Yields (node, path) tuples when it finds values that are dict instances. A path is a sequence of hashable values that can be used as either keys to a mapping (dict) or indices to a sequence (list). A path is always wrt to some object. Given an object, a path ...
General, node-yielding generator.
def node_generator(node, path=()): """ General, node-yielding generator. Yields (node, path) tuples when it finds values that are dict instances. A path is a sequence of hashable values that can be used as either keys to a mapping (dict) or indices to a sequence (list). A path is always wrt to...
[ "def", "node_generator", "(", "node", ",", "path", "=", "(", ")", ")", ":", "if", "not", "isinstance", "(", "node", ",", "dict", ")", ":", "return", "# in case it's called with a non-dict node at top level", "yield", "node", ",", "path", "for", "key", ",", "...
[ 132, 0 ]
[ 162, 26 ]
python
en
['en', 'error', 'th']
False
get_by_path
(obj, path)
Iteratively get on obj for each key in path. :param (list|dict) obj: The top-level object. :param (tuple[str]|tuple[int]) path: Keys to access parts of obj. :return: (*) Example: >>> figure = {'data': [{'x': [5]}]} >>> path = ('data', 0, 'x') >>> get_by_path(figure, path...
Iteratively get on obj for each key in path.
def get_by_path(obj, path): """ Iteratively get on obj for each key in path. :param (list|dict) obj: The top-level object. :param (tuple[str]|tuple[int]) path: Keys to access parts of obj. :return: (*) Example: >>> figure = {'data': [{'x': [5]}]} >>> path = ('data', 0, 'x') ...
[ "def", "get_by_path", "(", "obj", ",", "path", ")", ":", "for", "key", "in", "path", ":", "obj", "=", "obj", "[", "key", "]", "return", "obj" ]
[ 165, 0 ]
[ 183, 14 ]
python
en
['en', 'error', 'th']
False
render
(vars, files)
Render Jinja2 template to replace version tag :param args: variables to be embedded, files: file to be rendered :return:
Render Jinja2 template to replace version tag :param args: variables to be embedded, files: file to be rendered :return:
def render(vars, files): ''' Render Jinja2 template to replace version tag :param args: variables to be embedded, files: file to be rendered :return: ''' for path in files: env = Environment(loader=FileSystemLoader('/usr/local/trino/', encoding='utf8')) tpl = env.get_template(path) rendered = tp...
[ "def", "render", "(", "vars", ",", "files", ")", ":", "for", "path", "in", "files", ":", "env", "=", "Environment", "(", "loader", "=", "FileSystemLoader", "(", "'/usr/local/trino/'", ",", "encoding", "=", "'utf8'", ")", ")", "tpl", "=", "env", ".", "g...
[ 6, 0 ]
[ 20, 44 ]
python
en
['en', 'error', 'th']
False
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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
Insidetextfont.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