
    qi                    \    d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 erddl
mZ  G d d      Zy	)
a  
Markdown accepts an [`Extension`][markdown.extensions.Extension] instance for each extension. Therefore, each extension
must to define a class that extends [`Extension`][markdown.extensions.Extension] and over-rides the
[`extendMarkdown`][markdown.extensions.Extension.extendMarkdown] method. Within this class one can manage configuration
options for their extension and attach the various processors and patterns which make up an extension to the
[`Markdown`][markdown.Markdown] instance.
    )annotations)TYPE_CHECKINGAnyIterableMapping   )parseBoolValue)Markdownc                  Z    e Zd ZU dZi Zded<   	 d ZdddZddZddZ	ddZ
dd	Zdd
Zy)	Extensionz( Base class for extensions to subclass. zMapping[str, list]configc                &    | j                  |       y)z( Initiate Extension and set up configs. N)
setConfigs)selfkwargss     N/opt/pipecat/venv/lib/python3.12/site-packages/markdown/extensions/__init__.py__init__zExtension.__init__8   s        c                F    || j                   v r| j                   |   d   S |S )a  
        Return a single configuration option value.

        Arguments:
            key: The configuration option name.
            default: Default value to return if key is not set.

        Returns:
            Value of stored configuration option.
        r   )r   )r   keydefaults      r   	getConfigzExtension.getConfig<   s)     $++;;s#A&&Nr   c                |    | j                   j                         D ci c]  }|| j                  |       c}S c c}w )zl
        Return all configuration options.

        Returns:
            All configuration options.
        )r   keysr   r   r   s     r   
getConfigszExtension.getConfigsL   s3     59KK4D4D4FGST^^C((GGGs   9c                    | j                   j                         D cg c]  }|| j                   |   d   f c}S c c}w )z
        Return descriptions of all configuration options.

        Returns:
            All descriptions of configuration options.
           )r   r   r   s     r   getConfigInfozExtension.getConfigInfoU   s8     7;kk6F6F6HIsdkk#&q)*IIIs   ;c                    t        | j                  |   d   t              rt        |      }| j                  |   d   t        |d      }|| j                  |   d<   y)a  
        Set a configuration option.

        If the corresponding default value set in [`config`][markdown.extensions.Extension.config]
        is a `bool` value or `None`, then `value` is passed through
        [`parseBoolValue`][markdown.util.parseBoolValue] before being stored.

        Arguments:
            key: Name of configuration option to set.
            value: Value to assign to option.

        Raises:
            KeyError: If `key` is not known.
        r   NT)preserve_none)
isinstancer   boolr	   )r   r   values      r   	setConfigzExtension.setConfig^   sY     dkk#&q)40"5)E;;sA&"5=E#Cr   c                t    t        |d      r|j                         }|D ]  \  }}| j                  ||        y)a  
        Loop through a collection of configuration options, passing each to
        [`setConfig`][markdown.extensions.Extension.setConfig].

        Arguments:
            items: Collection of configuration options.

        Raises:
            KeyError: for any unknown key.
        itemsN)hasattrr'   r%   )r   r'   r   r$   s       r   r   zExtension.setConfigss   s:     5'"KKME 	'JCNN3&	'r   c                v    t        d| j                  j                  d| j                  j                  d      )z
        Add the various processors and patterns to the Markdown Instance.

        This method must be overridden by every extension.

        Arguments:
            md: The Markdown instance.

        zExtension ".z(" must define an "extendMarkdown"method.)NotImplementedError	__class__
__module____name__)r   mds     r   extendMarkdownzExtension.extendMarkdown   s0     "22DNN4K4KM
 	
r   N) )r   strr   r   returnr   )r3   zdict[str, Any])r3   zlist[tuple[str, str]])r   r2   r$   r   r3   None)r'   z-Mapping[str, Any] | Iterable[tuple[str, Any]]r3   r4   )r/   r
   r3   r4   )r.   r-   __qualname____doc__r   __annotations__r   r   r   r   r%   r   r0    r   r   r   r   %   s:    2!#F#  HJ$*'"
r   r   N)r6   
__future__r   typingr   r   r   r   utilr	   markdownr
   r   r8   r   r   <module>r=      s*   ( # 8 8 !!l
 l
r   