
    -Ph:                       d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZmZmZmZ d dlmZ ddlmZ ej        d	k     rd dlZnd d
lmZ ej        dk     rd dlZnd dlZ ej        d          Zej         G d d                      Z G d de          Zd&dZ d'dZ!d(dZ"d)dZ# e            Z$ ej%        e$j&                   d*d!Z'd+d%Z(dS ),    )annotationsN)	ExitStack)Path)AnyLiteralMappingSequence)ClickException   )fragment_types)   
   )	resources)r      z[-\w.]+:[-\w.]+$c                  &   e Zd ZU ded<   ded<   ded<   ded<   d	Zded
<   dZded<   dZded<   dZded<   dZded<   dZ	ded<   d	Z
ded<   d	Zded<   dZded<   dZded<   dZded<   dZded<   d Zded!<   dZded"<   dZded#<   dZd$ed%<   d	Zded&<   dS )'ConfigzMapping[str, str]sectionszMapping[str, Mapping[str, Any]]typeszstr | tuple[str, str]templatestrstart_string package.package_dirTboolsingle_filezNEWS.rstfilenameN
str | None	directoryversionnamezstr | Literal[False]title_formatissue_format)=-~zSequence[str]
underlinesFwrapall_bullets+orphan_prefixcreate_eof_newlinecreate_add_extensionzlist[str] | Noneignoreissue_pattern)__name__
__module____qualname____annotations__r   r   r   r   r    r!   r"   r#   r$   r(   r)   r*   r,   r-   r.   r/   r0        X/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/towncrier/_settings/load.pyr   r   $   sa        ****####GKKH I    GDNNNN)+L++++#L#### /J////DKM#####!%%%%%#F####Mr6   r   c                        e Zd Zd fdZ xZS )ConfigErrorargsr   kwargsc                h    |                     d          | _         t                      j        |  d S )Nfailing_option)getr=   super__init__)selfr:   r;   	__class__s      r7   r@   zConfigError.__init__>   s2    $jj)9::$r6   )r:   r   r;   r   )r1   r2   r3   r@   __classcell__)rB   s   @r7   r9   r9   =   s=                           r6   r9   r    r   config_pathreturntuple[str, Config]c                p   |t          |           S t          j                            |          }|  t          j                            |           }nt          j                            |          }t          j                            |          st          d| d          t          ||          }||fS )a$  
    Load the configuration from a given directory or specific configuration file.

    Unless an explicit configuration file is given, traverse back from the given
    directory looking for a configuration file.

    Returns a tuple of the base directory and the parsed Config instance.
    NzConfiguration file 'z' not found.)traverse_for_configospathabspathdirnameisfiler9   load_config_from_file)r    rD   base_directoryconfigs       r7   load_config_from_optionsrQ   C   s     "9---'//+..K 33557>>+&& LJJJJKKK">;??F6!!r6   rJ   c                
   t           j                            | pt          j                              x}}	 t	          |          }|||fS t           j                            |          }||k    rt          d|           |}O)z
    Search for a configuration file in the current directory and all parent directories.

    Returns the directory containing the configuration file and the parsed configuration.
    TNz/No configuration file found.
Looked back from: )rI   rJ   rK   getcwdload_configrL   r9   )rJ   start_directoryr    rP   parents        r7   rH   rH   a   s     #%'//$2E")++"F"FFOi
Y''f$$++YT?TT   	
r6   r   Config | Nonec                .   t           j                            | d          }t           j                            | d          }t           j                            |          r|}n$t           j                            |          r|}nd S t	          | |          S )Nztowncrier.tomlzpyproject.toml)rI   rJ   joinexistsrN   )r    towncrier_tomlpyproject_tomlconfig_files       r7   rT   rT   u   s}    W\\)-=>>NW\\)-=>>N	w~~n%% $		'	' $t K888r6   r]   c                    t          |d          5 }t          j        |          }d d d            n# 1 swxY w Y   t          | |          S )Nrb)opentomllibload
parse_toml)r    r]   conffilerP   s       r7   rN   rN      s    	k4	 	  (Hh''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( i(((s   266	base_pathrP   Mapping[str, Any]c                   d|                     d          pi vrt          dd          |d         d         }i }dD ]2\  }}|                     |          rt          d| d| d	|          3t          j        t                    D ]y}|j        d
v r|j        |v rd|j        dt          fv r?t          ||j                 t                    st          d|j         d|j                  ||j                 ||j        <   zi }d|v r+|d         D ]!}|d         ||                     dd          <   "nd|d<   ||d<   t          j
                            |          }|                                |d<   t          |                     dd                    j        dk    }	|                     dd          }
t                              |
          r||
                    dd          \  }}t          |          j        s	||	rdndz  }t%          ||          s1t%          |dz   |          r|dz  }nt          d| d| dd          ||f}
nTt&          j                            | |
          }
t&          j                            |
          st          d|
 dd          |
|d<   |                     d d          }|s|	rd!nd"}|                    d#          }||d <   t	          d$i |S )%N	towncriertoolzNo [tool.towncrier] section.all)r=   ))
singlefiler   `z'` is not a valid option. Did you mean `z`?)r   r   r   r   z(` option must be boolean: false or true.sectionrJ   r"   r   r   r   r   z.mdr   ztowncrier:default:   z.rstz
.templates'z"' does not have a template named 'z'.zThe template file 'z' does not exist.r   z<!-- {} -->
z.. {}
ztowncrier release notes startr5   )r>   r9   dataclassesfieldsr   r"   typer   
isinstanceftBaseFragmentTypesLoaderfactoryrb   r   suffixre_resource_templatematchsplit_pkg_file_existsrI   rJ   rY   rM   format)re   rP   parsed_datatypocorrectfieldr   xfragment_types_loadermarkdown_filer   r   resourcer   start_string_templates                  r7   rc   rc      s   6::f--3448OOOOF^K(FK  g ::d 	LDLLLLL#   	 #F++ 9 9:::::zfd^++!&"4d;; %PEJPPP',z    '-UZ&8K
# HF	" 	4 	4A*+F)HQUU62&&''	4 &K
 6>>vFF05577K J3344;uDMzz*&9::H!!(++ $NN322H~~$ 	;:F:H22 	, 6AA <'!OOO8OOO#-    X&7<<	844w~~h'' 	AhAAA)   
 'K
 ::nb11L U3@ Oi,334STT".K   K   r6   pkgfiler   c                t    t          j        |                               |                                          S )z3
    Check whether *file* exists within *pkg*.
    )r   filesjoinpathis_file)r   r   s     r7   r|   r|      s.     ?3((..66888r6   )r    r   rD   r   rE   rF   )rJ   r   rE   rF   )r    r   rE   rW   )r    r   r]   r   rE   r   )re   r   rP   rf   rE   r   )r   r   r   r   rE   r   ))
__future__r   atexitrq   rI   resys
contextlibr   pathlibr   typingr   r   r   r	   clickr
   	_settingsr   ru   version_infoimportlib_resourcesr   	importlibtomlira   compilery   	dataclassr   r9   rQ   rH   rT   rN   _file_managerregistercloserc   r|   r5   r6   r7   <module>r      s.   # " " " " "      				 				 



                   2 2 2 2 2 2 2 2 2 2 2 2             , , , , , , g+++++###### gNNN "rz"566         0         .      " " " "<   (9 9 9 9) ) ) ) 	 # $ $ $Q! Q! Q! Q!h9 9 9 9 9 9r6   