
    $g                    F   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j        dfddZdd dZdS )!    )annotationsN)IOTYPE_CHECKINGAny)
exceptions)MkDocsConfigconfigr   loaderyaml.BaseLoadernodeyaml.ScalarNodereturn_DirPlaceholderc                d   |                     |           |r|j        pd}|                    d          \  }}}|                    d          rS|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)r	   r
   r   r   prefix_suffixs          Q/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/mkdocs/utils/yaml.py_construct_dir_placeholderr"      s     D!!!%4:,"E,,FAv 
5]""'777{""%ff555/I&IIII4:II   &fe444    c                  0    e Zd ZdddZddZdd	Zdd
ZdS )r   r   r	   r   r    strc                "    || _         || _        d S N)r	   r    )selfr	   r    s      r!   __init__z_DirPlaceholder.__init__+   s    r#   r   c                    t           r'   )NotImplementedErrorr(   s    r!   r   z_DirPlaceholder.value/   s    !!r#   c                p    t           j                            |                                 | j                  S )zCan be used as a path.)ospathjoinr   r    r,   s    r!   
__fspath__z_DirPlaceholder.__fspath__2   s"    w||DJJLL$+666r#   c                *    |                                  S )z9Can be converted to a string to obtain the current class.)r1   r,   s    r!   __str__z_DirPlaceholder.__str__6   s       r#   Nr   r	   r   r    r%   r   r%   )__name__
__module____qualname__r)   r   r1   r3    r#   r!   r   r   *   si            " " " "7 7 7 7! ! ! ! ! !r#   c                      e Zd ZdZddZdS )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.
    r   r%   c                T    t           j                            | j        j                  S r'   )r.   r/   dirnamer	   config_file_pathr,   s    r!   r   zConfigDirPlaceholder.valueD   s    wt{;<<<r#   Nr6   r7   r8   r9   __doc__r   r:   r#   r!   r   r   ;   s2         = = = = = =r#   r   c                      e Zd ZdZddZdS )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.
    r   r%   c                    | j         j        S r'   )r	   docs_dirr,   s    r!   r   zDocsDirPlaceholder.valueQ   s    {##r#   Nr6   r?   r:   r#   r!   r   r   H   s2         $ $ $ $ $ $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.
    r   r	   r   r    r%   c                ~    |rt          j        d|          t                                          ||           d S )Nz4'!relative' tag does not expect any value; received )r   r   superr)   )r(   r	   r    	__class__s      r!   r)   zRelativeDirPlaceholder.__init__\   sM     	/QvQQ   	(((((r#   r   c                    | j         j        }|t          j        d          t          j                            t          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=   r0   rC   filesrc_path)r(   current_pages     r!   r   zRelativeDirPlaceholder.valuec   s^    {0/i   wrw||DK,@,BSB\]]^^^r#   r4   r5   r6   )r7   r8   r9   r@   r)   r   __classcell__)rG   s   @r!   r   r   U   sh         ) ) ) ) ) ) )_ _ _ _ _ _ _ _r#   r   MkDocsConfig | Nonec                     G d d|           }|                     dt          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dS )get_yaml_loader.<locals>.Loaderzu
        Define a custom loader derived from the global loader to leave the
        global loader unaltered.
        N)r7   r8   r9   r@   r:   r#   r!   LoaderrQ   p   s        	 	 	 	r#   rR   z!ENVNz	!relative)add_constructoryaml_env_tagconstruct_env_tag	functoolspartialr"   )r
   r	   rR   s      r!   get_yaml_loaderrX   m   sw            6<#ABBB{I,=>XZ`,a,abbbMr#   sourceIO | strtype[yaml.BaseLoader] | Nonedict[str, Any]c                    |pt                      }	 t          j        | |          }n.# t          j        $ r}t	          j        d|           d}~ww xY w|i S d|v r.t          | t                    s|                    d          }t          j
                            t          j
                            t          j
                            | j                  |                    }t          j
                            |          st	          j        d| d| d          t                               d|            t%          |d	          5 }t'          ||          }ddd           n# 1 swxY w Y   t)          j        ||          }|S )
zXReturn dict of source YAML file using loader, recursively deep merging inherited parent.)rR   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)rX   yamlload	YAMLErrorr   r   
isinstancer%   popr.   r/   normpathr0   r=   nameexistslogdebugopen	yaml_load	mergedeepmerge)rY   r
   resulterelpathabspathfdparents           r!   rk   rk      s   (((F
6&111> 
 
 
+N1NN
 
 	

 ~	F:fc#:#:**Y'''""27<<0L0Lg#V#VWWw~~g&& 	/S'SSSSS   			D7DDEEE'4   	+Br6**F	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+00Ms&   ) AAAE..E25E2)r	   r   r
   r   r   r   r   r   )r	   rN   r'   )rY   rZ   r
   r[   r   r\   )
__future__r   rV   loggingr.   os.pathtypingr   r   r   rl   r`   yaml.constructorrT   mkdocsr   mkdocs.config.defaultsr   	getLoggerr7   rh   r"   PathLiker   r   r   r   rR   rX   rk   r:   r#   r!   <module>r}      s   " " " " " "      				  ) ) ) ) ) ) ) ) ) )                    4333333g!!5 5 5 5(! ! ! ! !bk ! ! !"
= 
= 
= 
= 
=? 
= 
= 
=
$ 
$ 
$ 
$ 
$ 
$ 
$ 
$_ _ _ _ __ _ _ _0  ;d     &      r#   