spyder.api.config.decorators

Contents

spyder.api.config.decorators#

Spyder API helper decorators.

Functions

on_conf_change([func, section, option])

Method decorator used to handle changes on the configuration option option of the section section.

spyder.api.config.decorators.on_conf_change(func: Callable = None, section: str | None = None, option: List[str | Tuple[str, ...]] | str | Tuple[str, ...] | None = None) Callable[source]#

Method decorator used to handle changes on the configuration option option of the section section.

The methods that use this decorator must have the following signature def method(self, value) when observing a single value or the whole section and def method(self, option, value): … when observing multiple values.

Parameters:
  • func (Callable) – Method to decorate. Given by default when applying the decorator.

  • section (Optional[str]) – Name of the configuration whose option is going to be observed for changes. If None, then the CONF_SECTION attribute of the class where the method is defined is used.

  • option (Optional[ConfigurationKeyOrList]) – Name/tuple of the option to observe or a list of name/tuples if the method expects updates from multiple keys. If None, then all changes on the specified section are observed.

Returns:

func – The same method that was given as input.

Return type:

Callable