
    Je              	       x    d Z ddlZddlmZmZmZmZ ddlmZ ee   Z	ee	ef   Z
	 	 	 d
dedee   dee
   defd	Zy)z
Spyder API helper decorators.
    N)CallableOptionalUnionList)ConfigurationKeyfuncsectionoptionreturnc                     | t        j                  t        ||      S |d}g }t        |t              r|D cg c]  }||f }}n||fg}|| _        | S c c}w )a  
    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: Callable
        The same method that was given as input.
    )r	   r
   	__section)	functoolspartialon_conf_change
isinstancelist_conf_listen)r   r	   r
   infoopts        >/usr/lib/python3/dist-packages/spyder/api/config/decorators.pyr   r      sv    < |  GF< 	< ~ D&$*013#11&!"DK 2s   A)NNN)__doc__r   typingr   r   r   r   spyder.config.typesr   ConfigurationKeyListConfigurationKeyOrListstrr        r   <module>r      ss   
  2 2 1 ,- 35EEF  %),0>B. .$SM.#$:;.GO.r   