
    $g                    d    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d	S )
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                  \    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dS )!	Extensionz( Base class for extensions to subclass. zMapping[str, list]configc                0    |                      |           dS )z( Initiate Extension and set up configs. N)
setConfigs)selfkwargss     \/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/markdown/extensions/__init__.py__init__zExtension.__init__8   s         keystrdefaultr   returnc                >    || 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   r   r   s      r   	getConfigzExtension.getConfig<   s(     $+;s#A&&Nr   dict[str, Any]c                N      fd j                                         D             S )zl
        Return all configuration options.

        Returns:
            All configuration options.
        c                <    i | ]}|                     |          S  )r   .0r   r   s     r   
<dictcomp>z(Extension.getConfigs.<locals>.<dictcomp>S   s'    GGGST^^C((GGGr   r   keysr   s   `r   
getConfigszExtension.getConfigsL   s.     HGGGDK4D4D4F4FGGGGr   list[tuple[str, str]]c                N      fd j                                         D             S )z
        Return descriptions of all configuration options.

        Returns:
            All descriptions of configuration options.
        c                :    g | ]}|j         |         d          fS )   r   r!   s     r   
<listcomp>z+Extension.getConfigInfo.<locals>.<listcomp>\   s*    IIIsdk#&q)*IIIr   r$   r&   s   `r   getConfigInfozExtension.getConfigInfoU   s.     JIIIdk6F6F6H6HIIIIr   valueNonec                    t          | j        |         d         t                    rt          |          }| j        |         d         t          |d          }|| j        |         d<   dS )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   r.   s      r   	setConfigzExtension.setConfig^   sj     dk#&q)400 	*"5))E;sA&"5===E#Cr   items-Mapping[str, Any] | Iterable[tuple[str, Any]]c                    t          |d          r|                                }|D ]\  }}|                     ||           dS )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.
        r5   N)hasattrr5   r4   )r   r5   r   r.   s       r   r   zExtension.setConfigss   sW     5'"" 	"KKMME 	' 	'JCNN3&&&&	' 	'r   mdr
   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   r9   s     r   extendMarkdownzExtension.extendMarkdown   s:     "!222DN4K4K4KM
 
 	
r   N)r   )r   r   r   r   r   r   )r   r   )r   r(   )r   r   r.   r   r   r/   )r5   r6   r   r/   )r9   r
   r   r/   )r?   r>   __qualname____doc__r   __annotations__r   r   r'   r-   r4   r   r@   r    r   r   r   r   %   s         22!#F####          H H H HJ J J J$ $ $ $*' ' ' '"
 
 
 
 
 
r   r   N)rB   
__future__r   typingr   r   r   r   utilr	   markdownr
   r   r    r   r   <module>rH      s   (  # " " " " " 8 8 8 8 8 8 8 8 8 8 8 8 ! ! ! ! ! ! "!!!!!!l
 l
 l
 l
 l
 l
 l
 l
 l
 l
r   