
    bm_                     4    d Z ddlmZmZ  G d d          ZdS )zpyls-spyder misc utillites.    )TupleDictc                   .    e Zd ZdZdefdZdedefdZdS )RegexEvaluatorz2Wrapper class around multiple regular expressions.	regex_mapc                     || _         d S )N)regexes)selfr   s     1lib/python3.11/site-packages/pyls_spyder/utils.py__init__zRegexEvaluator.__init__   s         stringreturnc                 v    d}d}| j         D ]*}| j         |         }|                    |          }||} n+||fS )aI  
        Match a string `string` against a set of regular expressions.

        The regular expressions are applied in a short-circuit fashion.

        Parameters
        ----------
        string: str
            Input string to match regexes against.

        Returns
        -------
        output: Tuple[Optional[str], Optional[re.Match]]
            A tuple containing the regex identifier that first matched the
            input, alongside the corresponding regex match object. If no regex
            did matched the input, then a tuple containing `None` is returned.
        N)r	   match)r
   r   re_matchre_rule
regex_nameregexs         r   r   zRegexEvaluator.match   s^    $ , 	 	JL,E{{6**H#$ $   r   N)	__name__
__module____qualname____doc__r   r   strr   r    r   r   r   r      sW        <<!$ ! ! ! !!C !E ! ! ! ! ! !r   r   N)r   typingr   r   r   r   r   r   <module>r      sY    " !         !  !  !  !  !  !  !  !  !  !r   