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
Delta.reference
(self)
Sets the reference value to compute the delta. By default, it is set to the current value. The 'reference' property is a number and may be specified as: - An int or float Returns ------- int|float
Sets the reference value to compute the delta. By default, it is set to the current value. The 'reference' property is a number and may be specified as: - An int or float
def reference(self): """ Sets the reference value to compute the delta. By default, it is set to the current value. The 'reference' property is a number and may be specified as: - An int or float Returns ------- int|float """ return self["reference"]
[ "def", "reference", "(", "self", ")", ":", "return", "self", "[", "\"reference\"", "]" ]
[ 146, 4 ]
[ 158, 32 ]
python
en
['en', 'error', 'th']
False
Delta.relative
(self)
Show relative change The 'relative' property must be specified as a bool (either True, or False) Returns ------- bool
Show relative change The 'relative' property must be specified as a bool (either True, or False)
def relative(self): """ Show relative change The 'relative' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["relative"]
[ "def", "relative", "(", "self", ")", ":", "return", "self", "[", "\"relative\"", "]" ]
[ 167, 4 ]
[ 178, 31 ]
python
en
['en', 'error', 'th']
False
Delta.valueformat
(self)
Sets the value formatting rule using d3 formatting mini- language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format The 'valueformat' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
Sets the value formatting rule using d3 formatting mini- language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format The 'valueformat' property is a string and must be specified as: - A string - A number that will be converted to a string
def valueformat(self): """ Sets the value formatting rule using d3 formatting mini- language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format The 'valueformat' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str """ return self["valueformat"]
[ "def", "valueformat", "(", "self", ")", ":", "return", "self", "[", "\"valueformat\"", "]" ]
[ 187, 4 ]
[ 202, 34 ]
python
en
['en', 'error', 'th']
False
Delta.__init__
( self, arg=None, decreasing=None, font=None, increasing=None, position=None, reference=None, relative=None, valueformat=None, **kwargs )
Construct a new Delta object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.indicator.Delta` decreasing :class:`plotly.graph_objects.indicator.delta.Decreasing ` instance or dict with compatible properties font Set the font used to display the delta increasing :class:`plotly.graph_objects.indicator.delta.Increasing ` instance or dict with compatible properties position Sets the position of delta with respect to the number. reference Sets the reference value to compute the delta. By default, it is set to the current value. relative Show relative change valueformat Sets the value formatting rule using d3 formatting mini-language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format Returns ------- Delta
Construct a new Delta object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.indicator.Delta` decreasing :class:`plotly.graph_objects.indicator.delta.Decreasing ` instance or dict with compatible properties font Set the font used to display the delta increasing :class:`plotly.graph_objects.indicator.delta.Increasing ` instance or dict with compatible properties position Sets the position of delta with respect to the number. reference Sets the reference value to compute the delta. By default, it is set to the current value. relative Show relative change valueformat Sets the value formatting rule using d3 formatting mini-language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format
def __init__( self, arg=None, decreasing=None, font=None, increasing=None, position=None, reference=None, relative=None, valueformat=None, **kwargs ): """ Construct a new Delta object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.indicator.Delta` decreasing :class:`plotly.graph_objects.indicator.delta.Decreasing ` instance or dict with compatible properties font Set the font used to display the delta increasing :class:`plotly.graph_objects.indicator.delta.Increasing ` instance or dict with compatible properties position Sets the position of delta with respect to the number. reference Sets the reference value to compute the delta. By default, it is set to the current value. relative Show relative change valueformat Sets the value formatting rule using d3 formatting mini-language which is similar to those of Python. See https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format Returns ------- Delta """ super(Delta, self).__init__("delta") if "_parent" in kwargs: self._parent = kwargs["_parent"] return # Validate arg # ------------ if arg is None: arg = {} elif isinstance(arg, self.__class__): arg = arg.to_plotly_json() elif isinstance(arg, dict): arg = _copy.copy(arg) else: raise ValueError( """\ The first argument to the plotly.graph_objs.indicator.Delta constructor must be a dict or an instance of :class:`plotly.graph_objs.indicator.Delta`""" ) # Handle skip_invalid # ------------------- self._skip_invalid = kwargs.pop("skip_invalid", False) self._validate = kwargs.pop("_validate", True) # Populate data dict with properties # ---------------------------------- _v = arg.pop("decreasing", None) _v = decreasing if decreasing is not None else _v if _v is not None: self["decreasing"] = _v _v = arg.pop("font", None) _v = font if font is not None else _v if _v is not None: self["font"] = _v _v = arg.pop("increasing", None) _v = increasing if increasing is not None else _v if _v is not None: self["increasing"] = _v _v = arg.pop("position", None) _v = position if position is not None else _v if _v is not None: self["position"] = _v _v = arg.pop("reference", None) _v = reference if reference is not None else _v if _v is not None: self["reference"] = _v _v = arg.pop("relative", None) _v = relative if relative is not None else _v if _v is not None: self["relative"] = _v _v = arg.pop("valueformat", None) _v = valueformat if valueformat is not None else _v if _v is not None: self["valueformat"] = _v # Process unknown kwargs # ---------------------- self._process_kwargs(**dict(arg, **kwargs)) # Reset skip_invalid # ------------------ self._skip_invalid = False
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "decreasing", "=", "None", ",", "font", "=", "None", ",", "increasing", "=", "None", ",", "position", "=", "None", ",", "reference", "=", "None", ",", "relative", "=", "None", ",", "valueformat", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Delta", ",", "self", ")", ".", "__init__", "(", "\"delta\"", ")", "if", "\"_parent\"", "in", "kwargs", ":", "self", ".", "_parent", "=", "kwargs", "[", "\"_parent\"", "]", "return", "# Validate arg", "# ------------", "if", "arg", "is", "None", ":", "arg", "=", "{", "}", "elif", "isinstance", "(", "arg", ",", "self", ".", "__class__", ")", ":", "arg", "=", "arg", ".", "to_plotly_json", "(", ")", "elif", "isinstance", "(", "arg", ",", "dict", ")", ":", "arg", "=", "_copy", ".", "copy", "(", "arg", ")", "else", ":", "raise", "ValueError", "(", "\"\"\"\\\nThe first argument to the plotly.graph_objs.indicator.Delta \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.indicator.Delta`\"\"\"", ")", "# Handle skip_invalid", "# -------------------", "self", ".", "_skip_invalid", "=", "kwargs", ".", "pop", "(", "\"skip_invalid\"", ",", "False", ")", "self", ".", "_validate", "=", "kwargs", ".", "pop", "(", "\"_validate\"", ",", "True", ")", "# Populate data dict with properties", "# ----------------------------------", "_v", "=", "arg", ".", "pop", "(", "\"decreasing\"", ",", "None", ")", "_v", "=", "decreasing", "if", "decreasing", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"decreasing\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"font\"", ",", "None", ")", "_v", "=", "font", "if", "font", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"font\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"increasing\"", ",", "None", ")", "_v", "=", "increasing", "if", "increasing", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"increasing\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"position\"", ",", "None", ")", "_v", "=", "position", "if", "position", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"position\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"reference\"", ",", "None", ")", "_v", "=", "reference", "if", "reference", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"reference\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"relative\"", ",", "None", ")", "_v", "=", "relative", "if", "relative", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"relative\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"valueformat\"", ",", "None", ")", "_v", "=", "valueformat", "if", "valueformat", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"valueformat\"", "]", "=", "_v", "# Process unknown kwargs", "# ----------------------", "self", ".", "_process_kwargs", "(", "*", "*", "dict", "(", "arg", ",", "*", "*", "kwargs", ")", ")", "# Reset skip_invalid", "# ------------------", "self", ".", "_skip_invalid", "=", "False" ]
[ 235, 4 ]
[ 345, 34 ]
python
en
['en', 'error', 'th']
False
get_config_defaults
()
Convenience function to check current settings against defaults. Example: if plotly_domain != get_config_defaults()['plotly_domain']: # do something
Convenience function to check current settings against defaults.
def get_config_defaults(): """ Convenience function to check current settings against defaults. Example: if plotly_domain != get_config_defaults()['plotly_domain']: # do something """ return dict(FILE_CONTENT[CONFIG_FILE])
[ "def", "get_config_defaults", "(", ")", ":", "return", "dict", "(", "FILE_CONTENT", "[", "CONFIG_FILE", "]", ")" ]
[ 29, 0 ]
[ 39, 42 ]
python
en
['en', 'error', 'th']
False
ensure_local_plotly_files
()
Ensure that filesystem is setup/filled out in a valid way. If the config or credential files aren't filled out, then write them to the disk.
Ensure that filesystem is setup/filled out in a valid way. If the config or credential files aren't filled out, then write them to the disk.
def ensure_local_plotly_files(): """Ensure that filesystem is setup/filled out in a valid way. If the config or credential files aren't filled out, then write them to the disk. """ if ensure_writable_plotly_dir(): for fn in [CREDENTIALS_FILE, CONFIG_FILE]: utils.ensure_file_exists(fn) contents = utils.load_json_dict(fn) contents_orig = contents.copy() for key, val in list(FILE_CONTENT[fn].items()): # TODO: removed type checking below, may want to revisit if key not in contents: contents[key] = val contents_keys = list(contents.keys()) for key in contents_keys: if key not in FILE_CONTENT[fn]: del contents[key] # save only if contents has changed. # This is to avoid .credentials or .config file to be overwritten randomly, # which we constantly keep experiencing # (sync issues? the file might be locked for writing by other process in file._permissions) if contents_orig.keys() != contents.keys(): utils.save_json_dict(fn, contents) else: warnings.warn( "Looks like you don't have 'read-write' permission to " "your 'home' ('~') directory or to our '~/.plotly' " "directory. That means plotly's python api can't setup " "local configuration files. No problem though! You'll " "just have to sign-in using 'plotly.plotly.sign_in()'. " "For help with that: 'help(plotly.plotly.sign_in)'." "\nQuestions? Visit https://support.plotly.com" )
[ "def", "ensure_local_plotly_files", "(", ")", ":", "if", "ensure_writable_plotly_dir", "(", ")", ":", "for", "fn", "in", "[", "CREDENTIALS_FILE", ",", "CONFIG_FILE", "]", ":", "utils", ".", "ensure_file_exists", "(", "fn", ")", "contents", "=", "utils", ".", "load_json_dict", "(", "fn", ")", "contents_orig", "=", "contents", ".", "copy", "(", ")", "for", "key", ",", "val", "in", "list", "(", "FILE_CONTENT", "[", "fn", "]", ".", "items", "(", ")", ")", ":", "# TODO: removed type checking below, may want to revisit", "if", "key", "not", "in", "contents", ":", "contents", "[", "key", "]", "=", "val", "contents_keys", "=", "list", "(", "contents", ".", "keys", "(", ")", ")", "for", "key", "in", "contents_keys", ":", "if", "key", "not", "in", "FILE_CONTENT", "[", "fn", "]", ":", "del", "contents", "[", "key", "]", "# save only if contents has changed.", "# This is to avoid .credentials or .config file to be overwritten randomly,", "# which we constantly keep experiencing", "# (sync issues? the file might be locked for writing by other process in file._permissions)", "if", "contents_orig", ".", "keys", "(", ")", "!=", "contents", ".", "keys", "(", ")", ":", "utils", ".", "save_json_dict", "(", "fn", ",", "contents", ")", "else", ":", "warnings", ".", "warn", "(", "\"Looks like you don't have 'read-write' permission to \"", "\"your 'home' ('~') directory or to our '~/.plotly' \"", "\"directory. That means plotly's python api can't setup \"", "\"local configuration files. No problem though! You'll \"", "\"just have to sign-in using 'plotly.plotly.sign_in()'. \"", "\"For help with that: 'help(plotly.plotly.sign_in)'.\"", "\"\\nQuestions? Visit https://support.plotly.com\"", ")" ]
[ 42, 0 ]
[ 76, 9 ]
python
en
['en', 'en', 'en']
True
set_credentials_file
( username=None, api_key=None, stream_ids=None, proxy_username=None, proxy_password=None, )
Set the keyword-value pairs in `~/.plotly_credentials`. :param (str) username: The username you'd use to sign in to Plotly :param (str) api_key: The api key associated with above username :param (list) stream_ids: Stream tokens for above credentials :param (str) proxy_username: The un associated with with your Proxy :param (str) proxy_password: The pw associated with your Proxy un
Set the keyword-value pairs in `~/.plotly_credentials`.
def set_credentials_file( username=None, api_key=None, stream_ids=None, proxy_username=None, proxy_password=None, ): """Set the keyword-value pairs in `~/.plotly_credentials`. :param (str) username: The username you'd use to sign in to Plotly :param (str) api_key: The api key associated with above username :param (list) stream_ids: Stream tokens for above credentials :param (str) proxy_username: The un associated with with your Proxy :param (str) proxy_password: The pw associated with your Proxy un """ if not ensure_writable_plotly_dir(): raise _plotly_utils.exceptions.PlotlyError( "You don't have proper file permissions " "to run this function." ) ensure_local_plotly_files() # make sure what's there is OK credentials = get_credentials_file() if isinstance(username, six.string_types): credentials["username"] = username if isinstance(api_key, six.string_types): credentials["api_key"] = api_key if isinstance(proxy_username, six.string_types): credentials["proxy_username"] = proxy_username if isinstance(proxy_password, six.string_types): credentials["proxy_password"] = proxy_password if isinstance(stream_ids, (list, tuple)): credentials["stream_ids"] = stream_ids utils.save_json_dict(CREDENTIALS_FILE, credentials) ensure_local_plotly_files()
[ "def", "set_credentials_file", "(", "username", "=", "None", ",", "api_key", "=", "None", ",", "stream_ids", "=", "None", ",", "proxy_username", "=", "None", ",", "proxy_password", "=", "None", ",", ")", ":", "if", "not", "ensure_writable_plotly_dir", "(", ")", ":", "raise", "_plotly_utils", ".", "exceptions", ".", "PlotlyError", "(", "\"You don't have proper file permissions \"", "\"to run this function.\"", ")", "ensure_local_plotly_files", "(", ")", "# make sure what's there is OK", "credentials", "=", "get_credentials_file", "(", ")", "if", "isinstance", "(", "username", ",", "six", ".", "string_types", ")", ":", "credentials", "[", "\"username\"", "]", "=", "username", "if", "isinstance", "(", "api_key", ",", "six", ".", "string_types", ")", ":", "credentials", "[", "\"api_key\"", "]", "=", "api_key", "if", "isinstance", "(", "proxy_username", ",", "six", ".", "string_types", ")", ":", "credentials", "[", "\"proxy_username\"", "]", "=", "proxy_username", "if", "isinstance", "(", "proxy_password", ",", "six", ".", "string_types", ")", ":", "credentials", "[", "\"proxy_password\"", "]", "=", "proxy_password", "if", "isinstance", "(", "stream_ids", ",", "(", "list", ",", "tuple", ")", ")", ":", "credentials", "[", "\"stream_ids\"", "]", "=", "stream_ids", "utils", ".", "save_json_dict", "(", "CREDENTIALS_FILE", ",", "credentials", ")", "ensure_local_plotly_files", "(", ")" ]
[ 82, 0 ]
[ 115, 31 ]
python
en
['en', 'en', 'en']
True
get_credentials_file
(*args)
Return specified args from `~/.plotly_credentials`. as dict. Returns all if no arguments are specified. Example: get_credentials_file('username')
Return specified args from `~/.plotly_credentials`. as dict.
def get_credentials_file(*args): """Return specified args from `~/.plotly_credentials`. as dict. Returns all if no arguments are specified. Example: get_credentials_file('username') """ # Read credentials from file if possible credentials = utils.load_json_dict(CREDENTIALS_FILE, *args) if not credentials: # Credentials could not be read, use defaults credentials = copy.copy(FILE_CONTENT[CREDENTIALS_FILE]) return credentials
[ "def", "get_credentials_file", "(", "*", "args", ")", ":", "# Read credentials from file if possible", "credentials", "=", "utils", ".", "load_json_dict", "(", "CREDENTIALS_FILE", ",", "*", "args", ")", "if", "not", "credentials", ":", "# Credentials could not be read, use defaults", "credentials", "=", "copy", ".", "copy", "(", "FILE_CONTENT", "[", "CREDENTIALS_FILE", "]", ")", "return", "credentials" ]
[ 118, 0 ]
[ 133, 22 ]
python
en
['en', 'en', 'en']
True
set_config_file
( plotly_domain=None, plotly_streaming_domain=None, plotly_api_domain=None, plotly_ssl_verification=None, plotly_proxy_authorization=None, world_readable=None, sharing=None, auto_open=None, )
Set the keyword-value pairs in `~/.plotly/.config`. :param (str) plotly_domain: ex - https://plotly.com :param (str) plotly_streaming_domain: ex - stream.plotly.com :param (str) plotly_api_domain: ex - https://api.plotly.com :param (bool) plotly_ssl_verification: True = verify, False = don't verify :param (bool) plotly_proxy_authorization: True = use plotly proxy auth creds :param (bool) world_readable: True = public, False = private
Set the keyword-value pairs in `~/.plotly/.config`.
def set_config_file( plotly_domain=None, plotly_streaming_domain=None, plotly_api_domain=None, plotly_ssl_verification=None, plotly_proxy_authorization=None, world_readable=None, sharing=None, auto_open=None, ): """Set the keyword-value pairs in `~/.plotly/.config`. :param (str) plotly_domain: ex - https://plotly.com :param (str) plotly_streaming_domain: ex - stream.plotly.com :param (str) plotly_api_domain: ex - https://api.plotly.com :param (bool) plotly_ssl_verification: True = verify, False = don't verify :param (bool) plotly_proxy_authorization: True = use plotly proxy auth creds :param (bool) world_readable: True = public, False = private """ if not ensure_writable_plotly_dir(): raise _plotly_utils.exceptions.PlotlyError( "You don't have proper file permissions " "to run this function." ) ensure_local_plotly_files() # make sure what's there is OK utils.validate_world_readable_and_sharing_settings( {"sharing": sharing, "world_readable": world_readable} ) settings = get_config_file() if isinstance(plotly_domain, six.string_types): settings["plotly_domain"] = plotly_domain elif plotly_domain is not None: raise TypeError("plotly_domain should be a string") if isinstance(plotly_streaming_domain, six.string_types): settings["plotly_streaming_domain"] = plotly_streaming_domain elif plotly_streaming_domain is not None: raise TypeError("plotly_streaming_domain should be a string") if isinstance(plotly_api_domain, six.string_types): settings["plotly_api_domain"] = plotly_api_domain elif plotly_api_domain is not None: raise TypeError("plotly_api_domain should be a string") if isinstance(plotly_ssl_verification, (six.string_types, bool)): settings["plotly_ssl_verification"] = plotly_ssl_verification elif plotly_ssl_verification is not None: raise TypeError("plotly_ssl_verification should be a boolean") if isinstance(plotly_proxy_authorization, (six.string_types, bool)): settings["plotly_proxy_authorization"] = plotly_proxy_authorization elif plotly_proxy_authorization is not None: raise TypeError("plotly_proxy_authorization should be a boolean") if isinstance(auto_open, bool): settings["auto_open"] = auto_open elif auto_open is not None: raise TypeError("auto_open should be a boolean") # validate plotly_domain and plotly_api_domain utils.validate_plotly_domains( {"plotly_domain": plotly_domain, "plotly_api_domain": plotly_api_domain} ) if isinstance(world_readable, bool): settings["world_readable"] = world_readable settings.pop("sharing") elif world_readable is not None: raise TypeError("Input should be a boolean") if isinstance(sharing, six.string_types): settings["sharing"] = sharing elif sharing is not None: raise TypeError("sharing should be a string") utils.set_sharing_and_world_readable(settings) utils.save_json_dict(CONFIG_FILE, settings) ensure_local_plotly_files()
[ "def", "set_config_file", "(", "plotly_domain", "=", "None", ",", "plotly_streaming_domain", "=", "None", ",", "plotly_api_domain", "=", "None", ",", "plotly_ssl_verification", "=", "None", ",", "plotly_proxy_authorization", "=", "None", ",", "world_readable", "=", "None", ",", "sharing", "=", "None", ",", "auto_open", "=", "None", ",", ")", ":", "if", "not", "ensure_writable_plotly_dir", "(", ")", ":", "raise", "_plotly_utils", ".", "exceptions", ".", "PlotlyError", "(", "\"You don't have proper file permissions \"", "\"to run this function.\"", ")", "ensure_local_plotly_files", "(", ")", "# make sure what's there is OK", "utils", ".", "validate_world_readable_and_sharing_settings", "(", "{", "\"sharing\"", ":", "sharing", ",", "\"world_readable\"", ":", "world_readable", "}", ")", "settings", "=", "get_config_file", "(", ")", "if", "isinstance", "(", "plotly_domain", ",", "six", ".", "string_types", ")", ":", "settings", "[", "\"plotly_domain\"", "]", "=", "plotly_domain", "elif", "plotly_domain", "is", "not", "None", ":", "raise", "TypeError", "(", "\"plotly_domain should be a string\"", ")", "if", "isinstance", "(", "plotly_streaming_domain", ",", "six", ".", "string_types", ")", ":", "settings", "[", "\"plotly_streaming_domain\"", "]", "=", "plotly_streaming_domain", "elif", "plotly_streaming_domain", "is", "not", "None", ":", "raise", "TypeError", "(", "\"plotly_streaming_domain should be a string\"", ")", "if", "isinstance", "(", "plotly_api_domain", ",", "six", ".", "string_types", ")", ":", "settings", "[", "\"plotly_api_domain\"", "]", "=", "plotly_api_domain", "elif", "plotly_api_domain", "is", "not", "None", ":", "raise", "TypeError", "(", "\"plotly_api_domain should be a string\"", ")", "if", "isinstance", "(", "plotly_ssl_verification", ",", "(", "six", ".", "string_types", ",", "bool", ")", ")", ":", "settings", "[", "\"plotly_ssl_verification\"", "]", "=", "plotly_ssl_verification", "elif", "plotly_ssl_verification", "is", "not", "None", ":", "raise", "TypeError", "(", "\"plotly_ssl_verification should be a boolean\"", ")", "if", "isinstance", "(", "plotly_proxy_authorization", ",", "(", "six", ".", "string_types", ",", "bool", ")", ")", ":", "settings", "[", "\"plotly_proxy_authorization\"", "]", "=", "plotly_proxy_authorization", "elif", "plotly_proxy_authorization", "is", "not", "None", ":", "raise", "TypeError", "(", "\"plotly_proxy_authorization should be a boolean\"", ")", "if", "isinstance", "(", "auto_open", ",", "bool", ")", ":", "settings", "[", "\"auto_open\"", "]", "=", "auto_open", "elif", "auto_open", "is", "not", "None", ":", "raise", "TypeError", "(", "\"auto_open should be a boolean\"", ")", "# validate plotly_domain and plotly_api_domain", "utils", ".", "validate_plotly_domains", "(", "{", "\"plotly_domain\"", ":", "plotly_domain", ",", "\"plotly_api_domain\"", ":", "plotly_api_domain", "}", ")", "if", "isinstance", "(", "world_readable", ",", "bool", ")", ":", "settings", "[", "\"world_readable\"", "]", "=", "world_readable", "settings", ".", "pop", "(", "\"sharing\"", ")", "elif", "world_readable", "is", "not", "None", ":", "raise", "TypeError", "(", "\"Input should be a boolean\"", ")", "if", "isinstance", "(", "sharing", ",", "six", ".", "string_types", ")", ":", "settings", "[", "\"sharing\"", "]", "=", "sharing", "elif", "sharing", "is", "not", "None", ":", "raise", "TypeError", "(", "\"sharing should be a string\"", ")", "utils", ".", "set_sharing_and_world_readable", "(", "settings", ")", "utils", ".", "save_json_dict", "(", "CONFIG_FILE", ",", "settings", ")", "ensure_local_plotly_files", "(", ")" ]
[ 145, 0 ]
[ 217, 31 ]
python
en
['en', 'en', 'en']
True
get_config_file
(*args)
Return specified args from `~/.plotly/.config`. as tuple. Returns all if no arguments are specified. Example: get_config_file('plotly_domain')
Return specified args from `~/.plotly/.config`. as tuple.
def get_config_file(*args): """Return specified args from `~/.plotly/.config`. as tuple. Returns all if no arguments are specified. Example: get_config_file('plotly_domain') """ # Read config from file if possible config = utils.load_json_dict(CONFIG_FILE, *args) if not config: # Config could not be read, use defaults config = copy.copy(FILE_CONTENT[CONFIG_FILE]) return config
[ "def", "get_config_file", "(", "*", "args", ")", ":", "# Read config from file if possible", "config", "=", "utils", ".", "load_json_dict", "(", "CONFIG_FILE", ",", "*", "args", ")", "if", "not", "config", ":", "# Config could not be read, use defaults", "config", "=", "copy", ".", "copy", "(", "FILE_CONTENT", "[", "CONFIG_FILE", "]", ")", "return", "config" ]
[ 220, 0 ]
[ 235, 17 ]
python
en
['en', 'en', 'en']
True
get_embed
(file_owner_or_url, file_id=None, width="100%", height=525)
Returns HTML code to embed figure on a webpage as an <iframe> Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument. Note, if you're using a file_owner string as the first argument, you MUST specify a `file_id` keyword argument. Else, if you're using a url string as the first argument, you MUST NOT specify a `file_id` keyword argument, or file_id must be set to Python's None value. Positional arguments: file_owner_or_url (string) -- a valid plotly username OR a valid plotly url Keyword arguments: file_id (default=None) -- an int or string that can be converted to int if you're using a url, don't fill this in! width (default="100%") -- an int or string corresp. to width of the figure height (default="525") -- same as width but corresp. to the height of the figure
Returns HTML code to embed figure on a webpage as an <iframe>
def get_embed(file_owner_or_url, file_id=None, width="100%", height=525): """Returns HTML code to embed figure on a webpage as an <iframe> Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument. Note, if you're using a file_owner string as the first argument, you MUST specify a `file_id` keyword argument. Else, if you're using a url string as the first argument, you MUST NOT specify a `file_id` keyword argument, or file_id must be set to Python's None value. Positional arguments: file_owner_or_url (string) -- a valid plotly username OR a valid plotly url Keyword arguments: file_id (default=None) -- an int or string that can be converted to int if you're using a url, don't fill this in! width (default="100%") -- an int or string corresp. to width of the figure height (default="525") -- same as width but corresp. to the height of the figure """ embed_url = _get_embed_url(file_owner_or_url, file_id) return ( '<iframe id="igraph" scrolling="no" style="border:none;" ' 'seamless="seamless" ' 'src="{embed_url}" ' 'height="{iframe_height}" width="{iframe_width}">' "</iframe>" ).format(embed_url=embed_url, iframe_height=height, iframe_width=width)
[ "def", "get_embed", "(", "file_owner_or_url", ",", "file_id", "=", "None", ",", "width", "=", "\"100%\"", ",", "height", "=", "525", ")", ":", "embed_url", "=", "_get_embed_url", "(", "file_owner_or_url", ",", "file_id", ")", "return", "(", "'<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" '", "'seamless=\"seamless\" '", "'src=\"{embed_url}\" '", "'height=\"{iframe_height}\" width=\"{iframe_width}\">'", "\"</iframe>\"", ")", ".", "format", "(", "embed_url", "=", "embed_url", ",", "iframe_height", "=", "height", ",", "iframe_width", "=", "width", ")" ]
[ 304, 0 ]
[ 335, 75 ]
python
en
['en', 'en', 'pt']
True
embed
(file_owner_or_url, file_id=None, width="100%", height=525)
Embeds existing Plotly figure in IPython Notebook Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument. Note, if you're using a file_owner string as the first argument, you MUST specify a `file_id` keyword argument. Else, if you're using a url string as the first argument, you MUST NOT specify a `file_id` keyword argument, or file_id must be set to Python's None value. Positional arguments: file_owner_or_url (string) -- a valid plotly username OR a valid plotly url Keyword arguments: file_id (default=None) -- an int or string that can be converted to int if you're using a url, don't fill this in! width (default="100%") -- an int or string corresp. to width of the figure height (default="525") -- same as width but corresp. to the height of the figure
Embeds existing Plotly figure in IPython Notebook
def embed(file_owner_or_url, file_id=None, width="100%", height=525): """Embeds existing Plotly figure in IPython Notebook Plotly uniquely identifies figures with a 'file_owner'/'file_id' pair. Since each file is given a corresponding unique url, you may also simply pass a valid plotly url as the first argument. Note, if you're using a file_owner string as the first argument, you MUST specify a `file_id` keyword argument. Else, if you're using a url string as the first argument, you MUST NOT specify a `file_id` keyword argument, or file_id must be set to Python's None value. Positional arguments: file_owner_or_url (string) -- a valid plotly username OR a valid plotly url Keyword arguments: file_id (default=None) -- an int or string that can be converted to int if you're using a url, don't fill this in! width (default="100%") -- an int or string corresp. to width of the figure height (default="525") -- same as width but corresp. to the height of the figure """ try: s = get_embed(file_owner_or_url, file_id=file_id, width=width, height=height) # see if we are in the SageMath Cloud if sage_salvus: return sage_salvus.html(s, hide=False) except: pass if ipython_core_display: if file_id: plotly_domain = ( session.get_session_config().get("plotly_domain") or get_config_file()["plotly_domain"] ) url = "{plotly_domain}/~{un}/{fid}".format( plotly_domain=plotly_domain, un=file_owner_or_url, fid=file_id ) else: url = file_owner_or_url embed_url = _get_embed_url(url, file_id) return ipython_display.IFrame(embed_url, width, height) else: if ( get_config_defaults()["plotly_domain"] != session.get_session_config()["plotly_domain"] ): feedback_contact = "Visit support.plotly.com" else: # different domain likely means enterprise feedback_contact = "Contact your On-Premise account executive" warnings.warn( "Looks like you're not using IPython or Sage to embed this " "plot. If you just want the *embed code*,\ntry using " "`get_embed()` instead." "\nQuestions? {}".format(feedback_contact) )
[ "def", "embed", "(", "file_owner_or_url", ",", "file_id", "=", "None", ",", "width", "=", "\"100%\"", ",", "height", "=", "525", ")", ":", "try", ":", "s", "=", "get_embed", "(", "file_owner_or_url", ",", "file_id", "=", "file_id", ",", "width", "=", "width", ",", "height", "=", "height", ")", "# see if we are in the SageMath Cloud", "if", "sage_salvus", ":", "return", "sage_salvus", ".", "html", "(", "s", ",", "hide", "=", "False", ")", "except", ":", "pass", "if", "ipython_core_display", ":", "if", "file_id", ":", "plotly_domain", "=", "(", "session", ".", "get_session_config", "(", ")", ".", "get", "(", "\"plotly_domain\"", ")", "or", "get_config_file", "(", ")", "[", "\"plotly_domain\"", "]", ")", "url", "=", "\"{plotly_domain}/~{un}/{fid}\"", ".", "format", "(", "plotly_domain", "=", "plotly_domain", ",", "un", "=", "file_owner_or_url", ",", "fid", "=", "file_id", ")", "else", ":", "url", "=", "file_owner_or_url", "embed_url", "=", "_get_embed_url", "(", "url", ",", "file_id", ")", "return", "ipython_display", ".", "IFrame", "(", "embed_url", ",", "width", ",", "height", ")", "else", ":", "if", "(", "get_config_defaults", "(", ")", "[", "\"plotly_domain\"", "]", "!=", "session", ".", "get_session_config", "(", ")", "[", "\"plotly_domain\"", "]", ")", ":", "feedback_contact", "=", "\"Visit support.plotly.com\"", "else", ":", "# different domain likely means enterprise", "feedback_contact", "=", "\"Contact your On-Premise account executive\"", "warnings", ".", "warn", "(", "\"Looks like you're not using IPython or Sage to embed this \"", "\"plot. If you just want the *embed code*,\\ntry using \"", "\"`get_embed()` instead.\"", "\"\\nQuestions? {}\"", ".", "format", "(", "feedback_contact", ")", ")" ]
[ 338, 0 ]
[ 399, 9 ]
python
en
['en', 'en', 'en']
True
kitti_data_prep
(root_path, info_prefix, version, out_dir)
Prepare data related to Kitti dataset. Related data consists of '.pkl' files recording basic infos, 2D annotations and groundtruth database. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. out_dir (str): Output directory of the groundtruth database info.
Prepare data related to Kitti dataset.
def kitti_data_prep(root_path, info_prefix, version, out_dir): """Prepare data related to Kitti dataset. Related data consists of '.pkl' files recording basic infos, 2D annotations and groundtruth database. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. out_dir (str): Output directory of the groundtruth database info. """ kitti.create_kitti_info_file(root_path, info_prefix) kitti.create_reduced_point_cloud(root_path, info_prefix) create_groundtruth_database( 'KittiDataset', root_path, info_prefix, f'{out_dir}/{info_prefix}_infos_train.pkl', relative_path=False, mask_anno_path='instances_train.json', with_mask=(version == 'mask'))
[ "def", "kitti_data_prep", "(", "root_path", ",", "info_prefix", ",", "version", ",", "out_dir", ")", ":", "kitti", ".", "create_kitti_info_file", "(", "root_path", ",", "info_prefix", ")", "kitti", ".", "create_reduced_point_cloud", "(", "root_path", ",", "info_prefix", ")", "create_groundtruth_database", "(", "'KittiDataset'", ",", "root_path", ",", "info_prefix", ",", "f'{out_dir}/{info_prefix}_infos_train.pkl'", ",", "relative_path", "=", "False", ",", "mask_anno_path", "=", "'instances_train.json'", ",", "with_mask", "=", "(", "version", "==", "'mask'", ")", ")" ]
[ 10, 0 ]
[ 31, 38 ]
python
en
['it', 'sn', 'en']
False
nuscenes_data_prep
(root_path, info_prefix, version, dataset_name, out_dir, max_sweeps=10)
Prepare data related to nuScenes dataset. Related data consists of '.pkl' files recording basic infos, 2D annotations and groundtruth database. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. dataset_name (str): The dataset class name. out_dir (str): Output directory of the groundtruth database info. max_sweeps (int): Number of input consecutive frames. Default: 10
Prepare data related to nuScenes dataset.
def nuscenes_data_prep(root_path, info_prefix, version, dataset_name, out_dir, max_sweeps=10): """Prepare data related to nuScenes dataset. Related data consists of '.pkl' files recording basic infos, 2D annotations and groundtruth database. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. dataset_name (str): The dataset class name. out_dir (str): Output directory of the groundtruth database info. max_sweeps (int): Number of input consecutive frames. Default: 10 """ nuscenes_converter.create_nuscenes_infos( root_path, info_prefix, version=version, max_sweeps=max_sweeps) if version == 'v1.0-test': return info_train_path = osp.join(root_path, f'{info_prefix}_infos_train.pkl') info_val_path = osp.join(root_path, f'{info_prefix}_infos_val.pkl') nuscenes_converter.export_2d_annotation( root_path, info_train_path, version=version) nuscenes_converter.export_2d_annotation( root_path, info_val_path, version=version) create_groundtruth_database(dataset_name, root_path, info_prefix, f'{out_dir}/{info_prefix}_infos_train.pkl')
[ "def", "nuscenes_data_prep", "(", "root_path", ",", "info_prefix", ",", "version", ",", "dataset_name", ",", "out_dir", ",", "max_sweeps", "=", "10", ")", ":", "nuscenes_converter", ".", "create_nuscenes_infos", "(", "root_path", ",", "info_prefix", ",", "version", "=", "version", ",", "max_sweeps", "=", "max_sweeps", ")", "if", "version", "==", "'v1.0-test'", ":", "return", "info_train_path", "=", "osp", ".", "join", "(", "root_path", ",", "f'{info_prefix}_infos_train.pkl'", ")", "info_val_path", "=", "osp", ".", "join", "(", "root_path", ",", "f'{info_prefix}_infos_val.pkl'", ")", "nuscenes_converter", ".", "export_2d_annotation", "(", "root_path", ",", "info_train_path", ",", "version", "=", "version", ")", "nuscenes_converter", ".", "export_2d_annotation", "(", "root_path", ",", "info_val_path", ",", "version", "=", "version", ")", "create_groundtruth_database", "(", "dataset_name", ",", "root_path", ",", "info_prefix", ",", "f'{out_dir}/{info_prefix}_infos_train.pkl'", ")" ]
[ 34, 0 ]
[ 66, 75 ]
python
en
['en', 'la', 'en']
True
lyft_data_prep
(root_path, info_prefix, version, dataset_name, out_dir, max_sweeps=10)
Prepare data related to Lyft dataset. Related data consists of '.pkl' files recording basic infos, and 2D annotations. Although the ground truth database is not used in Lyft, it can also be generated like nuScenes. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. dataset_name (str): The dataset class name. out_dir (str): Output directory of the groundtruth database info. Not used here if the groundtruth database is not generated. max_sweeps (int): Number of input consecutive frames. Default: 10
Prepare data related to Lyft dataset.
def lyft_data_prep(root_path, info_prefix, version, dataset_name, out_dir, max_sweeps=10): """Prepare data related to Lyft dataset. Related data consists of '.pkl' files recording basic infos, and 2D annotations. Although the ground truth database is not used in Lyft, it can also be generated like nuScenes. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. version (str): Dataset version. dataset_name (str): The dataset class name. out_dir (str): Output directory of the groundtruth database info. Not used here if the groundtruth database is not generated. max_sweeps (int): Number of input consecutive frames. Default: 10 """ lyft_converter.create_lyft_infos( root_path, info_prefix, version=version, max_sweeps=max_sweeps) if version == 'v1.01-test': return train_info_name = f'{info_prefix}_infos_train' val_info_name = f'{info_prefix}_infos_val' info_train_path = osp.join(root_path, f'{train_info_name}.pkl') info_val_path = osp.join(root_path, f'{val_info_name}.pkl') lyft_converter.export_2d_annotation( root_path, info_train_path, version=version) lyft_converter.export_2d_annotation( root_path, info_val_path, version=version)
[ "def", "lyft_data_prep", "(", "root_path", ",", "info_prefix", ",", "version", ",", "dataset_name", ",", "out_dir", ",", "max_sweeps", "=", "10", ")", ":", "lyft_converter", ".", "create_lyft_infos", "(", "root_path", ",", "info_prefix", ",", "version", "=", "version", ",", "max_sweeps", "=", "max_sweeps", ")", "if", "version", "==", "'v1.01-test'", ":", "return", "train_info_name", "=", "f'{info_prefix}_infos_train'", "val_info_name", "=", "f'{info_prefix}_infos_val'", "info_train_path", "=", "osp", ".", "join", "(", "root_path", ",", "f'{train_info_name}.pkl'", ")", "info_val_path", "=", "osp", ".", "join", "(", "root_path", ",", "f'{val_info_name}.pkl'", ")", "lyft_converter", ".", "export_2d_annotation", "(", "root_path", ",", "info_train_path", ",", "version", "=", "version", ")", "lyft_converter", ".", "export_2d_annotation", "(", "root_path", ",", "info_val_path", ",", "version", "=", "version", ")" ]
[ 69, 0 ]
[ 106, 50 ]
python
en
['en', 'sn', 'en']
True
scannet_data_prep
(root_path, info_prefix, out_dir, workers)
Prepare the info file for scannet dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used.
Prepare the info file for scannet dataset.
def scannet_data_prep(root_path, info_prefix, out_dir, workers): """Prepare the info file for scannet dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used. """ indoor.create_indoor_info_file( root_path, info_prefix, out_dir, workers=workers)
[ "def", "scannet_data_prep", "(", "root_path", ",", "info_prefix", ",", "out_dir", ",", "workers", ")", ":", "indoor", ".", "create_indoor_info_file", "(", "root_path", ",", "info_prefix", ",", "out_dir", ",", "workers", "=", "workers", ")" ]
[ 109, 0 ]
[ 119, 57 ]
python
en
['en', 'no', 'en']
True
sunrgbd_data_prep
(root_path, info_prefix, out_dir, workers)
Prepare the info file for sunrgbd dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used.
Prepare the info file for sunrgbd dataset.
def sunrgbd_data_prep(root_path, info_prefix, out_dir, workers): """Prepare the info file for sunrgbd dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used. """ indoor.create_indoor_info_file( root_path, info_prefix, out_dir, workers=workers)
[ "def", "sunrgbd_data_prep", "(", "root_path", ",", "info_prefix", ",", "out_dir", ",", "workers", ")", ":", "indoor", ".", "create_indoor_info_file", "(", "root_path", ",", "info_prefix", ",", "out_dir", ",", "workers", "=", "workers", ")" ]
[ 122, 0 ]
[ 132, 57 ]
python
en
['en', 'no', 'en']
True
waymo_data_prep
(root_path, info_prefix, version, out_dir, workers, max_sweeps=5)
Prepare the info file for waymo dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used. max_sweeps (int): Number of input consecutive frames. Default: 5 \ Here we store pose information of these frames for later use.
Prepare the info file for waymo dataset.
def waymo_data_prep(root_path, info_prefix, version, out_dir, workers, max_sweeps=5): """Prepare the info file for waymo dataset. Args: root_path (str): Path of dataset root. info_prefix (str): The prefix of info filenames. out_dir (str): Output directory of the generated info file. workers (int): Number of threads to be used. max_sweeps (int): Number of input consecutive frames. Default: 5 \ Here we store pose information of these frames for later use. """ from tools.data_converter import waymo_converter as waymo splits = ['training', 'validation', 'testing'] for i, split in enumerate(splits): load_dir = osp.join(root_path, 'waymo_format', split) if split == 'validation': save_dir = osp.join(out_dir, 'kitti_format', 'training') else: save_dir = osp.join(out_dir, 'kitti_format', split) converter = waymo.Waymo2KITTI( load_dir, save_dir, prefix=str(i), workers=workers, test_mode=(split == 'test')) converter.convert() # Generate waymo infos out_dir = osp.join(out_dir, 'kitti_format') kitti.create_waymo_info_file(out_dir, info_prefix, max_sweeps=max_sweeps) create_groundtruth_database( 'WaymoDataset', out_dir, info_prefix, f'{out_dir}/{info_prefix}_infos_train.pkl', relative_path=False, with_mask=False)
[ "def", "waymo_data_prep", "(", "root_path", ",", "info_prefix", ",", "version", ",", "out_dir", ",", "workers", ",", "max_sweeps", "=", "5", ")", ":", "from", "tools", ".", "data_converter", "import", "waymo_converter", "as", "waymo", "splits", "=", "[", "'training'", ",", "'validation'", ",", "'testing'", "]", "for", "i", ",", "split", "in", "enumerate", "(", "splits", ")", ":", "load_dir", "=", "osp", ".", "join", "(", "root_path", ",", "'waymo_format'", ",", "split", ")", "if", "split", "==", "'validation'", ":", "save_dir", "=", "osp", ".", "join", "(", "out_dir", ",", "'kitti_format'", ",", "'training'", ")", "else", ":", "save_dir", "=", "osp", ".", "join", "(", "out_dir", ",", "'kitti_format'", ",", "split", ")", "converter", "=", "waymo", ".", "Waymo2KITTI", "(", "load_dir", ",", "save_dir", ",", "prefix", "=", "str", "(", "i", ")", ",", "workers", "=", "workers", ",", "test_mode", "=", "(", "split", "==", "'test'", ")", ")", "converter", ".", "convert", "(", ")", "# Generate waymo infos", "out_dir", "=", "osp", ".", "join", "(", "out_dir", ",", "'kitti_format'", ")", "kitti", ".", "create_waymo_info_file", "(", "out_dir", ",", "info_prefix", ",", "max_sweeps", "=", "max_sweeps", ")", "create_groundtruth_database", "(", "'WaymoDataset'", ",", "out_dir", ",", "info_prefix", ",", "f'{out_dir}/{info_prefix}_infos_train.pkl'", ",", "relative_path", "=", "False", ",", "with_mask", "=", "False", ")" ]
[ 135, 0 ]
[ 176, 24 ]
python
en
['en', 'en', 'en']
True
AdminResponder.__init__
( self, context: InjectionContext, send: Coroutine, webhook: Coroutine, **kwargs )
Initialize an instance of `AdminResponder`. Args: send: Function to send outbound message
Initialize an instance of `AdminResponder`.
def __init__( self, context: InjectionContext, send: Coroutine, webhook: Coroutine, **kwargs ): """ Initialize an instance of `AdminResponder`. Args: send: Function to send outbound message """ super().__init__(**kwargs) self._context = context self._send = send self._webhook = webhook
[ "def", "__init__", "(", "self", ",", "context", ":", "InjectionContext", ",", "send", ":", "Coroutine", ",", "webhook", ":", "Coroutine", ",", "*", "*", "kwargs", ")", ":", "super", "(", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "self", ".", "_context", "=", "context", "self", ".", "_send", "=", "send", "self", ".", "_webhook", "=", "webhook" ]
[ 44, 4 ]
[ 57, 31 ]
python
en
['en', 'error', 'th']
False
AdminResponder.send_outbound
(self, message: OutboundMessage)
Send outbound message. Args: message: The `OutboundMessage` to be sent
Send outbound message.
async def send_outbound(self, message: OutboundMessage): """ Send outbound message. Args: message: The `OutboundMessage` to be sent """ await self._send(self._context, message)
[ "async", "def", "send_outbound", "(", "self", ",", "message", ":", "OutboundMessage", ")", ":", "await", "self", ".", "_send", "(", "self", ".", "_context", ",", "message", ")" ]
[ 59, 4 ]
[ 66, 48 ]
python
en
['en', 'error', 'th']
False
AdminResponder.send_webhook
(self, topic: str, payload: dict)
Dispatch a webhook. Args: topic: the webhook topic identifier payload: the webhook payload value
Dispatch a webhook.
async def send_webhook(self, topic: str, payload: dict): """ Dispatch a webhook. Args: topic: the webhook topic identifier payload: the webhook payload value """ await self._webhook(topic, payload)
[ "async", "def", "send_webhook", "(", "self", ",", "topic", ":", "str", ",", "payload", ":", "dict", ")", ":", "await", "self", ".", "_webhook", "(", "topic", ",", "payload", ")" ]
[ 68, 4 ]
[ 76, 43 ]
python
en
['en', 'error', 'th']
False
WebhookTarget.__init__
( self, endpoint: str, topic_filter: Sequence[str] = None, retries: int = None )
Initialize the webhook target.
Initialize the webhook target.
def __init__( self, endpoint: str, topic_filter: Sequence[str] = None, retries: int = None ): """Initialize the webhook target.""" self.endpoint = endpoint self._topic_filter = None self.retries = retries # call setter self.topic_filter = topic_filter
[ "def", "__init__", "(", "self", ",", "endpoint", ":", "str", ",", "topic_filter", ":", "Sequence", "[", "str", "]", "=", "None", ",", "retries", ":", "int", "=", "None", ")", ":", "self", ".", "endpoint", "=", "endpoint", "self", ".", "_topic_filter", "=", "None", "self", ".", "retries", "=", "retries", "# call setter", "self", ".", "topic_filter", "=", "topic_filter" ]
[ 82, 4 ]
[ 90, 40 ]
python
en
['en', 'en', 'en']
True
WebhookTarget.topic_filter
(self)
Accessor for the target's topic filter.
Accessor for the target's topic filter.
def topic_filter(self) -> Set[str]: """Accessor for the target's topic filter.""" return self._topic_filter
[ "def", "topic_filter", "(", "self", ")", "->", "Set", "[", "str", "]", ":", "return", "self", ".", "_topic_filter" ]
[ 93, 4 ]
[ 95, 33 ]
python
en
['en', 'en', 'en']
True
WebhookTarget.topic_filter
(self, val: Sequence[str])
Setter for the target's topic filter.
Setter for the target's topic filter.
def topic_filter(self, val: Sequence[str]): """Setter for the target's topic filter.""" filter = set(val) if val else None if filter and "*" in filter: filter = None self._topic_filter = filter
[ "def", "topic_filter", "(", "self", ",", "val", ":", "Sequence", "[", "str", "]", ")", ":", "filter", "=", "set", "(", "val", ")", "if", "val", "else", "None", "if", "filter", "and", "\"*\"", "in", "filter", ":", "filter", "=", "None", "self", ".", "_topic_filter", "=", "filter" ]
[ 98, 4 ]
[ 103, 35 ]
python
en
['en', 'en', 'en']
True
AdminServer.__init__
( self, host: str, port: int, context: InjectionContext, outbound_message_router: Coroutine, webhook_router: Callable, task_queue: TaskQueue = None, conductor_stats: Coroutine = None, )
Initialize an AdminServer instance. Args: host: Host to listen on port: Port to listen on context: The application context instance outbound_message_router: Coroutine for delivering outbound messages webhook_router: Callable for delivering webhooks task_queue: An optional task queue for handlers
Initialize an AdminServer instance.
def __init__( self, host: str, port: int, context: InjectionContext, outbound_message_router: Coroutine, webhook_router: Callable, task_queue: TaskQueue = None, conductor_stats: Coroutine = None, ): """ Initialize an AdminServer instance. Args: host: Host to listen on port: Port to listen on context: The application context instance outbound_message_router: Coroutine for delivering outbound messages webhook_router: Callable for delivering webhooks task_queue: An optional task queue for handlers """ self.app = None self.host = host self.port = port self.conductor_stats = conductor_stats self.loaded_modules = [] self.task_queue = task_queue self.webhook_router = webhook_router self.webhook_targets = {} self.websocket_queues = {} self.site = None self.context = context.start_scope("admin") self.responder = AdminResponder( self.context, outbound_message_router, self.send_webhook ) self.context.injector.bind_instance(BaseResponder, self.responder)
[ "def", "__init__", "(", "self", ",", "host", ":", "str", ",", "port", ":", "int", ",", "context", ":", "InjectionContext", ",", "outbound_message_router", ":", "Coroutine", ",", "webhook_router", ":", "Callable", ",", "task_queue", ":", "TaskQueue", "=", "None", ",", "conductor_stats", ":", "Coroutine", "=", "None", ",", ")", ":", "self", ".", "app", "=", "None", "self", ".", "host", "=", "host", "self", ".", "port", "=", "port", "self", ".", "conductor_stats", "=", "conductor_stats", "self", ".", "loaded_modules", "=", "[", "]", "self", ".", "task_queue", "=", "task_queue", "self", ".", "webhook_router", "=", "webhook_router", "self", ".", "webhook_targets", "=", "{", "}", "self", ".", "websocket_queues", "=", "{", "}", "self", ".", "site", "=", "None", "self", ".", "context", "=", "context", ".", "start_scope", "(", "\"admin\"", ")", "self", ".", "responder", "=", "AdminResponder", "(", "self", ".", "context", ",", "outbound_message_router", ",", "self", ".", "send_webhook", ")", "self", ".", "context", ".", "injector", ".", "bind_instance", "(", "BaseResponder", ",", "self", ".", "responder", ")" ]
[ 109, 4 ]
[ 145, 74 ]
python
en
['en', 'error', 'th']
False
AdminServer.make_application
(self)
Get the aiohttp application instance.
Get the aiohttp application instance.
async def make_application(self) -> web.Application: """Get the aiohttp application instance.""" middlewares = [] admin_api_key = self.context.settings.get("admin.admin_api_key") admin_insecure_mode = self.context.settings.get("admin.admin_insecure_mode") # admin-token and admin-token are mutually exclusive and required. # This should be enforced during parameter parsing but to be sure, # we check here. assert admin_insecure_mode or admin_api_key assert not (admin_insecure_mode and admin_api_key) # If admin_api_key is None, then admin_insecure_mode must be set so # we can safely enable the admin server with no security if admin_api_key: @web.middleware async def check_token(request, handler): header_admin_api_key = request.headers.get("x-api-key") if not header_admin_api_key: raise web.HTTPUnauthorized() if admin_api_key == header_admin_api_key: return await handler(request) else: raise web.HTTPUnauthorized() middlewares.append(check_token) if self.task_queue: @web.middleware async def apply_limiter(request, handler): task = await self.task_queue.put(handler(request)) return await task middlewares.append(apply_limiter) stats: Collector = await self.context.inject(Collector, required=False) if stats: @web.middleware async def collect_stats(request, handler): handler = stats.wrap_coro( handler, [handler.__qualname__, "any-admin-request"] ) return await handler(request) middlewares.append(collect_stats) app = web.Application(middlewares=middlewares) app["request_context"] = self.context app["outbound_message_router"] = self.responder.send app.add_routes( [ web.get("/", self.redirect_handler), web.get("/plugins", self.plugins_handler), web.get("/status", self.status_handler), web.post("/status/reset", self.status_reset_handler), web.get("/ws", self.websocket_handler), ] ) plugin_registry: PluginRegistry = await self.context.inject( PluginRegistry, required=False ) if plugin_registry: await plugin_registry.register_admin_routes(app) cors = aiohttp_cors.setup( app, defaults={ "*": aiohttp_cors.ResourceOptions( allow_credentials=True, expose_headers="*", allow_headers="*", allow_methods="*", ) }, ) for route in app.router.routes(): cors.add(route) # get agent label agent_label = self.context.settings.get("default_label"), version_string = f"v{__version__}" setup_aiohttp_apispec( app=app, title=agent_label, version=version_string, swagger_path="/api/doc" ) app.on_startup.append(self.on_startup) return app
[ "async", "def", "make_application", "(", "self", ")", "->", "web", ".", "Application", ":", "middlewares", "=", "[", "]", "admin_api_key", "=", "self", ".", "context", ".", "settings", ".", "get", "(", "\"admin.admin_api_key\"", ")", "admin_insecure_mode", "=", "self", ".", "context", ".", "settings", ".", "get", "(", "\"admin.admin_insecure_mode\"", ")", "# admin-token and admin-token are mutually exclusive and required.", "# This should be enforced during parameter parsing but to be sure,", "# we check here.", "assert", "admin_insecure_mode", "or", "admin_api_key", "assert", "not", "(", "admin_insecure_mode", "and", "admin_api_key", ")", "# If admin_api_key is None, then admin_insecure_mode must be set so", "# we can safely enable the admin server with no security", "if", "admin_api_key", ":", "@", "web", ".", "middleware", "async", "def", "check_token", "(", "request", ",", "handler", ")", ":", "header_admin_api_key", "=", "request", ".", "headers", ".", "get", "(", "\"x-api-key\"", ")", "if", "not", "header_admin_api_key", ":", "raise", "web", ".", "HTTPUnauthorized", "(", ")", "if", "admin_api_key", "==", "header_admin_api_key", ":", "return", "await", "handler", "(", "request", ")", "else", ":", "raise", "web", ".", "HTTPUnauthorized", "(", ")", "middlewares", ".", "append", "(", "check_token", ")", "if", "self", ".", "task_queue", ":", "@", "web", ".", "middleware", "async", "def", "apply_limiter", "(", "request", ",", "handler", ")", ":", "task", "=", "await", "self", ".", "task_queue", ".", "put", "(", "handler", "(", "request", ")", ")", "return", "await", "task", "middlewares", ".", "append", "(", "apply_limiter", ")", "stats", ":", "Collector", "=", "await", "self", ".", "context", ".", "inject", "(", "Collector", ",", "required", "=", "False", ")", "if", "stats", ":", "@", "web", ".", "middleware", "async", "def", "collect_stats", "(", "request", ",", "handler", ")", ":", "handler", "=", "stats", ".", "wrap_coro", "(", "handler", ",", "[", "handler", ".", "__qualname__", ",", "\"any-admin-request\"", "]", ")", "return", "await", "handler", "(", "request", ")", "middlewares", ".", "append", "(", "collect_stats", ")", "app", "=", "web", ".", "Application", "(", "middlewares", "=", "middlewares", ")", "app", "[", "\"request_context\"", "]", "=", "self", ".", "context", "app", "[", "\"outbound_message_router\"", "]", "=", "self", ".", "responder", ".", "send", "app", ".", "add_routes", "(", "[", "web", ".", "get", "(", "\"/\"", ",", "self", ".", "redirect_handler", ")", ",", "web", ".", "get", "(", "\"/plugins\"", ",", "self", ".", "plugins_handler", ")", ",", "web", ".", "get", "(", "\"/status\"", ",", "self", ".", "status_handler", ")", ",", "web", ".", "post", "(", "\"/status/reset\"", ",", "self", ".", "status_reset_handler", ")", ",", "web", ".", "get", "(", "\"/ws\"", ",", "self", ".", "websocket_handler", ")", ",", "]", ")", "plugin_registry", ":", "PluginRegistry", "=", "await", "self", ".", "context", ".", "inject", "(", "PluginRegistry", ",", "required", "=", "False", ")", "if", "plugin_registry", ":", "await", "plugin_registry", ".", "register_admin_routes", "(", "app", ")", "cors", "=", "aiohttp_cors", ".", "setup", "(", "app", ",", "defaults", "=", "{", "\"*\"", ":", "aiohttp_cors", ".", "ResourceOptions", "(", "allow_credentials", "=", "True", ",", "expose_headers", "=", "\"*\"", ",", "allow_headers", "=", "\"*\"", ",", "allow_methods", "=", "\"*\"", ",", ")", "}", ",", ")", "for", "route", "in", "app", ".", "router", ".", "routes", "(", ")", ":", "cors", ".", "add", "(", "route", ")", "# get agent label", "agent_label", "=", "self", ".", "context", ".", "settings", ".", "get", "(", "\"default_label\"", ")", ",", "version_string", "=", "f\"v{__version__}\"", "setup_aiohttp_apispec", "(", "app", "=", "app", ",", "title", "=", "agent_label", ",", "version", "=", "version_string", ",", "swagger_path", "=", "\"/api/doc\"", ")", "app", ".", "on_startup", ".", "append", "(", "self", ".", "on_startup", ")", "return", "app" ]
[ 147, 4 ]
[ 240, 18 ]
python
en
['en', 'en', 'en']
True
AdminServer.start
(self)
Start the webserver. Raises: AdminSetupError: If there was an error starting the webserver
Start the webserver.
async def start(self) -> None: """ Start the webserver. Raises: AdminSetupError: If there was an error starting the webserver """ self.app = await self.make_application() runner = web.AppRunner(self.app) await runner.setup() self.site = web.TCPSite(runner, host=self.host, port=self.port) try: await self.site.start() except OSError: raise AdminSetupError( "Unable to start webserver with host " + f"'{self.host}' and port '{self.port}'\n" )
[ "async", "def", "start", "(", "self", ")", "->", "None", ":", "self", ".", "app", "=", "await", "self", ".", "make_application", "(", ")", "runner", "=", "web", ".", "AppRunner", "(", "self", ".", "app", ")", "await", "runner", ".", "setup", "(", ")", "self", ".", "site", "=", "web", ".", "TCPSite", "(", "runner", ",", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ")", "try", ":", "await", "self", ".", "site", ".", "start", "(", ")", "except", "OSError", ":", "raise", "AdminSetupError", "(", "\"Unable to start webserver with host \"", "+", "f\"'{self.host}' and port '{self.port}'\\n\"", ")" ]
[ 242, 4 ]
[ 261, 13 ]
python
en
['en', 'error', 'th']
False
AdminServer.stop
(self)
Stop the webserver.
Stop the webserver.
async def stop(self) -> None: """Stop the webserver.""" for queue in self.websocket_queues.values(): queue.stop() if self.site: await self.site.stop() self.site = None
[ "async", "def", "stop", "(", "self", ")", "->", "None", ":", "for", "queue", "in", "self", ".", "websocket_queues", ".", "values", "(", ")", ":", "queue", ".", "stop", "(", ")", "if", "self", ".", "site", ":", "await", "self", ".", "site", ".", "stop", "(", ")", "self", ".", "site", "=", "None" ]
[ 263, 4 ]
[ 269, 28 ]
python
en
['en', 'nl', 'en']
True
AdminServer.on_startup
(self, app: web.Application)
Perform webserver startup actions.
Perform webserver startup actions.
async def on_startup(self, app: web.Application): """Perform webserver startup actions."""
[ "async", "def", "on_startup", "(", "self", ",", "app", ":", "web", ".", "Application", ")", ":" ]
[ 271, 4 ]
[ 272, 48 ]
python
en
['en', 'en', 'en']
True
AdminServer.plugins_handler
(self, request: web.BaseRequest)
Request handler for the loaded plugins list. Args: request: aiohttp request object Returns: The module list response
Request handler for the loaded plugins list.
async def plugins_handler(self, request: web.BaseRequest): """ Request handler for the loaded plugins list. Args: request: aiohttp request object Returns: The module list response """ registry: PluginRegistry = await self.context.inject( PluginRegistry, required=False ) print(registry) plugins = registry and sorted(registry.plugin_names) or [] return web.json_response({"result": plugins})
[ "async", "def", "plugins_handler", "(", "self", ",", "request", ":", "web", ".", "BaseRequest", ")", ":", "registry", ":", "PluginRegistry", "=", "await", "self", ".", "context", ".", "inject", "(", "PluginRegistry", ",", "required", "=", "False", ")", "print", "(", "registry", ")", "plugins", "=", "registry", "and", "sorted", "(", "registry", ".", "plugin_names", ")", "or", "[", "]", "return", "web", ".", "json_response", "(", "{", "\"result\"", ":", "plugins", "}", ")" ]
[ 276, 4 ]
[ 292, 53 ]
python
en
['en', 'error', 'th']
False
AdminServer.status_handler
(self, request: web.BaseRequest)
Request handler for the server status information. Args: request: aiohttp request object Returns: The web response
Request handler for the server status information.
async def status_handler(self, request: web.BaseRequest): """ Request handler for the server status information. Args: request: aiohttp request object Returns: The web response """ status = {"version": __version__} collector: Collector = await self.context.inject(Collector, required=False) if collector: status["timing"] = collector.results if self.conductor_stats: status["conductor"] = await self.conductor_stats() return web.json_response(status)
[ "async", "def", "status_handler", "(", "self", ",", "request", ":", "web", ".", "BaseRequest", ")", ":", "status", "=", "{", "\"version\"", ":", "__version__", "}", "collector", ":", "Collector", "=", "await", "self", ".", "context", ".", "inject", "(", "Collector", ",", "required", "=", "False", ")", "if", "collector", ":", "status", "[", "\"timing\"", "]", "=", "collector", ".", "results", "if", "self", ".", "conductor_stats", ":", "status", "[", "\"conductor\"", "]", "=", "await", "self", ".", "conductor_stats", "(", ")", "return", "web", ".", "json_response", "(", "status", ")" ]
[ 296, 4 ]
[ 313, 40 ]
python
en
['en', 'error', 'th']
False
AdminServer.status_reset_handler
(self, request: web.BaseRequest)
Request handler for resetting the timing statistics. Args: request: aiohttp request object Returns: The web response
Request handler for resetting the timing statistics.
async def status_reset_handler(self, request: web.BaseRequest): """ Request handler for resetting the timing statistics. Args: request: aiohttp request object Returns: The web response """ collector: Collector = await self.context.inject(Collector, required=False) if collector: collector.reset() return web.json_response({})
[ "async", "def", "status_reset_handler", "(", "self", ",", "request", ":", "web", ".", "BaseRequest", ")", ":", "collector", ":", "Collector", "=", "await", "self", ".", "context", ".", "inject", "(", "Collector", ",", "required", "=", "False", ")", "if", "collector", ":", "collector", ".", "reset", "(", ")", "return", "web", ".", "json_response", "(", "{", "}", ")" ]
[ 317, 4 ]
[ 331, 36 ]
python
en
['en', 'error', 'th']
False
AdminServer.redirect_handler
(self, request: web.BaseRequest)
Perform redirect to documentation.
Perform redirect to documentation.
async def redirect_handler(self, request: web.BaseRequest): """Perform redirect to documentation.""" raise web.HTTPFound("/api/doc")
[ "async", "def", "redirect_handler", "(", "self", ",", "request", ":", "web", ".", "BaseRequest", ")", ":", "raise", "web", ".", "HTTPFound", "(", "\"/api/doc\"", ")" ]
[ 333, 4 ]
[ 335, 39 ]
python
en
['en', 'en', 'en']
True
AdminServer.websocket_handler
(self, request)
Send notifications to admin client over websocket.
Send notifications to admin client over websocket.
async def websocket_handler(self, request): """Send notifications to admin client over websocket.""" ws = web.WebSocketResponse() await ws.prepare(request) socket_id = str(uuid.uuid4()) queue = BasicMessageQueue() loop = asyncio.get_event_loop() try: self.websocket_queues[socket_id] = queue await queue.enqueue( { "topic": "settings", "payload": { "label": self.context.settings.get("default_label"), "endpoint": self.context.settings.get("default_endpoint"), "no_receive_invites": self.context.settings.get( "admin.no_receive_invites", False ), "help_link": self.context.settings.get("admin.help_link"), }, } ) closed = False receive = loop.create_task(ws.receive()) send = loop.create_task(queue.dequeue(timeout=5.0)) while not closed: try: await asyncio.wait( (receive, send), return_when=asyncio.FIRST_COMPLETED ) if ws.closed: closed = True if receive.done(): # ignored if not closed: receive = loop.create_task(ws.receive()) if send.done(): msg = send.result() if msg is None: # we send fake pings because the JS client # can't detect real ones msg = {"topic": "ping"} if not closed: if msg: await ws.send_json(msg) send = loop.create_task(queue.dequeue(timeout=5.0)) except asyncio.CancelledError: closed = True if not receive.done(): receive.cancel() if not send.done(): send.cancel() finally: del self.websocket_queues[socket_id] return ws
[ "async", "def", "websocket_handler", "(", "self", ",", "request", ")", ":", "ws", "=", "web", ".", "WebSocketResponse", "(", ")", "await", "ws", ".", "prepare", "(", "request", ")", "socket_id", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "queue", "=", "BasicMessageQueue", "(", ")", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "try", ":", "self", ".", "websocket_queues", "[", "socket_id", "]", "=", "queue", "await", "queue", ".", "enqueue", "(", "{", "\"topic\"", ":", "\"settings\"", ",", "\"payload\"", ":", "{", "\"label\"", ":", "self", ".", "context", ".", "settings", ".", "get", "(", "\"default_label\"", ")", ",", "\"endpoint\"", ":", "self", ".", "context", ".", "settings", ".", "get", "(", "\"default_endpoint\"", ")", ",", "\"no_receive_invites\"", ":", "self", ".", "context", ".", "settings", ".", "get", "(", "\"admin.no_receive_invites\"", ",", "False", ")", ",", "\"help_link\"", ":", "self", ".", "context", ".", "settings", ".", "get", "(", "\"admin.help_link\"", ")", ",", "}", ",", "}", ")", "closed", "=", "False", "receive", "=", "loop", ".", "create_task", "(", "ws", ".", "receive", "(", ")", ")", "send", "=", "loop", ".", "create_task", "(", "queue", ".", "dequeue", "(", "timeout", "=", "5.0", ")", ")", "while", "not", "closed", ":", "try", ":", "await", "asyncio", ".", "wait", "(", "(", "receive", ",", "send", ")", ",", "return_when", "=", "asyncio", ".", "FIRST_COMPLETED", ")", "if", "ws", ".", "closed", ":", "closed", "=", "True", "if", "receive", ".", "done", "(", ")", ":", "# ignored", "if", "not", "closed", ":", "receive", "=", "loop", ".", "create_task", "(", "ws", ".", "receive", "(", ")", ")", "if", "send", ".", "done", "(", ")", ":", "msg", "=", "send", ".", "result", "(", ")", "if", "msg", "is", "None", ":", "# we send fake pings because the JS client", "# can't detect real ones", "msg", "=", "{", "\"topic\"", ":", "\"ping\"", "}", "if", "not", "closed", ":", "if", "msg", ":", "await", "ws", ".", "send_json", "(", "msg", ")", "send", "=", "loop", ".", "create_task", "(", "queue", ".", "dequeue", "(", "timeout", "=", "5.0", ")", ")", "except", "asyncio", ".", "CancelledError", ":", "closed", "=", "True", "if", "not", "receive", ".", "done", "(", ")", ":", "receive", ".", "cancel", "(", ")", "if", "not", "send", ".", "done", "(", ")", ":", "send", ".", "cancel", "(", ")", "finally", ":", "del", "self", ".", "websocket_queues", "[", "socket_id", "]", "return", "ws" ]
[ 337, 4 ]
[ 400, 17 ]
python
en
['en', 'en', 'en']
True
AdminServer.add_webhook_target
( self, target_url: str, topic_filter: Sequence[str] = None, retries: int = None )
Add a webhook target.
Add a webhook target.
def add_webhook_target( self, target_url: str, topic_filter: Sequence[str] = None, retries: int = None ): """Add a webhook target.""" self.webhook_targets[target_url] = WebhookTarget( target_url, topic_filter, retries )
[ "def", "add_webhook_target", "(", "self", ",", "target_url", ":", "str", ",", "topic_filter", ":", "Sequence", "[", "str", "]", "=", "None", ",", "retries", ":", "int", "=", "None", ")", ":", "self", ".", "webhook_targets", "[", "target_url", "]", "=", "WebhookTarget", "(", "target_url", ",", "topic_filter", ",", "retries", ")" ]
[ 402, 4 ]
[ 408, 9 ]
python
en
['en', 'lb', 'en']
True
AdminServer.remove_webhook_target
(self, target_url: str)
Remove a webhook target.
Remove a webhook target.
def remove_webhook_target(self, target_url: str): """Remove a webhook target.""" if target_url in self.webhook_targets: del self.webhook_targets[target_url]
[ "def", "remove_webhook_target", "(", "self", ",", "target_url", ":", "str", ")", ":", "if", "target_url", "in", "self", ".", "webhook_targets", ":", "del", "self", ".", "webhook_targets", "[", "target_url", "]" ]
[ 410, 4 ]
[ 413, 48 ]
python
en
['en', 'lb', 'en']
True
AdminServer.send_webhook
(self, topic: str, payload: dict)
Add a webhook to the queue, to send to all registered targets.
Add a webhook to the queue, to send to all registered targets.
async def send_webhook(self, topic: str, payload: dict): """Add a webhook to the queue, to send to all registered targets.""" if self.webhook_router: for idx, target in self.webhook_targets.items(): if not target.topic_filter or topic in target.topic_filter: self.webhook_router(topic, payload, target.endpoint, target.retries) for queue in self.websocket_queues.values(): await queue.enqueue({"topic": topic, "payload": payload})
[ "async", "def", "send_webhook", "(", "self", ",", "topic", ":", "str", ",", "payload", ":", "dict", ")", ":", "if", "self", ".", "webhook_router", ":", "for", "idx", ",", "target", "in", "self", ".", "webhook_targets", ".", "items", "(", ")", ":", "if", "not", "target", ".", "topic_filter", "or", "topic", "in", "target", ".", "topic_filter", ":", "self", ".", "webhook_router", "(", "topic", ",", "payload", ",", "target", ".", "endpoint", ",", "target", ".", "retries", ")", "for", "queue", "in", "self", ".", "websocket_queues", ".", "values", "(", ")", ":", "await", "queue", ".", "enqueue", "(", "{", "\"topic\"", ":", "topic", ",", "\"payload\"", ":", "payload", "}", ")" ]
[ 415, 4 ]
[ 423, 69 ]
python
en
['en', 'en', 'en']
True
carbohydrates_saturation_photosynthesis_rate_inhibition
(carbohydrate_amount_Buf)
Equation 9.11 Returns: photosynthesis inhibition by carbohydrates saturation rate[-]
Equation 9.11 Returns: photosynthesis inhibition by carbohydrates saturation rate[-]
def carbohydrates_saturation_photosynthesis_rate_inhibition(carbohydrate_amount_Buf): """ Equation 9.11 Returns: photosynthesis inhibition by carbohydrates saturation rate[-] """ return smoothed_conditional_function(carbohydrate_amount_Buf, 5e-4, 20e3)
[ "def", "carbohydrates_saturation_photosynthesis_rate_inhibition", "(", "carbohydrate_amount_Buf", ")", ":", "return", "smoothed_conditional_function", "(", "carbohydrate_amount_Buf", ",", "5e-4", ",", "20e3", ")" ]
[ 6, 0 ]
[ 11, 77 ]
python
en
['en', 'error', 'th']
False
non_optimal_instantaneous_temperature_inhibition
(canopy_t)
Equation B.2 Returns: growth inhibition by non-optimal instantaneous temperature [-]
Equation B.2 Returns: growth inhibition by non-optimal instantaneous temperature [-]
def non_optimal_instantaneous_temperature_inhibition(canopy_t): """ Equation B.2 Returns: growth inhibition by non-optimal instantaneous temperature [-] """ return smoothed_conditional_function(canopy_t, -0.8690, 10) * smoothed_conditional_function(canopy_t, 0.5793, 34)
[ "def", "non_optimal_instantaneous_temperature_inhibition", "(", "canopy_t", ")", ":", "return", "smoothed_conditional_function", "(", "canopy_t", ",", "-", "0.8690", ",", "10", ")", "*", "smoothed_conditional_function", "(", "canopy_t", ",", "0.5793", ",", "34", ")" ]
[ 14, 0 ]
[ 19, 117 ]
python
en
['en', 'error', 'th']
False
non_optimal_24_hour_canopy_temperatures_inhibition
(last_24_canopy_t)
Equation B.3 Returns: growth inhibition by non-optimal 24-hour mean temperature [-]
Equation B.3 Returns: growth inhibition by non-optimal 24-hour mean temperature [-]
def non_optimal_24_hour_canopy_temperatures_inhibition(last_24_canopy_t): """ Equation B.3 Returns: growth inhibition by non-optimal 24-hour mean temperature [-] """ return smoothed_conditional_function(last_24_canopy_t, -1.1587, 15) \ * smoothed_conditional_function(last_24_canopy_t, 1.3904, 24.5)
[ "def", "non_optimal_24_hour_canopy_temperatures_inhibition", "(", "last_24_canopy_t", ")", ":", "return", "smoothed_conditional_function", "(", "last_24_canopy_t", ",", "-", "1.1587", ",", "15", ")", "*", "smoothed_conditional_function", "(", "last_24_canopy_t", ",", "1.3904", ",", "24.5", ")" ]
[ 22, 0 ]
[ 28, 74 ]
python
en
['en', 'error', 'th']
False
crop_development_stage_inhibition
(sum_canopy_t)
Equation 9.27, B.6 Returns: The gradual increase in fruit growth rate depending on tomato development stage [-]
Equation 9.27, B.6 Returns: The gradual increase in fruit growth rate depending on tomato development stage [-]
def crop_development_stage_inhibition(sum_canopy_t): """ Equation 9.27, B.6 Returns: The gradual increase in fruit growth rate depending on tomato development stage [-] """ return 0.5 * ((sum_canopy_t / SUM_END_T) + math.sqrt((sum_canopy_t / SUM_END_T) ** 2 + 1e-4)) \ - 0.5 * ((sum_canopy_t - SUM_END_T / SUM_END_T) + math.sqrt((sum_canopy_t - SUM_END_T / SUM_END_T) ** 2 + 1e-4))
[ "def", "crop_development_stage_inhibition", "(", "sum_canopy_t", ")", ":", "return", "0.5", "*", "(", "(", "sum_canopy_t", "/", "SUM_END_T", ")", "+", "math", ".", "sqrt", "(", "(", "sum_canopy_t", "/", "SUM_END_T", ")", "**", "2", "+", "1e-4", ")", ")", "-", "0.5", "*", "(", "(", "sum_canopy_t", "-", "SUM_END_T", "/", "SUM_END_T", ")", "+", "math", ".", "sqrt", "(", "(", "sum_canopy_t", "-", "SUM_END_T", "/", "SUM_END_T", ")", "**", "2", "+", "1e-4", ")", ")" ]
[ 31, 0 ]
[ 38, 84 ]
python
en
['en', 'error', 'th']
False
fruit_flow_inhibition
(sum_canopy_t)
Equation 9.33 To assure that fruits stay in the first development stage at vegetative stage Returns: fruit flow inhibition [-]
Equation 9.33 To assure that fruits stay in the first development stage at vegetative stage Returns: fruit flow inhibition [-]
def fruit_flow_inhibition(sum_canopy_t): """ Equation 9.33 To assure that fruits stay in the first development stage at vegetative stage Returns: fruit flow inhibition [-] """ return smoothed_conditional_function(sum_canopy_t, -5e-2, 0)
[ "def", "fruit_flow_inhibition", "(", "sum_canopy_t", ")", ":", "return", "smoothed_conditional_function", "(", "sum_canopy_t", ",", "-", "5e-2", ",", "0", ")" ]
[ 41, 0 ]
[ 47, 64 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent.build_model
(self)
Override to build appropriate model.
Override to build appropriate model.
def build_model(self) -> ImageSeq2seqModel: # type: ignore """ Override to build appropriate model. """ self.model = ImageSeq2seqModel(self.opt, self.dict) if self.opt['embedding_type'] != 'random': self._copy_embeddings( self.model.embeddings.weight, self.opt['embedding_type'] ) return self.model
[ "def", "build_model", "(", "self", ")", "->", "ImageSeq2seqModel", ":", "# type: ignore", "self", ".", "model", "=", "ImageSeq2seqModel", "(", "self", ".", "opt", ",", "self", ".", "dict", ")", "if", "self", ".", "opt", "[", "'embedding_type'", "]", "!=", "'random'", ":", "self", ".", "_copy_embeddings", "(", "self", ".", "model", ".", "embeddings", ".", "weight", ",", "self", ".", "opt", "[", "'embedding_type'", "]", ")", "return", "self", ".", "model" ]
[ 34, 4 ]
[ 43, 25 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent.add_cmdline_args
( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None )
Override to add one arg.
Override to add one arg.
def add_cmdline_args( cls, parser: ParlaiParser, partial_opt: Optional[Opt] = None ) -> ParlaiParser: """ Override to add one arg. """ TransformerGeneratorAgent.add_cmdline_args(parser, partial_opt=partial_opt) TorchImageAgent.add_cmdline_args(parser, partial_opt=partial_opt) group = parser.add_argument_group('Image Encoder Args') group.add_argument( '--include-image-token', type='bool', default=True, recommended=True, help='if true, include image token (or no image token) for each example', ) group.add_argument( '--image-fusion-type', type=str, default='late', choices=[f.value for f in FusionType], help='which fusion type to use', ) return group
[ "def", "add_cmdline_args", "(", "cls", ",", "parser", ":", "ParlaiParser", ",", "partial_opt", ":", "Optional", "[", "Opt", "]", "=", "None", ")", "->", "ParlaiParser", ":", "TransformerGeneratorAgent", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt", "=", "partial_opt", ")", "TorchImageAgent", ".", "add_cmdline_args", "(", "parser", ",", "partial_opt", "=", "partial_opt", ")", "group", "=", "parser", ".", "add_argument_group", "(", "'Image Encoder Args'", ")", "group", ".", "add_argument", "(", "'--include-image-token'", ",", "type", "=", "'bool'", ",", "default", "=", "True", ",", "recommended", "=", "True", ",", "help", "=", "'if true, include image token (or no image token) for each example'", ",", ")", "group", ".", "add_argument", "(", "'--image-fusion-type'", ",", "type", "=", "str", ",", "default", "=", "'late'", ",", "choices", "=", "[", "f", ".", "value", "for", "f", "in", "FusionType", "]", ",", "help", "=", "'which fusion type to use'", ",", ")", "return", "group" ]
[ 46, 4 ]
[ 69, 20 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent.build_dictionary
(self)
Override to include image tokens.
Override to include image tokens.
def build_dictionary(self) -> DictionaryAgent: """ Override to include image tokens. """ self.dict = super().build_dictionary() if self.opt.get('include_image_token') and TOKEN_IMAGE not in self.dict: self.dict[TOKEN_IMAGE] = 1 self.dict[TOKEN_NO_IMAGE] = 1 return self.dict
[ "def", "build_dictionary", "(", "self", ")", "->", "DictionaryAgent", ":", "self", ".", "dict", "=", "super", "(", ")", ".", "build_dictionary", "(", ")", "if", "self", ".", "opt", ".", "get", "(", "'include_image_token'", ")", "and", "TOKEN_IMAGE", "not", "in", "self", ".", "dict", ":", "self", ".", "dict", "[", "TOKEN_IMAGE", "]", "=", "1", "self", ".", "dict", "[", "TOKEN_NO_IMAGE", "]", "=", "1", "return", "self", ".", "dict" ]
[ 71, 4 ]
[ 80, 24 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent._set_text_vec
(self, *args, **kwargs)
Override to include image token.
Override to include image token.
def _set_text_vec(self, *args, **kwargs) -> dict: """ Override to include image token. """ obs = super()._set_text_vec(*args, **kwargs) if 'text' not in obs or 'text_vec' not in obs: return obs if self.opt.get('include_image_token', False): # `truncate` is the third arg to this function truncate = args[2] - 1 if args[2] is not None else None vec = torch.LongTensor( # type: ignore self._check_truncate(obs['text_vec'], truncate, True) ) token = TOKEN_NO_IMAGE if obs.get('image', None) is not None: token = TOKEN_IMAGE obs.force_set( 'text_vec', torch.cat([vec, vec.new_tensor(self.dict[token]).unsqueeze(0)], 0), ) return obs
[ "def", "_set_text_vec", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "dict", ":", "obs", "=", "super", "(", ")", ".", "_set_text_vec", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "'text'", "not", "in", "obs", "or", "'text_vec'", "not", "in", "obs", ":", "return", "obs", "if", "self", ".", "opt", ".", "get", "(", "'include_image_token'", ",", "False", ")", ":", "# `truncate` is the third arg to this function", "truncate", "=", "args", "[", "2", "]", "-", "1", "if", "args", "[", "2", "]", "is", "not", "None", "else", "None", "vec", "=", "torch", ".", "LongTensor", "(", "# type: ignore", "self", ".", "_check_truncate", "(", "obs", "[", "'text_vec'", "]", ",", "truncate", ",", "True", ")", ")", "token", "=", "TOKEN_NO_IMAGE", "if", "obs", ".", "get", "(", "'image'", ",", "None", ")", "is", "not", "None", ":", "token", "=", "TOKEN_IMAGE", "obs", ".", "force_set", "(", "'text_vec'", ",", "torch", ".", "cat", "(", "[", "vec", ",", "vec", ".", "new_tensor", "(", "self", ".", "dict", "[", "token", "]", ")", ".", "unsqueeze", "(", "0", ")", "]", ",", "0", ")", ",", ")", "return", "obs" ]
[ 82, 4 ]
[ 102, 18 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent._dummy_batch
(self, batchsize: int, maxlen: int)
Override to include image feats.
Override to include image feats.
def _dummy_batch(self, batchsize: int, maxlen: int) -> Batch: """ Override to include image feats. """ b = super()._dummy_batch(batchsize, maxlen) image = torch.ones(batchsize, self.image_features_dim).cuda() if self.n_image_channels > 1: image = image.unsqueeze(1).repeat(1, self.n_image_channels, 1) if self.fp16: image = image.half() return Batch( text_vec=b.text_vec, label_vec=b.label_vec, image=image, personalities=torch.ones(batchsize, self.opt['embedding_size']).cuda(), )
[ "def", "_dummy_batch", "(", "self", ",", "batchsize", ":", "int", ",", "maxlen", ":", "int", ")", "->", "Batch", ":", "b", "=", "super", "(", ")", ".", "_dummy_batch", "(", "batchsize", ",", "maxlen", ")", "image", "=", "torch", ".", "ones", "(", "batchsize", ",", "self", ".", "image_features_dim", ")", ".", "cuda", "(", ")", "if", "self", ".", "n_image_channels", ">", "1", ":", "image", "=", "image", ".", "unsqueeze", "(", "1", ")", ".", "repeat", "(", "1", ",", "self", ".", "n_image_channels", ",", "1", ")", "if", "self", ".", "fp16", ":", "image", "=", "image", ".", "half", "(", ")", "return", "Batch", "(", "text_vec", "=", "b", ".", "text_vec", ",", "label_vec", "=", "b", ".", "label_vec", ",", "image", "=", "image", ",", "personalities", "=", "torch", ".", "ones", "(", "batchsize", ",", "self", ".", "opt", "[", "'embedding_size'", "]", ")", ".", "cuda", "(", ")", ",", ")" ]
[ 104, 4 ]
[ 119, 9 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent.batchify_image_features
(self, batch: Batch)
Format and return the batched image features. Image features represented by tensors will set to the right type.
Format and return the batched image features.
def batchify_image_features(self, batch: Batch) -> Batch: """ Format and return the batched image features. Image features represented by tensors will set to the right type. """ if type(batch.image) == list and any(b is not None for b in batch.image): images = [] for img in batch.image: if isinstance(img, torch.Tensor): img = self._process_image_features(img) images.append(img) batch.image = images else: images = [None] * len(batch.valid_indices) batch.image = images return batch
[ "def", "batchify_image_features", "(", "self", ",", "batch", ":", "Batch", ")", "->", "Batch", ":", "if", "type", "(", "batch", ".", "image", ")", "==", "list", "and", "any", "(", "b", "is", "not", "None", "for", "b", "in", "batch", ".", "image", ")", ":", "images", "=", "[", "]", "for", "img", "in", "batch", ".", "image", ":", "if", "isinstance", "(", "img", ",", "torch", ".", "Tensor", ")", ":", "img", "=", "self", ".", "_process_image_features", "(", "img", ")", "images", ".", "append", "(", "img", ")", "batch", ".", "image", "=", "images", "else", ":", "images", "=", "[", "None", "]", "*", "len", "(", "batch", ".", "valid_indices", ")", "batch", ".", "image", "=", "images", "return", "batch" ]
[ 121, 4 ]
[ 137, 20 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent._process_image_features
(self, features: torch.Tensor)
Format shape and type of input image-feature tensor. Override TorchImageAgent._process_image_features to handle multi-dimensional images.
Format shape and type of input image-feature tensor.
def _process_image_features(self, features: torch.Tensor) -> torch.Tensor: """ Format shape and type of input image-feature tensor. Override TorchImageAgent._process_image_features to handle multi-dimensional images. """ features = features.view(-1, self.image_features_dim) return torch.stack( [ TorchImageAgent._process_image_features(self, features[i]) for i in range(features.size(0)) ] )
[ "def", "_process_image_features", "(", "self", ",", "features", ":", "torch", ".", "Tensor", ")", "->", "torch", ".", "Tensor", ":", "features", "=", "features", ".", "view", "(", "-", "1", ",", "self", ".", "image_features_dim", ")", "return", "torch", ".", "stack", "(", "[", "TorchImageAgent", ".", "_process_image_features", "(", "self", ",", "features", "[", "i", "]", ")", "for", "i", "in", "range", "(", "features", ".", "size", "(", "0", ")", ")", "]", ")" ]
[ 139, 4 ]
[ 152, 9 ]
python
en
['en', 'error', 'th']
False
ImageSeq2seqAgent.load_state_dict
(self, state_dict: Dict[str, torch.Tensor])
Override for custom loading. Reasons: 1. When using an init model without an image encoder 2. We decide to add segment embeddings after the fact. 3. When using an init model with only an encoder provided In this case, we may need to add the START token to the state_dict 4. When using an init model without image tokens in the embeddings. This is only the case if the embs differ by 2 in dimension 0
Override for custom loading.
def load_state_dict(self, state_dict: Dict[str, torch.Tensor]): """ Override for custom loading. Reasons: 1. When using an init model without an image encoder 2. We decide to add segment embeddings after the fact. 3. When using an init model with only an encoder provided In this case, we may need to add the START token to the state_dict 4. When using an init model without image tokens in the embeddings. This is only the case if the embs differ by 2 in dimension 0 """ state_dict['encoder.dummy_image_enc'] = self.model.encoder.dummy_image_enc state_dict['encoder.ones_mask'] = self.model.encoder.ones_mask # Case 1 -> No Image Encoder if 'encoder.image_encoder.0.weight' not in state_dict: for k, v in self.model.encoder.image_encoder.state_dict().items(): state_dict[f'encoder.image_encoder.{k}'] = v # case 2 -> Segment embeddings in new model if ( self.opt.get('n_segments', 0) >= 1 and 'encoder.segment_embeddings.weight' not in state_dict ): state_dict[ 'encoder.segment_embeddings.weight' ] = self.model.encoder.segment_embeddings.weight # Case 3 -> Only an Encoder provided if not (any('decoder' in state_key for state_key in state_dict)): for k, v in self.model.decoder.state_dict().items(): state_dict[f'decoder.{k}'] = v state_dict['decoder.embeddings.weight'] = state_dict['embeddings.weight'] if 'START' not in state_dict: state_dict['START'] = self.model.START if self.opt['init_model'] is not None: try: self.model.load_state_dict(state_dict) return except RuntimeError as e: # Case 4 --> Check for Embedding Diffs. Make sure dims match up embs = state_dict['embeddings.weight'] enc_embs = state_dict['encoder.embeddings.weight'] dec_embs = state_dict['decoder.embeddings.weight'] init_embs = self.model.embeddings.weight if ( embs.shape[0] + 2 != init_embs.shape[0] or embs.shape[1] != init_embs.shape[1] ): raise e state_dict.update( { 'embeddings.weight': torch.cat( ( embs.to(init_embs.device, dtype=init_embs.dtype), init_embs[-2:, :], ) ), 'encoder.embeddings.weight': torch.cat( ( enc_embs.to(init_embs.device, dtype=init_embs.dtype), init_embs[-2:, :], ) ), 'decoder.embeddings.weight': torch.cat( ( dec_embs.to(init_embs.device, dtype=init_embs.dtype), init_embs[-2:, :], ) ), } ) pct_init = round(embs.shape[0] / len(self.dict) * 100, 1) print( f'Initialized embeddings for {embs.shape[0]} tokens ({pct_init}%)' ) self.model.load_state_dict(state_dict)
[ "def", "load_state_dict", "(", "self", ",", "state_dict", ":", "Dict", "[", "str", ",", "torch", ".", "Tensor", "]", ")", ":", "state_dict", "[", "'encoder.dummy_image_enc'", "]", "=", "self", ".", "model", ".", "encoder", ".", "dummy_image_enc", "state_dict", "[", "'encoder.ones_mask'", "]", "=", "self", ".", "model", ".", "encoder", ".", "ones_mask", "# Case 1 -> No Image Encoder", "if", "'encoder.image_encoder.0.weight'", "not", "in", "state_dict", ":", "for", "k", ",", "v", "in", "self", ".", "model", ".", "encoder", ".", "image_encoder", ".", "state_dict", "(", ")", ".", "items", "(", ")", ":", "state_dict", "[", "f'encoder.image_encoder.{k}'", "]", "=", "v", "# case 2 -> Segment embeddings in new model", "if", "(", "self", ".", "opt", ".", "get", "(", "'n_segments'", ",", "0", ")", ">=", "1", "and", "'encoder.segment_embeddings.weight'", "not", "in", "state_dict", ")", ":", "state_dict", "[", "'encoder.segment_embeddings.weight'", "]", "=", "self", ".", "model", ".", "encoder", ".", "segment_embeddings", ".", "weight", "# Case 3 -> Only an Encoder provided", "if", "not", "(", "any", "(", "'decoder'", "in", "state_key", "for", "state_key", "in", "state_dict", ")", ")", ":", "for", "k", ",", "v", "in", "self", ".", "model", ".", "decoder", ".", "state_dict", "(", ")", ".", "items", "(", ")", ":", "state_dict", "[", "f'decoder.{k}'", "]", "=", "v", "state_dict", "[", "'decoder.embeddings.weight'", "]", "=", "state_dict", "[", "'embeddings.weight'", "]", "if", "'START'", "not", "in", "state_dict", ":", "state_dict", "[", "'START'", "]", "=", "self", ".", "model", ".", "START", "if", "self", ".", "opt", "[", "'init_model'", "]", "is", "not", "None", ":", "try", ":", "self", ".", "model", ".", "load_state_dict", "(", "state_dict", ")", "return", "except", "RuntimeError", "as", "e", ":", "# Case 4 --> Check for Embedding Diffs. Make sure dims match up", "embs", "=", "state_dict", "[", "'embeddings.weight'", "]", "enc_embs", "=", "state_dict", "[", "'encoder.embeddings.weight'", "]", "dec_embs", "=", "state_dict", "[", "'decoder.embeddings.weight'", "]", "init_embs", "=", "self", ".", "model", ".", "embeddings", ".", "weight", "if", "(", "embs", ".", "shape", "[", "0", "]", "+", "2", "!=", "init_embs", ".", "shape", "[", "0", "]", "or", "embs", ".", "shape", "[", "1", "]", "!=", "init_embs", ".", "shape", "[", "1", "]", ")", ":", "raise", "e", "state_dict", ".", "update", "(", "{", "'embeddings.weight'", ":", "torch", ".", "cat", "(", "(", "embs", ".", "to", "(", "init_embs", ".", "device", ",", "dtype", "=", "init_embs", ".", "dtype", ")", ",", "init_embs", "[", "-", "2", ":", ",", ":", "]", ",", ")", ")", ",", "'encoder.embeddings.weight'", ":", "torch", ".", "cat", "(", "(", "enc_embs", ".", "to", "(", "init_embs", ".", "device", ",", "dtype", "=", "init_embs", ".", "dtype", ")", ",", "init_embs", "[", "-", "2", ":", ",", ":", "]", ",", ")", ")", ",", "'decoder.embeddings.weight'", ":", "torch", ".", "cat", "(", "(", "dec_embs", ".", "to", "(", "init_embs", ".", "device", ",", "dtype", "=", "init_embs", ".", "dtype", ")", ",", "init_embs", "[", "-", "2", ":", ",", ":", "]", ",", ")", ")", ",", "}", ")", "pct_init", "=", "round", "(", "embs", ".", "shape", "[", "0", "]", "/", "len", "(", "self", ".", "dict", ")", "*", "100", ",", "1", ")", "print", "(", "f'Initialized embeddings for {embs.shape[0]} tokens ({pct_init}%)'", ")", "self", ".", "model", ".", "load_state_dict", "(", "state_dict", ")" ]
[ 157, 4 ]
[ 236, 46 ]
python
en
['en', 'error', 'th']
False
Line.color
(self)
Sets the inner box plot bounding line 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str
Sets the inner box plot bounding line 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
def color(self): """ Sets the inner box plot bounding line 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str """ return self["color"]
[ "def", "color", "(", "self", ")", ":", "return", "self", "[", "\"color\"", "]" ]
[ 15, 4 ]
[ 65, 28 ]
python
en
['en', 'error', 'th']
False
Line.width
(self)
Sets the inner box plot bounding line width. 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 inner box plot bounding line width. 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 inner box plot bounding line width. The 'width' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["width"]
[ "def", "width", "(", "self", ")", ":", "return", "self", "[", "\"width\"", "]" ]
[ 74, 4 ]
[ 85, 28 ]
python
en
['en', 'error', 'th']
False
Line.__init__
(self, arg=None, color=None, width=None, **kwargs)
Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.violin.box.Line` color Sets the inner box plot bounding line color. width Sets the inner box plot bounding line width. Returns ------- Line
Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.violin.box.Line` color Sets the inner box plot bounding line color. width Sets the inner box plot bounding line width.
def __init__(self, arg=None, color=None, width=None, **kwargs): """ Construct a new Line object Parameters ---------- arg dict of properties compatible with this constructor or an instance of :class:`plotly.graph_objs.violin.box.Line` color Sets the inner box plot bounding line color. width Sets the inner box plot bounding line width. Returns ------- Line """ super(Line, self).__init__("line") if "_parent" in kwargs: self._parent = kwargs["_parent"] return # Validate arg # ------------ if arg is None: arg = {} elif isinstance(arg, self.__class__): arg = arg.to_plotly_json() elif isinstance(arg, dict): arg = _copy.copy(arg) else: raise ValueError( """\ The first argument to the plotly.graph_objs.violin.box.Line constructor must be a dict or an instance of :class:`plotly.graph_objs.violin.box.Line`""" ) # Handle skip_invalid # ------------------- self._skip_invalid = kwargs.pop("skip_invalid", False) self._validate = kwargs.pop("_validate", True) # Populate data dict with properties # ---------------------------------- _v = arg.pop("color", None) _v = color if color is not None else _v if _v is not None: self["color"] = _v _v = arg.pop("width", None) _v = width if width is not None else _v if _v is not None: self["width"] = _v # Process unknown kwargs # ---------------------- self._process_kwargs(**dict(arg, **kwargs)) # Reset skip_invalid # ------------------ self._skip_invalid = False
[ "def", "__init__", "(", "self", ",", "arg", "=", "None", ",", "color", "=", "None", ",", "width", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Line", ",", "self", ")", ".", "__init__", "(", "\"line\"", ")", "if", "\"_parent\"", "in", "kwargs", ":", "self", ".", "_parent", "=", "kwargs", "[", "\"_parent\"", "]", "return", "# Validate arg", "# ------------", "if", "arg", "is", "None", ":", "arg", "=", "{", "}", "elif", "isinstance", "(", "arg", ",", "self", ".", "__class__", ")", ":", "arg", "=", "arg", ".", "to_plotly_json", "(", ")", "elif", "isinstance", "(", "arg", ",", "dict", ")", ":", "arg", "=", "_copy", ".", "copy", "(", "arg", ")", "else", ":", "raise", "ValueError", "(", "\"\"\"\\\nThe first argument to the plotly.graph_objs.violin.box.Line \nconstructor must be a dict or \nan instance of :class:`plotly.graph_objs.violin.box.Line`\"\"\"", ")", "# Handle skip_invalid", "# -------------------", "self", ".", "_skip_invalid", "=", "kwargs", ".", "pop", "(", "\"skip_invalid\"", ",", "False", ")", "self", ".", "_validate", "=", "kwargs", ".", "pop", "(", "\"_validate\"", ",", "True", ")", "# Populate data dict with properties", "# ----------------------------------", "_v", "=", "arg", ".", "pop", "(", "\"color\"", ",", "None", ")", "_v", "=", "color", "if", "color", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"color\"", "]", "=", "_v", "_v", "=", "arg", ".", "pop", "(", "\"width\"", ",", "None", ")", "_v", "=", "width", "if", "width", "is", "not", "None", "else", "_v", "if", "_v", "is", "not", "None", ":", "self", "[", "\"width\"", "]", "=", "_v", "# Process unknown kwargs", "# ----------------------", "self", ".", "_process_kwargs", "(", "*", "*", "dict", "(", "arg", ",", "*", "*", "kwargs", ")", ")", "# Reset skip_invalid", "# ------------------", "self", ".", "_skip_invalid", "=", "False" ]
[ 102, 4 ]
[ 165, 34 ]
python
en
['en', 'error', 'th']
False
display_meter
(cur_value, max_value, length=30, fill_color=["R", "Y", "G"], empty_color="B", text_color="w", align="left", pre_text="", post_text="", show_values=True)
Represents a current and maximum value given as a "bar" rendered with ANSI or xterm256 background colors. Args: cur_value (int): Current value to display max_value (int): Maximum value to display Options: length (int): Length of meter returned, in characters fill_color (list): List of color codes for the full portion of the bar, sans any sort of prefix - both ANSI and xterm256 colors are usable. When the bar is empty, colors toward the start of the list will be chosen - when the bar is full, colors towards the end are picked. You can adjust the 'weights' of the changing colors by adding multiple entries of the same color - for example, if you only want the bar to change when it's close to empty, you could supply ['R','Y','G','G','G'] empty_color (str): Color code for the empty portion of the bar. text_color (str): Color code for text inside the bar. align (str): "left", "right", or "center" - alignment of text in the bar pre_text (str): Text to put before the numbers in the bar post_text (str): Text to put after the numbers in the bar show_values (bool): If true, shows the numerical values represented by the bar. It's highly recommended you keep this on, especially if there's no info given in pre_text or post_text, as players on screen readers will be unable to read the graphical aspect of the bar.
Represents a current and maximum value given as a "bar" rendered with ANSI or xterm256 background colors. Args: cur_value (int): Current value to display max_value (int): Maximum value to display Options: length (int): Length of meter returned, in characters fill_color (list): List of color codes for the full portion of the bar, sans any sort of prefix - both ANSI and xterm256 colors are usable. When the bar is empty, colors toward the start of the list will be chosen - when the bar is full, colors towards the end are picked. You can adjust the 'weights' of the changing colors by adding multiple entries of the same color - for example, if you only want the bar to change when it's close to empty, you could supply ['R','Y','G','G','G'] empty_color (str): Color code for the empty portion of the bar. text_color (str): Color code for text inside the bar. align (str): "left", "right", or "center" - alignment of text in the bar pre_text (str): Text to put before the numbers in the bar post_text (str): Text to put after the numbers in the bar show_values (bool): If true, shows the numerical values represented by the bar. It's highly recommended you keep this on, especially if there's no info given in pre_text or post_text, as players on screen readers will be unable to read the graphical aspect of the bar.
def display_meter(cur_value, max_value, length=30, fill_color=["R", "Y", "G"], empty_color="B", text_color="w", align="left", pre_text="", post_text="", show_values=True): """ Represents a current and maximum value given as a "bar" rendered with ANSI or xterm256 background colors. Args: cur_value (int): Current value to display max_value (int): Maximum value to display Options: length (int): Length of meter returned, in characters fill_color (list): List of color codes for the full portion of the bar, sans any sort of prefix - both ANSI and xterm256 colors are usable. When the bar is empty, colors toward the start of the list will be chosen - when the bar is full, colors towards the end are picked. You can adjust the 'weights' of the changing colors by adding multiple entries of the same color - for example, if you only want the bar to change when it's close to empty, you could supply ['R','Y','G','G','G'] empty_color (str): Color code for the empty portion of the bar. text_color (str): Color code for text inside the bar. align (str): "left", "right", or "center" - alignment of text in the bar pre_text (str): Text to put before the numbers in the bar post_text (str): Text to put after the numbers in the bar show_values (bool): If true, shows the numerical values represented by the bar. It's highly recommended you keep this on, especially if there's no info given in pre_text or post_text, as players on screen readers will be unable to read the graphical aspect of the bar. """ # Start by building the base string. num_text = "" if show_values: num_text = "%i / %i" % (cur_value, max_value) bar_base_str = pre_text + num_text + post_text # Cut down the length of the base string if needed if len(bar_base_str) > length: bar_base_str = bar_base_str[:length] # Pad and align the bar base string if align == "right": bar_base_str = bar_base_str.rjust(length, " ") elif align == "center": bar_base_str = bar_base_str.center(length, " ") else: bar_base_str = bar_base_str.ljust(length, " ") if max_value < 1: # Prevent divide by zero max_value = 1 if cur_value < 0: # Prevent weirdly formatted 'negative bars' cur_value = 0 if cur_value > max_value: # Display overfull bars correctly cur_value = max_value # Now it's time to determine where to put the color codes. percent_full = float(cur_value) / float(max_value) split_index = round(float(length) * percent_full) # Determine point at which to split the bar split_index = int(split_index) # Separate the bar string into full and empty portions full_portion = bar_base_str[:split_index] empty_portion = bar_base_str[split_index:] # Pick which fill color to use based on how full the bar is fillcolor_index = (float(len(fill_color)) * percent_full) fillcolor_index = int(round(fillcolor_index)) - 1 fillcolor_code = "|[" + fill_color[fillcolor_index] # Make color codes for empty bar portion and text_color emptycolor_code = "|[" + empty_color textcolor_code = "|" + text_color # Assemble the final bar final_bar = fillcolor_code + textcolor_code + full_portion + "|n" + emptycolor_code + textcolor_code + empty_portion + "|n" return final_bar
[ "def", "display_meter", "(", "cur_value", ",", "max_value", ",", "length", "=", "30", ",", "fill_color", "=", "[", "\"R\"", ",", "\"Y\"", ",", "\"G\"", "]", ",", "empty_color", "=", "\"B\"", ",", "text_color", "=", "\"w\"", ",", "align", "=", "\"left\"", ",", "pre_text", "=", "\"\"", ",", "post_text", "=", "\"\"", ",", "show_values", "=", "True", ")", ":", "# Start by building the base string.", "num_text", "=", "\"\"", "if", "show_values", ":", "num_text", "=", "\"%i / %i\"", "%", "(", "cur_value", ",", "max_value", ")", "bar_base_str", "=", "pre_text", "+", "num_text", "+", "post_text", "# Cut down the length of the base string if needed", "if", "len", "(", "bar_base_str", ")", ">", "length", ":", "bar_base_str", "=", "bar_base_str", "[", ":", "length", "]", "# Pad and align the bar base string", "if", "align", "==", "\"right\"", ":", "bar_base_str", "=", "bar_base_str", ".", "rjust", "(", "length", ",", "\" \"", ")", "elif", "align", "==", "\"center\"", ":", "bar_base_str", "=", "bar_base_str", ".", "center", "(", "length", ",", "\" \"", ")", "else", ":", "bar_base_str", "=", "bar_base_str", ".", "ljust", "(", "length", ",", "\" \"", ")", "if", "max_value", "<", "1", ":", "# Prevent divide by zero", "max_value", "=", "1", "if", "cur_value", "<", "0", ":", "# Prevent weirdly formatted 'negative bars'", "cur_value", "=", "0", "if", "cur_value", ">", "max_value", ":", "# Display overfull bars correctly", "cur_value", "=", "max_value", "# Now it's time to determine where to put the color codes.", "percent_full", "=", "float", "(", "cur_value", ")", "/", "float", "(", "max_value", ")", "split_index", "=", "round", "(", "float", "(", "length", ")", "*", "percent_full", ")", "# Determine point at which to split the bar", "split_index", "=", "int", "(", "split_index", ")", "# Separate the bar string into full and empty portions", "full_portion", "=", "bar_base_str", "[", ":", "split_index", "]", "empty_portion", "=", "bar_base_str", "[", "split_index", ":", "]", "# Pick which fill color to use based on how full the bar is", "fillcolor_index", "=", "(", "float", "(", "len", "(", "fill_color", ")", ")", "*", "percent_full", ")", "fillcolor_index", "=", "int", "(", "round", "(", "fillcolor_index", ")", ")", "-", "1", "fillcolor_code", "=", "\"|[\"", "+", "fill_color", "[", "fillcolor_index", "]", "# Make color codes for empty bar portion and text_color", "emptycolor_code", "=", "\"|[\"", "+", "empty_color", "textcolor_code", "=", "\"|\"", "+", "text_color", "# Assemble the final bar", "final_bar", "=", "fillcolor_code", "+", "textcolor_code", "+", "full_portion", "+", "\"|n\"", "+", "emptycolor_code", "+", "textcolor_code", "+", "empty_portion", "+", "\"|n\"", "return", "final_bar" ]
[ 24, 0 ]
[ 102, 20 ]
python
en
['en', 'error', 'th']
False
Paginated.__init__
( self, *, start: int = None, end: int = None, limit: int = None, total: int = None, **kwargs )
Initialize a Paginated instance. Args: start: The first record offset end: The last record offset limit: Enforced limit on the number of records total: Total number of records available
Initialize a Paginated instance.
def __init__( self, *, start: int = None, end: int = None, limit: int = None, total: int = None, **kwargs ): """ Initialize a Paginated instance. Args: start: The first record offset end: The last record offset limit: Enforced limit on the number of records total: Total number of records available """ super(Paginated, self).__init__(**kwargs) self.start = start self.end = end self.limit = limit self.total = total
[ "def", "__init__", "(", "self", ",", "*", ",", "start", ":", "int", "=", "None", ",", "end", ":", "int", "=", "None", ",", "limit", ":", "int", "=", "None", ",", "total", ":", "int", "=", "None", ",", "*", "*", "kwargs", ")", ":", "super", "(", "Paginated", ",", "self", ")", ".", "__init__", "(", "*", "*", "kwargs", ")", "self", ".", "start", "=", "start", "self", ".", "end", "=", "end", "self", ".", "limit", "=", "limit", "self", ".", "total", "=", "total" ]
[ 15, 4 ]
[ 38, 26 ]
python
en
['en', 'error', 'th']
False
TestPropertyValidation.test_validators_work_attr
(self)
Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators
Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators
def test_validators_work_attr(self): """ Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators """ with pytest.raises(ValueError): self.scatter.name = [1, 2, 3]
[ "def", "test_validators_work_attr", "(", "self", ")", ":", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "self", ".", "scatter", ".", "name", "=", "[", "1", ",", "2", ",", "3", "]" ]
[ 11, 4 ]
[ 18, 41 ]
python
en
['en', 'error', 'th']
False
TestPropertyValidation.test_validators_work_item
(self)
Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators
Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators
def test_validators_work_item(self): """ Note: all of the individual validators are tested in `_plotly_utils/tests/validators`. Here we're just making sure that datatypes make use of validators """ with pytest.raises(ValueError): self.scatter["name"] = [1, 2, 3]
[ "def", "test_validators_work_item", "(", "self", ")", ":", "with", "pytest", ".", "raises", "(", "ValueError", ")", ":", "self", ".", "scatter", "[", "\"name\"", "]", "=", "[", "1", ",", "2", ",", "3", "]" ]
[ 20, 4 ]
[ 27, 44 ]
python
en
['en', 'error', 'th']
False
setup_data
(path, dialog_format=False, binary_classes=False)
Set up data in DialogData format from path. :param path: path to the data file that stores the MNLI dataset :param dialog_format: if set True, omit the special tokens 'Hypothesis' and 'Premise' in the text. :param binary_classes: if set True, bucketize neutral and entailment in one (not_contradiction) :return: a tuple in the parlai.core.teachers.DialogData format ``((x, y, r, c, i), new_episode?)`` where the ``x`` is the query/question and ``y`` is the answer/label, ``clas`` represents the ``c`` the avaiable choices. ``new_episode`` is set True in any NLI teacher.
Set up data in DialogData format from path.
def setup_data(path, dialog_format=False, binary_classes=False): """ Set up data in DialogData format from path. :param path: path to the data file that stores the MNLI dataset :param dialog_format: if set True, omit the special tokens 'Hypothesis' and 'Premise' in the text. :param binary_classes: if set True, bucketize neutral and entailment in one (not_contradiction) :return: a tuple in the parlai.core.teachers.DialogData format ``((x, y, r, c, i), new_episode?)`` where the ``x`` is the query/question and ``y`` is the answer/label, ``clas`` represents the ``c`` the avaiable choices. ``new_episode`` is set True in any NLI teacher. """ print('loading: ' + path) with PathManager.open(path, 'r') as data_file: for pair_line in data_file: pair = json.loads(pair_line) if pair[MULTINLI_ANSWER_KEY] == '-': continue question, answers, clas = convert_to_dialogData( premise_raw=pair[MULTINLI_PREMISE_KEY], hypo_raw=pair[MULTINLI_HYPO_KEY], answer_raw=pair[MULTINLI_ANSWER_KEY], dialog_format=dialog_format, binary_classes=binary_classes, ) yield (question, answers, None, clas), True
[ "def", "setup_data", "(", "path", ",", "dialog_format", "=", "False", ",", "binary_classes", "=", "False", ")", ":", "print", "(", "'loading: '", "+", "path", ")", "with", "PathManager", ".", "open", "(", "path", ",", "'r'", ")", "as", "data_file", ":", "for", "pair_line", "in", "data_file", ":", "pair", "=", "json", ".", "loads", "(", "pair_line", ")", "if", "pair", "[", "MULTINLI_ANSWER_KEY", "]", "==", "'-'", ":", "continue", "question", ",", "answers", ",", "clas", "=", "convert_to_dialogData", "(", "premise_raw", "=", "pair", "[", "MULTINLI_PREMISE_KEY", "]", ",", "hypo_raw", "=", "pair", "[", "MULTINLI_HYPO_KEY", "]", ",", "answer_raw", "=", "pair", "[", "MULTINLI_ANSWER_KEY", "]", ",", "dialog_format", "=", "dialog_format", ",", "binary_classes", "=", "binary_classes", ",", ")", "yield", "(", "question", ",", "answers", ",", "None", ",", "clas", ")", ",", "True" ]
[ 60, 0 ]
[ 87, 55 ]
python
en
['en', 'error', 'th']
False
convert_to_dialogData
( premise_raw, hypo_raw, answer_raw, dialog_format=False, binary_classes=False )
Convert from NLI context to dialog text. :param premise_raw: raw premise extracted from jsonl file. :param hypo_raw: raw hypothesis extracted from jsonl file. :param answer_raw: raw answer extracted from jsonl file. :param dialog_format: if set True, omit the special tokens 'Hypothesis' and 'Premise' in the text. :param binary_classes: if set True, bucketize (neutral, entailment) into one (no_contradiction) :return: a tuple (question, answer, clas) - ``question`` (str) is a query and possibly context - ``answers`` (iter) is an iterable of label(s) for that query - ``clas`` (iter) is an iterable of label candidates that the student can choose from
Convert from NLI context to dialog text.
def convert_to_dialogData( premise_raw, hypo_raw, answer_raw, dialog_format=False, binary_classes=False ): """ Convert from NLI context to dialog text. :param premise_raw: raw premise extracted from jsonl file. :param hypo_raw: raw hypothesis extracted from jsonl file. :param answer_raw: raw answer extracted from jsonl file. :param dialog_format: if set True, omit the special tokens 'Hypothesis' and 'Premise' in the text. :param binary_classes: if set True, bucketize (neutral, entailment) into one (no_contradiction) :return: a tuple (question, answer, clas) - ``question`` (str) is a query and possibly context - ``answers`` (iter) is an iterable of label(s) for that query - ``clas`` (iter) is an iterable of label candidates that the student can choose from """ premise_raw = premise_raw.strip('\n').strip('\t') hypo_raw = hypo_raw.strip('\n').strip('\t') clas = MULTINLI_LABELS if binary_classes: answer_raw = BICLASS_DICT[answer_raw] clas = BICLASS_LABELS if not dialog_format: premise_raw = MULTINLI_PREMISE_PREFIX + premise_raw hypo_raw = MULTINLI_HYPO_PREFIX + hypo_raw question = premise_raw + '\n' + hypo_raw answers = [answer_raw] return question, answers, clas
[ "def", "convert_to_dialogData", "(", "premise_raw", ",", "hypo_raw", ",", "answer_raw", ",", "dialog_format", "=", "False", ",", "binary_classes", "=", "False", ")", ":", "premise_raw", "=", "premise_raw", ".", "strip", "(", "'\\n'", ")", ".", "strip", "(", "'\\t'", ")", "hypo_raw", "=", "hypo_raw", ".", "strip", "(", "'\\n'", ")", ".", "strip", "(", "'\\t'", ")", "clas", "=", "MULTINLI_LABELS", "if", "binary_classes", ":", "answer_raw", "=", "BICLASS_DICT", "[", "answer_raw", "]", "clas", "=", "BICLASS_LABELS", "if", "not", "dialog_format", ":", "premise_raw", "=", "MULTINLI_PREMISE_PREFIX", "+", "premise_raw", "hypo_raw", "=", "MULTINLI_HYPO_PREFIX", "+", "hypo_raw", "question", "=", "premise_raw", "+", "'\\n'", "+", "hypo_raw", "answers", "=", "[", "answer_raw", "]", "return", "question", ",", "answers", ",", "clas" ]
[ 90, 0 ]
[ 120, 34 ]
python
en
['en', 'error', 'th']
False
ColorBar.bgcolor
(self)
Sets the color of padded area. The 'bgcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str
Sets the color of padded area. The 'bgcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
def bgcolor(self): """ Sets the color of padded area. The 'bgcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str """ return self["bgcolor"]
[ "def", "bgcolor", "(", "self", ")", ":", "return", "self", "[", "\"bgcolor\"", "]" ]
[ 59, 4 ]
[ 109, 30 ]
python
en
['en', 'error', 'th']
False
ColorBar.bordercolor
(self)
Sets the axis line color. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str
Sets the axis line color. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
def bordercolor(self): """ Sets the axis line color. The 'bordercolor' property is a color and may be specified as: - A hex string (e.g. '#ff0000') - An rgb/rgba string (e.g. 'rgb(255,0,0)') - An hsl/hsla string (e.g. 'hsl(0,100%,50%)') - An hsv/hsva string (e.g. 'hsv(0,100%,100%)') - A named CSS color: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str """ return self["bordercolor"]
[ "def", "bordercolor", "(", "self", ")", ":", "return", "self", "[", "\"bordercolor\"", "]" ]
[ 118, 4 ]
[ 168, 34 ]
python
en
['en', 'error', 'th']
False
ColorBar.borderwidth
(self)
Sets the width (in px) or the border enclosing this color bar. The 'borderwidth' 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) or the border enclosing this color bar. The 'borderwidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
def borderwidth(self): """ Sets the width (in px) or the border enclosing this color bar. The 'borderwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["borderwidth"]
[ "def", "borderwidth", "(", "self", ")", ":", "return", "self", "[", "\"borderwidth\"", "]" ]
[ 177, 4 ]
[ 188, 34 ]
python
en
['en', 'error', 'th']
False
ColorBar.dtick
(self)
Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. "log" has several special values; "L<f>", where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use "D1" (all digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and "D2". If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48" The 'dtick' property accepts values of any type Returns ------- Any
Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. "log" has several special values; "L<f>", where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use "D1" (all digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and "D2". If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48" The 'dtick' property accepts values of any type
def dtick(self): """ Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to "log" and "date" axes. If the axis `type` is "log", then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. "log" has several special values; "L<f>", where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = "L0.5" will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use "D1" (all digits) or "D2" (only 2 and 5). `tick0` is ignored for "D1" and "D2". If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48" The 'dtick' property accepts values of any type Returns ------- Any """ return self["dtick"]
[ "def", "dtick", "(", "self", ")", ":", "return", "self", "[", "\"dtick\"", "]" ]
[ 197, 4 ]
[ 226, 28 ]
python
en
['en', 'error', 'th']
False
ColorBar.exponentformat
(self)
Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. The 'exponentformat' property is an enumeration that may be specified as: - One of the following enumeration values: ['none', 'e', 'E', 'power', 'SI', 'B'] Returns ------- Any
Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. The 'exponentformat' property is an enumeration that may be specified as: - One of the following enumeration values: ['none', 'e', 'E', 'power', 'SI', 'B']
def exponentformat(self): """ Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If "none", it appears as 1,000,000,000. If "e", 1e+9. If "E", 1E+9. If "power", 1x10^9 (with 9 in a super script). If "SI", 1G. If "B", 1B. The 'exponentformat' property is an enumeration that may be specified as: - One of the following enumeration values: ['none', 'e', 'E', 'power', 'SI', 'B'] Returns ------- Any """ return self["exponentformat"]
[ "def", "exponentformat", "(", "self", ")", ":", "return", "self", "[", "\"exponentformat\"", "]" ]
[ 235, 4 ]
[ 251, 37 ]
python
en
['en', 'error', 'th']
False
ColorBar.len
(self)
Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interval [0, inf]
def len(self): """ Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends. The 'len' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["len"]
[ "def", "len", "(", "self", ")", ":", "return", "self", "[", "\"len\"", "]" ]
[ 260, 4 ]
[ 273, 26 ]
python
en
['en', 'error', 'th']
False
ColorBar.lenmode
(self)
Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot "fraction" or in *pixels. Use `len` to set the value. The 'lenmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels'] Returns ------- Any
Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot "fraction" or in *pixels. Use `len` to set the value. The 'lenmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels']
def lenmode(self): """ Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot "fraction" or in *pixels. Use `len` to set the value. The 'lenmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels'] Returns ------- Any """ return self["lenmode"]
[ "def", "lenmode", "(", "self", ")", ":", "return", "self", "[", "\"lenmode\"", "]" ]
[ 282, 4 ]
[ 296, 30 ]
python
en
['en', 'error', 'th']
False
ColorBar.nticks
(self)
Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to "auto". The 'nticks' 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
Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to "auto". The 'nticks' 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 nticks(self): """ Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to "auto". The 'nticks' 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["nticks"]
[ "def", "nticks", "(", "self", ")", ":", "return", "self", "[", "\"nticks\"", "]" ]
[ 305, 4 ]
[ 320, 29 ]
python
en
['en', 'error', 'th']
False
ColorBar.outlinecolor
(self)
Sets the axis line color. The 'outlinecolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str
Sets the axis line color. The 'outlinecolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
def outlinecolor(self): """ Sets the axis line color. The 'outlinecolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str """ return self["outlinecolor"]
[ "def", "outlinecolor", "(", "self", ")", ":", "return", "self", "[", "\"outlinecolor\"", "]" ]
[ 329, 4 ]
[ 379, 35 ]
python
en
['en', 'error', 'th']
False
ColorBar.outlinewidth
(self)
Sets the width (in px) of the axis line. The 'outlinewidth' 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 axis line. The 'outlinewidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
def outlinewidth(self): """ Sets the width (in px) of the axis line. The 'outlinewidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["outlinewidth"]
[ "def", "outlinewidth", "(", "self", ")", ":", "return", "self", "[", "\"outlinewidth\"", "]" ]
[ 388, 4 ]
[ 399, 35 ]
python
en
['en', 'error', 'th']
False
ColorBar.separatethousands
(self)
If "true", even 4-digit integers are separated The 'separatethousands' property must be specified as a bool (either True, or False) Returns ------- bool
If "true", even 4-digit integers are separated The 'separatethousands' property must be specified as a bool (either True, or False)
def separatethousands(self): """ If "true", even 4-digit integers are separated The 'separatethousands' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["separatethousands"]
[ "def", "separatethousands", "(", "self", ")", ":", "return", "self", "[", "\"separatethousands\"", "]" ]
[ 408, 4 ]
[ 419, 40 ]
python
en
['en', 'error', 'th']
False
ColorBar.showexponent
(self)
If "all", all exponents are shown besides their significands. If "first", only the exponent of the first tick is shown. If "last", only the exponent of the last tick is shown. If "none", no exponents appear. The 'showexponent' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any
If "all", all exponents are shown besides their significands. If "first", only the exponent of the first tick is shown. If "last", only the exponent of the last tick is shown. If "none", no exponents appear. The 'showexponent' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none']
def showexponent(self): """ If "all", all exponents are shown besides their significands. If "first", only the exponent of the first tick is shown. If "last", only the exponent of the last tick is shown. If "none", no exponents appear. The 'showexponent' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any """ return self["showexponent"]
[ "def", "showexponent", "(", "self", ")", ":", "return", "self", "[", "\"showexponent\"", "]" ]
[ 428, 4 ]
[ 443, 35 ]
python
en
['en', 'error', 'th']
False
ColorBar.showticklabels
(self)
Determines whether or not the tick labels are drawn. The 'showticklabels' property must be specified as a bool (either True, or False) Returns ------- bool
Determines whether or not the tick labels are drawn. The 'showticklabels' property must be specified as a bool (either True, or False)
def showticklabels(self): """ Determines whether or not the tick labels are drawn. The 'showticklabels' property must be specified as a bool (either True, or False) Returns ------- bool """ return self["showticklabels"]
[ "def", "showticklabels", "(", "self", ")", ":", "return", "self", "[", "\"showticklabels\"", "]" ]
[ 452, 4 ]
[ 463, 37 ]
python
en
['en', 'error', 'th']
False
ColorBar.showtickprefix
(self)
If "all", all tick labels are displayed with a prefix. If "first", only the first tick is displayed with a prefix. If "last", only the last tick is displayed with a suffix. If "none", tick prefixes are hidden. The 'showtickprefix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any
If "all", all tick labels are displayed with a prefix. If "first", only the first tick is displayed with a prefix. If "last", only the last tick is displayed with a suffix. If "none", tick prefixes are hidden. The 'showtickprefix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none']
def showtickprefix(self): """ If "all", all tick labels are displayed with a prefix. If "first", only the first tick is displayed with a prefix. If "last", only the last tick is displayed with a suffix. If "none", tick prefixes are hidden. The 'showtickprefix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any """ return self["showtickprefix"]
[ "def", "showtickprefix", "(", "self", ")", ":", "return", "self", "[", "\"showtickprefix\"", "]" ]
[ 472, 4 ]
[ 487, 37 ]
python
en
['en', 'error', 'th']
False
ColorBar.showticksuffix
(self)
Same as `showtickprefix` but for tick suffixes. The 'showticksuffix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any
Same as `showtickprefix` but for tick suffixes. The 'showticksuffix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none']
def showticksuffix(self): """ Same as `showtickprefix` but for tick suffixes. The 'showticksuffix' property is an enumeration that may be specified as: - One of the following enumeration values: ['all', 'first', 'last', 'none'] Returns ------- Any """ return self["showticksuffix"]
[ "def", "showticksuffix", "(", "self", ")", ":", "return", "self", "[", "\"showticksuffix\"", "]" ]
[ 496, 4 ]
[ 508, 37 ]
python
en
['en', 'error', 'th']
False
ColorBar.thickness
(self)
Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels. 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 of the color bar This measure excludes the size of the padding, ticks and labels. 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 of the color bar This measure excludes the size of the padding, ticks and labels. 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\"", "]" ]
[ 517, 4 ]
[ 529, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.thicknessmode
(self)
Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot "fraction" or in "pixels". Use `thickness` to set the value. The 'thicknessmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels'] Returns ------- Any
Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot "fraction" or in "pixels". Use `thickness` to set the value. The 'thicknessmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels']
def thicknessmode(self): """ Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot "fraction" or in "pixels". Use `thickness` to set the value. The 'thicknessmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['fraction', 'pixels'] Returns ------- Any """ return self["thicknessmode"]
[ "def", "thicknessmode", "(", "self", ")", ":", "return", "self", "[", "\"thicknessmode\"", "]" ]
[ 538, 4 ]
[ 552, 36 ]
python
en
['en', 'error', 'th']
False
ColorBar.tick0
(self)
Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is "log", then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is "date", it should be a date string, like date data. If the axis `type` is "category", it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears. The 'tick0' property accepts values of any type Returns ------- Any
Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is "log", then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is "date", it should be a date string, like date data. If the axis `type` is "category", it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears. The 'tick0' property accepts values of any type
def tick0(self): """ Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is "log", then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is "date", it should be a date string, like date data. If the axis `type` is "category", it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears. The 'tick0' property accepts values of any type Returns ------- Any """ return self["tick0"]
[ "def", "tick0", "(", "self", ")", ":", "return", "self", "[", "\"tick0\"", "]" ]
[ 561, 4 ]
[ 579, 28 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickangle
(self)
Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically. The 'tickangle' property is a angle (in degrees) that may be specified as a number between -180 and 180. Numeric values outside this range are converted to the equivalent value (e.g. 270 is converted to -90). Returns ------- int|float
Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically. The 'tickangle' property is a angle (in degrees) that may be specified as a number between -180 and 180. Numeric values outside this range are converted to the equivalent value (e.g. 270 is converted to -90).
def tickangle(self): """ Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically. The 'tickangle' property is a angle (in degrees) that may be specified as a number between -180 and 180. Numeric values outside this range are converted to the equivalent value (e.g. 270 is converted to -90). Returns ------- int|float """ return self["tickangle"]
[ "def", "tickangle", "(", "self", ")", ":", "return", "self", "[", "\"tickangle\"", "]" ]
[ 588, 4 ]
[ 603, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickcolor
(self)
Sets the tick color. The 'tickcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str
Sets the tick color. The 'tickcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
def tickcolor(self): """ Sets the tick color. The 'tickcolor' 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: aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen Returns ------- str """ return self["tickcolor"]
[ "def", "tickcolor", "(", "self", ")", ":", "return", "self", "[", "\"tickcolor\"", "]" ]
[ 612, 4 ]
[ 662, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickfont
(self)
Sets the color bar's tick label font The 'tickfont' property is an instance of Tickfont that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickfont` - A dict of string/value properties that will be passed to the Tickfont constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size Returns ------- plotly.graph_objs.histogram2d.colorbar.Tickfont
Sets the color bar's tick label font The 'tickfont' property is an instance of Tickfont that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickfont` - A dict of string/value properties that will be passed to the Tickfont constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size
def tickfont(self): """ Sets the color bar's tick label font The 'tickfont' property is an instance of Tickfont that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickfont` - A dict of string/value properties that will be passed to the Tickfont constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size Returns ------- plotly.graph_objs.histogram2d.colorbar.Tickfont """ return self["tickfont"]
[ "def", "tickfont", "(", "self", ")", ":", "return", "self", "[", "\"tickfont\"", "]" ]
[ 671, 4 ]
[ 708, 31 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickformat
(self)
Sets the tick label formatting rule using d3 formatting mini- languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format And for dates see: https://github.com/d3/d3-3.x-api- reference/blob/master/Time-Formatting.md#format We add one item to d3's date formatter: "%{n}f" for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" The 'tickformat' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
Sets the tick label formatting rule using d3 formatting mini- languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format And for dates see: https://github.com/d3/d3-3.x-api- reference/blob/master/Time-Formatting.md#format We add one item to d3's date formatter: "%{n}f" for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" The 'tickformat' property is a string and must be specified as: - A string - A number that will be converted to a string
def tickformat(self): """ Sets the tick label formatting rule using d3 formatting mini- languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api- reference/blob/master/Formatting.md#d3_format And for dates see: https://github.com/d3/d3-3.x-api- reference/blob/master/Time-Formatting.md#format We add one item to d3's date formatter: "%{n}f" for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat "%H~%M~%S.%2f" would display "09~15~23.46" The 'tickformat' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str """ return self["tickformat"]
[ "def", "tickformat", "(", "self", ")", ":", "return", "self", "[", "\"tickformat\"", "]" ]
[ 717, 4 ]
[ 737, 33 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickformatstops
(self)
The 'tickformatstops' property is a tuple of instances of Tickformatstop that may be specified as: - A list or tuple of instances of plotly.graph_objs.histogram2d.colorbar.Tickformatstop - A list or tuple of dicts of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties: dtickrange range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" enabled Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. name When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template. templateitemname Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`. value string - dtickformat for described zoom level, the same as "tickformat" Returns ------- tuple[plotly.graph_objs.histogram2d.colorbar.Tickformatstop]
The 'tickformatstops' property is a tuple of instances of Tickformatstop that may be specified as: - A list or tuple of instances of plotly.graph_objs.histogram2d.colorbar.Tickformatstop - A list or tuple of dicts of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties: dtickrange range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" enabled Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. name When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template. templateitemname Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`. value string - dtickformat for described zoom level, the same as "tickformat"
def tickformatstops(self): """ The 'tickformatstops' property is a tuple of instances of Tickformatstop that may be specified as: - A list or tuple of instances of plotly.graph_objs.histogram2d.colorbar.Tickformatstop - A list or tuple of dicts of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties: dtickrange range [*min*, *max*], where "min", "max" - dtick values which describe some zoom level, it is possible to omit "min" or "max" value by passing "null" enabled Determines whether or not this stop is used. If `false`, this stop is ignored even within its `dtickrange`. name When used in a template, named items are created in the output figure in addition to any items the figure already has in this array. You can modify these items in the output figure by making your own item with `templateitemname` matching this `name` alongside your modifications (including `visible: false` or `enabled: false` to hide it). Has no effect outside of a template. templateitemname Used to refer to a named item in this array in the template. Named items from the template will be created even without a matching item in the input figure, but you can modify one by making an item with `templateitemname` matching its `name`, alongside your modifications (including `visible: false` or `enabled: false` to hide it). If there is no template or no matching item, this item will be hidden unless you explicitly show it with `visible: true`. value string - dtickformat for described zoom level, the same as "tickformat" Returns ------- tuple[plotly.graph_objs.histogram2d.colorbar.Tickformatstop] """ return self["tickformatstops"]
[ "def", "tickformatstops", "(", "self", ")", ":", "return", "self", "[", "\"tickformatstops\"", "]" ]
[ 746, 4 ]
[ 794, 38 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickformatstopdefaults
(self)
When used in a template (as layout.template.data.histogram2d.co lorbar.tickformatstopdefaults), sets the default property values to use for elements of histogram2d.colorbar.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickformatstop that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickformatstop` - A dict of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties: Returns ------- plotly.graph_objs.histogram2d.colorbar.Tickformatstop
When used in a template (as layout.template.data.histogram2d.co lorbar.tickformatstopdefaults), sets the default property values to use for elements of histogram2d.colorbar.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickformatstop that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickformatstop` - A dict of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties:
def tickformatstopdefaults(self): """ When used in a template (as layout.template.data.histogram2d.co lorbar.tickformatstopdefaults), sets the default property values to use for elements of histogram2d.colorbar.tickformatstops The 'tickformatstopdefaults' property is an instance of Tickformatstop that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Tickformatstop` - A dict of string/value properties that will be passed to the Tickformatstop constructor Supported dict properties: Returns ------- plotly.graph_objs.histogram2d.colorbar.Tickformatstop """ return self["tickformatstopdefaults"]
[ "def", "tickformatstopdefaults", "(", "self", ")", ":", "return", "self", "[", "\"tickformatstopdefaults\"", "]" ]
[ 803, 4 ]
[ 822, 45 ]
python
en
['en', 'error', 'th']
False
ColorBar.ticklen
(self)
Sets the tick length (in px). The 'ticklen' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the tick length (in px). The 'ticklen' property is a number and may be specified as: - An int or float in the interval [0, inf]
def ticklen(self): """ Sets the tick length (in px). The 'ticklen' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["ticklen"]
[ "def", "ticklen", "(", "self", ")", ":", "return", "self", "[", "\"ticklen\"", "]" ]
[ 831, 4 ]
[ 842, 30 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickmode
(self)
Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. ("array" is the default value if `tickvals` is provided). The 'tickmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['auto', 'linear', 'array'] Returns ------- Any
Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. ("array" is the default value if `tickvals` is provided). The 'tickmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['auto', 'linear', 'array']
def tickmode(self): """ Sets the tick mode for this axis. If "auto", the number of ticks is set via `nticks`. If "linear", the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` ("linear" is the default value if `tick0` and `dtick` are provided). If "array", the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. ("array" is the default value if `tickvals` is provided). The 'tickmode' property is an enumeration that may be specified as: - One of the following enumeration values: ['auto', 'linear', 'array'] Returns ------- Any """ return self["tickmode"]
[ "def", "tickmode", "(", "self", ")", ":", "return", "self", "[", "\"tickmode\"", "]" ]
[ 851, 4 ]
[ 869, 31 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickprefix
(self)
Sets a tick label prefix. The 'tickprefix' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
Sets a tick label prefix. The 'tickprefix' property is a string and must be specified as: - A string - A number that will be converted to a string
def tickprefix(self): """ Sets a tick label prefix. The 'tickprefix' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str """ return self["tickprefix"]
[ "def", "tickprefix", "(", "self", ")", ":", "return", "self", "[", "\"tickprefix\"", "]" ]
[ 878, 4 ]
[ 890, 33 ]
python
en
['en', 'error', 'th']
False
ColorBar.ticks
(self)
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ['outside', 'inside', ''] Returns ------- Any
Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ['outside', 'inside', '']
def ticks(self): """ Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. If "outside" ("inside"), this axis' are drawn outside (inside) the axis lines. The 'ticks' property is an enumeration that may be specified as: - One of the following enumeration values: ['outside', 'inside', ''] Returns ------- Any """ return self["ticks"]
[ "def", "ticks", "(", "self", ")", ":", "return", "self", "[", "\"ticks\"", "]" ]
[ 899, 4 ]
[ 913, 28 ]
python
en
['en', 'error', 'th']
False
ColorBar.ticksuffix
(self)
Sets a tick label suffix. The 'ticksuffix' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str
Sets a tick label suffix. The 'ticksuffix' property is a string and must be specified as: - A string - A number that will be converted to a string
def ticksuffix(self): """ Sets a tick label suffix. The 'ticksuffix' property is a string and must be specified as: - A string - A number that will be converted to a string Returns ------- str """ return self["ticksuffix"]
[ "def", "ticksuffix", "(", "self", ")", ":", "return", "self", "[", "\"ticksuffix\"", "]" ]
[ 922, 4 ]
[ 934, 33 ]
python
en
['en', 'error', 'th']
False
ColorBar.ticktext
(self)
Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to "array". Used with `tickvals`. The 'ticktext' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- numpy.ndarray
Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to "array". Used with `tickvals`. The 'ticktext' property is an array that may be specified as a tuple, list, numpy array, or pandas Series
def ticktext(self): """ Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to "array". Used with `tickvals`. The 'ticktext' property is an array that may be specified as a tuple, list, numpy array, or pandas Series Returns ------- numpy.ndarray """ return self["ticktext"]
[ "def", "ticktext", "(", "self", ")", ":", "return", "self", "[", "\"ticktext\"", "]" ]
[ 943, 4 ]
[ 956, 31 ]
python
en
['en', 'error', 'th']
False
ColorBar.ticktextsrc
(self)
Sets the source reference on Chart Studio Cloud for ticktext . The 'ticktextsrc' 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 ticktext . The 'ticktextsrc' property must be specified as a string or as a plotly.grid_objs.Column object
def ticktextsrc(self): """ Sets the source reference on Chart Studio Cloud for ticktext . The 'ticktextsrc' property must be specified as a string or as a plotly.grid_objs.Column object Returns ------- str """ return self["ticktextsrc"]
[ "def", "ticktextsrc", "(", "self", ")", ":", "return", "self", "[", "\"ticktextsrc\"", "]" ]
[ 965, 4 ]
[ 976, 34 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickvals
(self)
Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to "array". Used with `ticktext`. 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. Only has an effect if `tickmode` is set to "array". Used with `ticktext`. 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. Only has an effect if `tickmode` is set to "array". Used with `ticktext`. 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\"", "]" ]
[ 985, 4 ]
[ 997, 31 ]
python
en
['en', 'error', 'th']
False
ColorBar.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\"", "]" ]
[ 1006, 4 ]
[ 1017, 34 ]
python
en
['en', 'error', 'th']
False
ColorBar.tickwidth
(self)
Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf]
def tickwidth(self): """ Sets the tick width (in px). The 'tickwidth' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["tickwidth"]
[ "def", "tickwidth", "(", "self", ")", ":", "return", "self", "[", "\"tickwidth\"", "]" ]
[ 1026, 4 ]
[ 1037, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.title
(self)
The 'title' property is an instance of Title that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Title` - A dict of string/value properties that will be passed to the Title constructor Supported dict properties: font Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. side 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. text 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. Returns ------- plotly.graph_objs.histogram2d.colorbar.Title
The 'title' property is an instance of Title that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Title` - A dict of string/value properties that will be passed to the Title constructor Supported dict properties: font Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. side 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. text 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.
def title(self): """ The 'title' property is an instance of Title that may be specified as: - An instance of :class:`plotly.graph_objs.histogram2d.colorbar.Title` - A dict of string/value properties that will be passed to the Title constructor Supported dict properties: font Sets this color bar's title font. Note that the title's font used to be set by the now deprecated `titlefont` attribute. side 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. text 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. Returns ------- plotly.graph_objs.histogram2d.colorbar.Title """ return self["title"]
[ "def", "title", "(", "self", ")", ":", "return", "self", "[", "\"title\"", "]" ]
[ 1046, 4 ]
[ 1076, 28 ]
python
en
['en', 'error', 'th']
False
ColorBar.titlefont
(self)
Deprecated: Please use histogram2d.colorbar.title.font instead. 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.histogram2d.colorbar.title.Font` - A dict of string/value properties that will be passed to the Font constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size Returns -------
Deprecated: Please use histogram2d.colorbar.title.font instead. 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.histogram2d.colorbar.title.Font` - A dict of string/value properties that will be passed to the Font constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size
def titlefont(self): """ Deprecated: Please use histogram2d.colorbar.title.font instead. 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.histogram2d.colorbar.title.Font` - A dict of string/value properties that will be passed to the Font constructor Supported dict properties: color family 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 if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include "Arial", "Balto", "Courier New", "Droid Sans",, "Droid Serif", "Droid Sans Mono", "Gravitas One", "Old Standard TT", "Open Sans", "Overpass", "PT Sans Narrow", "Raleway", "Times New Roman". size Returns ------- """ return self["titlefont"]
[ "def", "titlefont", "(", "self", ")", ":", "return", "self", "[", "\"titlefont\"", "]" ]
[ 1085, 4 ]
[ 1124, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.titleside
(self)
Deprecated: Please use histogram2d.colorbar.title.side instead. 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: ['right', 'top', 'bottom'] Returns -------
Deprecated: Please use histogram2d.colorbar.title.side instead. 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: ['right', 'top', 'bottom']
def titleside(self): """ Deprecated: Please use histogram2d.colorbar.title.side instead. 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: ['right', 'top', 'bottom'] Returns ------- """ return self["titleside"]
[ "def", "titleside", "(", "self", ")", ":", "return", "self", "[", "\"titleside\"", "]" ]
[ 1133, 4 ]
[ 1148, 32 ]
python
en
['en', 'error', 'th']
False
ColorBar.x
(self)
Sets the x position of the color bar (in plot fraction). The 'x' property is a number and may be specified as: - An int or float in the interval [-2, 3] Returns ------- int|float
Sets the x position of the color bar (in plot fraction). The 'x' property is a number and may be specified as: - An int or float in the interval [-2, 3]
def x(self): """ Sets the x position of the color bar (in plot fraction). The 'x' property is a number and may be specified as: - An int or float in the interval [-2, 3] Returns ------- int|float """ return self["x"]
[ "def", "x", "(", "self", ")", ":", "return", "self", "[", "\"x\"", "]" ]
[ 1157, 4 ]
[ 1168, 24 ]
python
en
['en', 'error', 'th']
False
ColorBar.xanchor
(self)
Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the color bar. The 'xanchor' property is an enumeration that may be specified as: - One of the following enumeration values: ['left', 'center', 'right'] Returns ------- Any
Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the color bar. The 'xanchor' property is an enumeration that may be specified as: - One of the following enumeration values: ['left', 'center', 'right']
def xanchor(self): """ Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the "left", "center" or "right" of the color bar. The 'xanchor' property is an enumeration that may be specified as: - One of the following enumeration values: ['left', 'center', 'right'] Returns ------- Any """ return self["xanchor"]
[ "def", "xanchor", "(", "self", ")", ":", "return", "self", "[", "\"xanchor\"", "]" ]
[ 1177, 4 ]
[ 1191, 30 ]
python
en
['en', 'error', 'th']
False
ColorBar.xpad
(self)
Sets the amount of padding (in px) along the x direction. The 'xpad' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float
Sets the amount of padding (in px) along the x direction. The 'xpad' property is a number and may be specified as: - An int or float in the interval [0, inf]
def xpad(self): """ Sets the amount of padding (in px) along the x direction. The 'xpad' property is a number and may be specified as: - An int or float in the interval [0, inf] Returns ------- int|float """ return self["xpad"]
[ "def", "xpad", "(", "self", ")", ":", "return", "self", "[", "\"xpad\"", "]" ]
[ 1200, 4 ]
[ 1211, 27 ]
python
en
['en', 'error', 'th']
False
ColorBar.y
(self)
Sets the y position of the color bar (in plot fraction). The 'y' property is a number and may be specified as: - An int or float in the interval [-2, 3] Returns ------- int|float
Sets the y position of the color bar (in plot fraction). The 'y' property is a number and may be specified as: - An int or float in the interval [-2, 3]
def y(self): """ Sets the y position of the color bar (in plot fraction). The 'y' property is a number and may be specified as: - An int or float in the interval [-2, 3] Returns ------- int|float """ return self["y"]
[ "def", "y", "(", "self", ")", ":", "return", "self", "[", "\"y\"", "]" ]
[ 1220, 4 ]
[ 1231, 24 ]
python
en
['en', 'error', 'th']
False