
    2yi                    T   d dl mZ d dlZd dlZd dlZd dlZd dlmZmZm	Z	 d dl
Z
d dlZd dlZd dlZd dlmZ erd dlmZ  ej$                  e      Z	 	 	 	 	 	 	 	 ddZ G d dej,                        Z G d	 d
e      Z G d de      Z G d de      Zej6                  dfddZdddZy)    )annotationsN)IOTYPE_CHECKINGAny)
exceptions)MkDocsConfig_DirPlaceholderc                X   |j                  |       |xr |j                  xs d}|j                  d      \  }}}|j                  d      rT|dk(  rt	        | |      S |dk(  rt        | |      S t        j                  d|d|j                   d|j                        t        | |      S )	N /$z$config_dirz	$docs_dirzUnknown prefix z in  )
construct_scalarvalue	partition
startswithConfigDirPlaceholderDocsDirPlaceholderr   ConfigurationErrortagRelativeDirPlaceholder)configloadernoder   prefix_suffixs          S/var/www/html/content_weaver/venv/lib/python3.12/site-packages/mkdocs/utils/yaml.py_construct_dir_placeholderr      s     D!%4::,"E,FAv]"'77{"%ff55//!&4z4::.I  &fe44    c                  .    e Zd ZdddZddZddZddZy)	r	   c                     || _         || _        y N)r   r   )selfr   r   s      r   __init__z_DirPlaceholder.__init__+   s    r    c                    t         r#   )NotImplementedErrorr$   s    r   r   z_DirPlaceholder.value/   s    !!r    c                r    t         j                  j                  | j                         | j                        S )zCan be used as a path.)ospathjoinr   r   r(   s    r   
__fspath__z_DirPlaceholder.__fspath__2   s!    ww||DJJL$++66r    c                "    | j                         S )z9Can be converted to a string to obtain the current class.)r-   r(   s    r   __str__z_DirPlaceholder.__str__6   s      r    Nr   r   r   r   strreturnr2   )__name__
__module____qualname__r%   r   r-   r/    r    r   r	   r	   *   s    "7!r    c                      e Zd ZdZddZy)r   a2  
    A placeholder object that gets resolved to the directory of the config file when used as a path.

    The suffix can be an additional sub-path that is always appended to this path.

    This is the implementation of the `!relative $config_dir/suffix` tag, but can also be passed programmatically.
    c                h    t         j                  j                  | j                  j                        S r#   )r*   r+   dirnamer   config_file_pathr(   s    r   r   zConfigDirPlaceholder.valueD   s    wwt{{;;<<r    Nr3   r5   r6   r7   __doc__r   r8   r    r   r   r   ;   s    =r    r   c                      e Zd ZdZddZy)r   a  
    A placeholder object that gets resolved to the docs dir when used as a path.

    The suffix can be an additional sub-path that is always appended to this path.

    This is the implementation of the `!relative $docs_dir/suffix` tag, but can also be passed programmatically.
    c                .    | j                   j                  S r#   )r   docs_dirr(   s    r   r   zDocsDirPlaceholder.valueQ   s    {{###r    Nr3   r=   r8   r    r   r   r   H   s    $r    r   c                  .     e Zd ZdZdd fdZddZ xZS )r   z
    A placeholder object that gets resolved to the directory of the Markdown file currently being rendered.

    This is the implementation of the `!relative` tag, but can also be passed programmatically.
    c                Z    |rt        j                  d|      t        |   ||       y )Nz4'!relative' tag does not expect any value; received )r   r   superr%   )r$   r   r   	__class__s      r   r%   zRelativeDirPlaceholder.__init__\   s4    //FvjQ  	(r    c                &   | j                   j                  }|t        j                  d      t        j
                  j                  t        j
                  j                  | j                   j                  |j                  j                              S )NzThe current file is not set for the '!relative' tag. It cannot be used in this context; the intended usage is within `markdown_extensions`.)r   _current_pager   r   r*   r+   r;   r,   rA   filesrc_path)r$   current_pages     r   r   zRelativeDirPlaceholder.valuec   sj    {{00//i  wwrww||DKK,@,@,BSBSB\B\]^^r    r0   r1   r3   )r5   r6   r7   r>   r%   r   __classcell__)rE   s   @r   r   r   U   s    )_r    r   c                     G d d|       }|j                  dt        j                         |*|j                  dt        j                  t
        |             |S )z;Wrap PyYaml's loader so we can extend it to suit our needs.c                      e Zd ZdZy)get_yaml_loader.<locals>.Loaderzu
        Define a custom loader derived from the global loader to leave the
        global loader unaltered.
        N)r5   r6   r7   r>   r8   r    r   LoaderrN   p   s    	r    rO   z!ENVz	!relative)add_constructoryaml_env_tagconstruct_env_tag	functoolspartialr   )r   r   rO   s      r   get_yaml_loaderrU   m   sP      6<#A#AB{I,=,=>XZ`,abMr    c                    |xs
 t               }	 t        j                  | |      }|i S d|v rt        | t              s|j                  d      }t        j                  j                  t        j                  j                  t        j                  j                  | j                        |            }t        j                  j                  |      st	        j
                  d| d| d      t         j#                  d|        t%        |d	      5 }t'        ||      }ddd       t)        j*                  |      }|S # t        j                  $ r}t	        j
                  d|       d}~ww xY w# 1 sw Y   TxY w)
zXReturn dict of source YAML file using loader, recursively deep merging inherited parent.)rO   z<MkDocs encountered an error parsing the configuration file: NINHERITzInherited config file 'z' does not exist at 'z'.z&Loading inherited configuration file: rb)rU   yamlload	YAMLErrorr   r   
isinstancer2   popr*   r+   normpathr,   r;   nameexistslogdebugopen	yaml_load	mergedeepmerge)sourcer   resulterelpathabspathfdparents           r   rd   rd      sE   ((F
6&1
 ~	F:fc#:**Y'''""277<<0Lg#VWww~~g&//)'2GyPRS  			:7)DE'4  	+Br6*F	+0M# >> 
++J1#N
 	

	+ 	+s#   E E4E1E,,E14E=)r   r   r   zyaml.BaseLoaderr   zyaml.ScalarNoder4   r	   )r   zMkDocsConfig | Noner#   )rg   zIO | strr   ztype[yaml.BaseLoader] | Noner4   zdict[str, Any])
__future__r   rS   loggingr*   os.pathtypingr   r   r   re   rY   yaml.constructorrQ   mkdocsr   mkdocs.config.defaultsr   	getLoggerr5   ra   r   PathLiker	   r   r   r   rO   rU   rd   r8   r    r   <module>rw      s    "   	  ) )     3g!55"159H55(!bkk !"
=? 
=
$ 
$__ _0  ;;d &r    