spyder.api.config.decorators#
Spyder API helper decorators.
Module Attributes
Type alias for a list of string/string tuple keys of Spyder config options. |
|
Type alias for either a list of config keys or a single key. |
Functions
|
Decorator to handle changing a config option in a given section. |
- spyder.api.config.decorators.ConfigurationKeyList#
Type alias for a list of string/string tuple keys of Spyder config options.
A
listofspyder.config.types.ConfigurationKeys.
- spyder.api.config.decorators.ConfigurationKeyOrList#
Type alias for either a list of config keys or a single key.
Union of types
ConfigurationKeyListandspyder.config.types.ConfigurationKey.
- spyder.api.config.decorators.on_conf_change(func: Callable | None = None, section: str | None = None, option: ConfigurationKeyOrList | None = None) Callable[source]#
Decorator to handle changing a config option in a given section.
The methods that use this decorator must have the signature
def method(self, value: Any): ...
when observing a single value or the whole section, and
def method(self, option: ConfigurationKeyOrList | None, value: Any): ...
when observing multiple values.
- Parameters:
func (Callable | None, optional) – Method to decorate, passed automatically when applying the decorator.
section (str | None, optional) – Name of the configuration section to observe for changes. If
None, then theCONF_SECTIONattribute of the class where the method defined is used.option (ConfigurationKeyOrList | None, optional) – Name (
str/tupleofstr) of the option to observe, or a list of names if the method expects updates from multiple keys. IfNone, then all changes to options in the specified section are observed.
- Returns:
func – The method passed as
funcwith the config listener set up.- Return type:
Callable