
    ˆhX                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r
Jr  SSKJr  SSKJr  SSKJrJrJrJ	r	JrJrJrJrJrJrJrJrJrJrJr  SSKJr  \R@                  S	:  a  \\!\\!   4   r"O\\!\4   r"\" S
\"S9r# \RH                  \RJ                  4 V s/ s H   n U (       d  M  U \RH                  :w  d  M  U PM"     sn r& 0 r' S\RP                  S\!4S jr)S\\\*\4      S\!S\\\+   \\*   4   4S jr, S8S\\   S\\!   S\\+   S\\!S4   4S jjr-S\\   S\\\*\4      4S jr.S\S\+4S jr/  S9S\"S\\\0/S4      S\\+   S\S   4S jjr1S\!S\!S \\!\!4   S\\0/S4   S\+S\S   4S! jr2  S9S\"S\\\0/S4      S\\+   S\\!   4S" jjr3S9S# jr4S$\!S\\/\4   4S% jr5S\\   S\!S\+4S& jr6S\\   S\\!   S\\!   4S' jr7 S8S\"S(\\	\!      S\!4S) jjr8 S8S\\"   S(\\	\!      S\\!\\"   4   4S* jjr9 S8S$\!S+\\/\4   S,\\+   SS4S- jjr: " S. S/\;5      r< " S0 S1\;5      r=\" S2S39 " S4 S5\\#   5      5       r> " S6 S\?5      r@ " S7 S\?5      rAgs  sn f ):zC
This module provides utility methods for dealing with path-specs.
    N)
CollectionIterable)	dataclass)PathLike)AnyAnyStrCallabler   DictGenericr   IteratorListOptionalSequenceSetTupleTypeVarUnion   )Pattern)   	   TStrPath)boundpathreturnc                 l    [        U 5      nU R                  5       (       a  U[        R                  -  nU$ )a.  
Appends the path separator to the path if the path is a directory.
This can be used to aid in distinguishing between directories and
files on the file-system by relying on the presence of a trailing path
separator.

*path* (:class:`pathlib.Path`) is the path to use.

Returns the path (:class:`str`).
)stris_dirossep)r   str_paths     E/opt/services/DDDS/venv/lib/python3.13/site-packages/pathspec/util.pyappend_dir_sepr#   D   s+     IKKMM
bff(    patternsfilec                     SnSnU  H6  u  pEUR                   c  M  UR                  U5      c  M(  UR                   nUnM8     X#4$ )a  
Check the file against the patterns.

*patterns* (:class:`~collections.abc.Iterable`) yields each indexed pattern
(:class:`tuple`) which contains the pattern index (:class:`int`) and actual
pattern (:class:`~pathspec.pattern.Pattern`).

*file* (:class:`str`) is the normalized file path to be matched
against *patterns*.

Returns a :class:`tuple` containing whether to include *file* (:class:`bool`
or :data:`None`), and the index of the last matched pattern (:class:`int` or
:data:`None`).
Ninclude
match_file)r%   r&   out_include	out_indexindexpatterns         r"   check_match_filer/   V   sM    $  $ ^U__ W%7%7%=%I;9  
 	r$   filesall_matchesMatchDetailc                    [        U[        5      (       a  UO
[        U5      n0 nU  H  nUR                  c  M  UR	                  U5      nUR                  (       aW  U HO  nXt;   a9  U(       a  XG   R
                  R                  U5        M.  XTU   R
                  S'   MA  [        U/5      XG'   MQ     M  U H  nXH	 M     M     U$ )a  
Matches the files to the patterns, and returns which patterns matched
the files.

*patterns* (:class:`~collections.abc.Iterable` of :class:`~pathspec.pattern.Pattern`)
contains the patterns to use.

*files* (:class:`~collections.abc.Iterable` of :class:`str`) contains
the normalized file paths to be matched against *patterns*.

*all_matches* (:class:`bool` or :data:`None`) is whether to return all
matches patterns (:data:`True`), or only the last matched pattern
(:data:`False`). Default is :data:`None` for :data:`False`.

Returns the matched files (:class:`dict`) which maps each matched file
(:class:`str`) to the patterns that matched in order (:class:`.MatchDetail`).
r   )
isinstanceCollectionTypelistr)   matchr%   appendr2   )	r%   r0   r1   	all_filesreturn_filesr.   result_filesresult_filer&   s	            r"   detailed_match_filesr=   r   s    , !77UT%[W__ --	*<oo##	 ))009/6K ))!,"-wi"8l $ 		 ! & 	r$   c                 n    [        U 5       VVs/ s H  u  pUR                  c  M  X4PM     snn$ s  snnf )a  
Filters out null-patterns.

*patterns* (:class:`Iterable` of :class:`.Pattern`) contains the
patterns.

Returns a :class:`list` containing each indexed pattern (:class:`tuple`) which
contains the pattern index (:class:`int`) and the actual pattern
(:class:`~pathspec.pattern.Pattern`).
)	enumerater)   )r%   __index__pats      r"   _filter_check_patternsrB      s<     "(+	+ng
]] 7+	  	s   11valuec                 f    [        U [        5      =(       a    [        U [        [        45      (       + $ )z
Check whether the value is an iterable (excludes strings).

*value* is the value to check,

Returns whether *value* is a iterable (:class:`bool`).
)r4   IterableTyper   bytes)rC   s    r"   _is_iterablerG      s$     	5,'O
53,0O,OOr$   rooton_errorfollow_links	TreeEntryc              #      #    Ub   [        U5      (       d  [        SU< S35      eUc  Sn[        [        R                  R                  U 5      S0 X5       Sh  vN   g N7f)a   
Walks the specified directory for all files and directories.

*root* (:class:`str` or :class:`os.PathLike`) is the root directory to
search.

*on_error* (:class:`~collections.abc.Callable` or :data:`None`)
optionally is the error handler for file-system exceptions. It will be
called with the exception (:exc:`OSError`). Reraise the exception to
abort the walk. Default is :data:`None` to ignore file-system
exceptions.

*follow_links* (:class:`bool` or :data:`None`) optionally is whether
to walk symbolic links that resolve to directories. Default is
:data:`None` for :data:`True`.

Raises :exc:`RecursionError` if recursion is detected.

Returns an :class:`~collections.abc.Iterator` yielding each file or
directory entry (:class:`.TreeEntry`) relative to *root*.
Nz	on_error: is not callable.T )callable	TypeError_iter_tree_entries_nextr   r   abspathrH   rI   rJ   s      r"   iter_tree_entriesrT      sX     4 (!3!3Ih\):;<<,#BGGOOD$92r8ZZZs   AA!AA!	root_fulldir_relmemoc           	   #     #    [         R                  R                  X5      n[         R                  R                  U5      nXb;  a  XU'   O[	        XbU   US9e[         R
                  " U5       nU H  n[         R                  R                  XR                  5      n	 UR                  SS9n
UR                  5       (       a   UR                  5       nOU
nUR                  US9(       a0  [        UR                  XU5      v   [        X	X#U5       Sh  vN   M  UR                  5       (       d  UR                  5       (       d  M  [        UR                  XU5      v   M     SSS5        X&	 g! [         a  nUb  U" U5         SnAGM  SnAff = f! [         a  nUb  U" U5         SnAGM=  SnAff = f N! , (       d  f       N[= f7f)ad  
Scan the directory for all descendant files.

*root_full* (:class:`str`) the absolute path to the root directory.

*dir_rel* (:class:`str`) the path to the directory to scan relative to
*root_full*.

*memo* (:class:`dict`) keeps track of ancestor directories
encountered. Maps each ancestor real path (:class:`str`) to relative
path (:class:`str`).

*on_error* (:class:`~collections.abc.Callable` or :data:`None`)
optionally is the error handler for file-system exceptions.

*follow_links* (:class:`bool`) is whether to walk symbolic links that
resolve to directories.

Yields each entry (:class:`.TreeEntry`).
)	real_path
first_pathsecond_pathF)follow_symlinksN)r   r   joinrealpathRecursionErrorscandirnamestatOSError
is_symlinkr   rK   rQ   is_file)rU   rV   rW   rI   rJ   dir_fulldir_real	scan_iternode_entnode_rel
node_lstate	node_stats                r"   rQ   rQ      s}    6 GGLL,GGX&
 x.8nRYZZjjihggll7MM28u5J Y Ioolo3 HMM8
CC&yDLYYYh1133
HMM8
CC?  P 
^A  a[  qk Z; s   A,G	./F8E.-F8FA F8F6.F8F8#G	.
F8F
F8
FF8
F3F.'F8.F33F88
GG	c              #   z   #    [        XUS9 H)  nUR                  U5      (       a  M  UR                  v   M+     g7f)a  
Walks the specified directory for all files.

*root* (:class:`str` or :class:`os.PathLike`) is the root directory to
search for files.

*on_error* (:class:`~collections.abc.Callable` or :data:`None`)
optionally is the error handler for file-system exceptions. It will be
called with the exception (:exc:`OSError`). Reraise the exception to
abort the walk. Default is :data:`None` to ignore file-system
exceptions.

*follow_links* (:class:`bool` or :data:`None`) optionally is whether
to walk symbolic links that resolve to directories. Default is
:data:`None` for :data:`True`.

Raises :exc:`RecursionError` if recursion is detected.

Returns an :class:`~collections.abc.Iterator` yielding the path to
each file (:class:`str`) relative to *root*.
rI   rJ   N)rT   r   r   )rH   rI   rJ   entrys       r"   iter_tree_filesrq   3  s2     4  lSU	l	#	#	 Ts   ";;c                 J    [         R                  " S[        SS9  [        XUS9$ )zd
DEPRECATED: The :func:`.iter_tree` function is an alias for the
:func:`.iter_tree_files` function.
zCutil.iter_tree() is deprecated. Use util.iter_tree_files() instead.   
stacklevelro   )warningswarnDeprecationWarningrq   rS   s      r"   	iter_treery   R  s'    
 
G1& 	lKKr$   ra   c                     [         U    $ )z
Lookups a registered pattern factory by name.

*name* (:class:`str`) is the name of the pattern factory.

Returns the registered pattern factory (:class:`~collections.abc.Callable`).
If no pattern factory is registered, raises :exc:`KeyError`.
)_registered_patterns)ra   s    r"   lookup_patternr|   ]  s     	T""r$   c                 z    SnU  H2  nUR                   c  M  UR                  U5      c  M&  UR                   nM4     U$ )a0  
Matches the file to the patterns.

*patterns* (:class:`~collections.abc.Iterable` of :class:`~pathspec.pattern.Pattern`)
contains the patterns to use.

*file* (:class:`str`) is the normalized file path to be matched
against *patterns*.

Returns :data:`True` if *file* matched; otherwise, :data:`False`.
Fr(   )r%   r&   matchedr.   s       r"   r*   r*   i  s=     W__ W%7%7%=%I__7  	r$   c                    [         R                  " [         S[         S3[        SS9  U  Vs/ s H  o"R                  c  M  UPM     nn[        5       nU H&  n[        X55      (       d  M  UR                  U5        M(     U$ s  snf )a  
DEPRECATED: This is an old function no longer used. Use the
:func:`~pathspec.util.match_file` function with a loop for better results.

Matches the files to the patterns.

*patterns* (:class:`~collections.abc.Iterable` of :class:`~pathspec.pattern.Pattern`)
contains the patterns to use.

*files* (:class:`~collections.abc.Iterable` of :class:`str`) contains
the normalized file paths to be matched against *patterns*.

Returns the matched files (:class:`set` of :class:`str`).
z".match_files() is deprecated. Use z-.match_file() with a loop for better results.rs   rt   )rv   rw   __name__rx   r)   setr*   add)r%   r0   rA   use_patternsr:   r&   s         r"   match_filesr   }  s}    $ 
J0
 ;  1&
 %-JH5HJT##D  	 Ks   BB
separatorsc                    Uc  [         n[        R                  " U 5      nU H#  nUR                  U[        R
                  5      nM%     UR                  S5      (       a  USS nU$ UR                  S5      (       a  USS nU$ )an  
Normalizes the file path to use the POSIX path separator (i.e.,
``"/"``), and make the paths relative (remove leading ``"/"``).

*file* (:class:`str` or :class:`os.PathLike`) is the file path.

*separators* (:class:`~collections.abc.Collection` of :class:`str`; or
``None``) optionally contains the path separators to normalize.
This does not need to include the POSIX path separator (``"/"``),
but including it will not affect the results. Default is ``None``
for ``NORMALIZE_PATH_SEPS``. To prevent normalization, pass an
empty container (e.g., an empty tuple ``()``).

Returns the normalized file path (:class:`str`).
N/r   z./rs   )NORMALIZE_PATH_SEPSr   fspathreplace	posixpathr    
startswith)r&   r   	norm_filer    s       r"   normalize_filer     s    ( "* ))D/SY]]3)  m) 		 4  m)r$   c                     [         R                  " S[        SS9  0 nU  H+  n[        X1S9nXB;   a  X$   R	                  U5        M&  U/X$'   M-     U$ )a  
DEPRECATED: This function is no longer used. Use the :func:`.normalize_file`
function with a loop for better results.

Normalizes the file paths to use the POSIX path separator.

*files* (:class:`~collections.abc.Iterable` of :class:`str` or
:class:`os.PathLike`) contains the file paths to be normalized.

*separators* (:class:`~collections.abc.Collection` of :class:`str`; or
:data:`None`) optionally contains the path separators to normalize.
See :func:`normalize_file` for more information.

Returns a :class:`dict` mapping each normalized file path (:class:`str`)
to the original file paths (:class:`list` of :class:`str` or
:class:`os.PathLike`).
z_util.normalize_files() is deprecated. Use util.normalize_file() with a loop for better results.rs   rt   )r   )rv   rw   rx   r   r8   )r0   r   
norm_filesr   r   s        r"   normalize_filesr     s^    * 
$1&
 TT9)% 6:  	r$   pattern_factoryoverridec                     [        U [        5      (       d  [        SU < S35      e[        U5      (       d  [        SU< S35      eU [        ;   a  U(       d  [        U [        U    5      eU[        U '   g)a:  
Registers the specified pattern factory.

*name* (:class:`str`) is the name to register the pattern factory
under.

*pattern_factory* (:class:`~collections.abc.Callable`) is used to
compile patterns. It must accept an uncompiled pattern (:class:`str`)
and return the compiled pattern (:class:`.Pattern`).

*override* (:class:`bool` or :data:`None`) optionally is whether to
allow overriding an already registered pattern under the same name
(:data:`True`), instead of raising an :exc:`AlreadyRegisteredError`
(:data:`False`). Default is :data:`None` for :data:`False`.
zname:z is not a string.zpattern_factory:rM   N)r4   r   rP   rO   r{   AlreadyRegisteredError)ra   r   r   s      r"   register_patternr     sq    ( 	4E$!2344!!$_$77HIJJ  t%9$%?@@-dr$   c                      ^  \ rS rSrSrS\S\\/\4   SS4U 4S jjr	\
S\4S j5       r\
S\4S	 j5       r\
S\\/\4   4S
 j5       rSrU =r$ )r   i  zy
The :exc:`AlreadyRegisteredError` exception is raised when a pattern
factory is registered under a name already in use.
ra   r   r   Nc                 ,   > [         [        U ]  X5        g)z
Initializes the :exc:`AlreadyRegisteredError` instance.

*name* (:class:`str`) is the name of the registered pattern.

*pattern_factory* (:class:`~collections.abc.Callable`) is the
registered pattern factory.
N)superr   __init__)selfra   r   	__class__s      r"   r   AlreadyRegisteredError.__init__  s     .tEr$   c                 J    SR                  U R                  U R                  S9$ )0
*message* (:class:`str`) is the error message.
zG{name!r} is already registered for pattern factory:{pattern_factory!r}.)ra   r   )formatra   r   r   s    r"   messageAlreadyRegisteredError.message   s.    
 
S	Y	Y		'' 
Z 
 r$   c                      U R                   S   $ )z>
*name* (:class:`str`) is the name of the registered pattern.
r   argsr   s    r"   ra   AlreadyRegisteredError.name*  s    
 
1r$   c                      U R                   S   $ )z[
*pattern_factory* (:class:`~collections.abc.Callable`) is the
registered pattern factory.
r   r   r   s    r"   r   &AlreadyRegisteredError.pattern_factory1       
1r$    )r   
__module____qualname____firstlineno____doc__r   r	   r   r   r   propertyr   ra   r   __static_attributes____classcell__r   s   @r"   r   r     s    
FF VHg-.F 	F c   3   hx'89  r$   r   c                      ^  \ rS rSrSrS\S\S\SS4U 4S jjr\S\4S	 j5       r\S\4S
 j5       r	\S\4S j5       r
\S\4S j5       rSrU =r$ )r_   i:  zK
The :exc:`RecursionError` exception is raised when recursion is
detected.
rY   rZ   r[   r   Nc                 .   > [         [        U ]  XU5        g)a  
Initializes the :exc:`RecursionError` instance.

*real_path* (:class:`str`) is the real path that recursion was
encountered on.

*first_path* (:class:`str`) is the first path encountered for
*real_path*.

*second_path* (:class:`str`) is the second path encountered for
*real_path*.
N)r   r_   r   )r   rY   rZ   r[   r   s       r"   r   RecursionError.__init__@  s    $ &ykJr$   c                      U R                   S   $ )zr
*first_path* (:class:`str`) is the first path encountered for
:attr:`self.real_path <RecursionError.real_path>`.
r   r   r   s    r"   rZ   RecursionError.first_pathT  r   r$   c                 `    SR                  U R                  U R                  U R                  S9$ )r   zDReal path {real!r} was encountered at {first!r} and then {second!r}.)realfirstsecond)r   rY   rZ   r[   r   s    r"   r   RecursionError.message\  s5    
 
P	V	V	


 
W 
 r$   c                      U R                   S   $ )zP
*real_path* (:class:`str`) is the real path that recursion was
encountered on.
r   r   r   s    r"   rY   RecursionError.real_pathg  r   r$   c                      U R                   S   $ )zt
*second_path* (:class:`str`) is the second path encountered for
:attr:`self.real_path <RecursionError.real_path>`.
rs   r   r   s    r"   r[   RecursionError.second_patho  r   r$   r   )r   r   r   r   r   r   r   r   rZ   r   rY   r[   r   r   r   s   @r"   r_   r_   :  s    
KK K 	K
 K(    c      #  r$   r_   T)frozenc                   L    \ rS rSr% SrSr\\S'    \\	   \S'    \\
   \S'   Srg)	CheckResultix  zb
The :class:`CheckResult` class contains information about the file and which
pattern matched it.
)r&   r)   r-   r&   r)   r-   r   N)r   r   r   r   r   	__slots__r   __annotations__r   boolintr   r   r$   r"   r   r   x  s<      4.
 	r$   r   c                   4    \ rS rSrSrSrS\\   SS4S jrSr	g)r2   i  z<
The :class:`.MatchDetail` class contains information about
r%   r%   r   Nc                     Xl         g)z
Initialize the :class:`.MatchDetail` instance.

*patterns* (:class:`~collections.abc.Sequence` of :class:`~pathspec.pattern.Pattern`)
contains the patterns that matched the file in the order they were
encountered.
Nr   )r   r%   s     r"   r   MatchDetail.__init__  s     -r$   )
r   r   r   r   r   r   r   r   r   r   r   r$   r"   r2   r2     s&    
 hw/ D r$   c            
           \ rS rSrSrSrS\S\S\R                  S\R                  SS	4
S
 jr	SS\
\   S\4S jjrSS\
\   S\4S jjrS\4S jrSS\
\   S\R                  4S jjrSrg	)rK   i  zO
The :class:`.TreeEntry` class contains information about a file-system
entry.
_lstatra   r   _statra   r   lstatrb   r   Nc                 :    X0l          Xl         X l         X@l        g)a@  
Initialize the :class:`.TreeEntry` instance.

*name* (:class:`str`) is the base name of the entry.

*path* (:class:`str`) is the relative path of the entry.

*lstat* (:class:`os.stat_result`) is the stat result of the direct
entry.

*stat* (:class:`os.stat_result`) is the stat result of the entry,
potentially linked.
Nr   )r   ra   r   r   rb   s        r"   r   TreeEntry.__init__  s2    * !&+
 ) )  $*r$   rJ   c                     Uc  SnU(       a  U R                   OU R                  n[        R                  " UR                  5      $ )a0  
Get whether the entry is a directory.

*follow_links* (:class:`bool` or :data:`None`) is whether to follow
symbolic links. If this is :data:`True`, a symlink to a directory
will result in :data:`True`. Default is :data:`None` for :data:`True`.

Returns whether the entry is a directory (:class:`bool`).
T)r   r   rb   S_ISDIRst_moder   rJ   rm   s      r"   r   TreeEntry.is_dir  5     <(djjdkk)	i''	((r$   c                     Uc  SnU(       a  U R                   OU R                  n[        R                  " UR                  5      $ )a9  
Get whether the entry is a regular file.

*follow_links* (:class:`bool` or :data:`None`) is whether to follow
symbolic links. If this is :data:`True`, a symlink to a regular file
will result in :data:`True`. Default is :data:`None` for :data:`True`.

Returns whether the entry is a regular file (:class:`bool`).
T)r   r   rb   S_ISREGr   r   s      r"   re   TreeEntry.is_file  r   r$   c                 V    [         R                  " U R                  R                  5      $ )z?
Returns whether the entry is a symbolic link (:class:`bool`).
)rb   S_ISLNKr   r   r   s    r"   rd   TreeEntry.is_symlink  s     
dkk))	**r$   c                 J    Uc  SnU(       a  U R                   $ U R                  $ )a-  
Get the cached stat result for the entry.

*follow_links* (:class:`bool` or :data:`None`) is whether to follow
symbolic links. If this is :data:`True`, the stat result of the
linked file will be returned. Default is :data:`None` for :data:`True`.

Returns that stat result (:class:`os.stat_result`).
T)r   r   )r   rJ   s     r"   rb   TreeEntry.stat  s$     <#44r$   )r   r   ra   r   N)r   r   r   r   r   r   r   r   stat_resultr   r   r   r   re   rd   rb   r   r   r$   r"   rK   rK     s     1)) 	) 
	)
 	) )V) )$ ) )$ )4 ) + +5htn 5 5 5r$   r   )NN)Br   r   os.pathpathlibr   rb   sysrv   collections.abcr   r5   r   rE   dataclassesr   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r.   r   version_infor   StrPathr   r    altsepr   r{   Pathr#   r   r   r/   r=   rB   rG   rc   rT   rQ   rq   ry   r|   r*   r   r   r   r   	Exceptionr   r_   r   objectr2   rK   )__seps   0r"   <module>r      s1   
     
     "
 vhsm#$h:W- vvryy!!U	 y}}$ ! 
   # $E#w,'(
 8D>8C=()>  $+G++ tn+ 
#}
	+\G	%W
(P P P 26 $ [ [HgY_-. [ ~ [ k	 [FNN
N CH~N WItO$	N
 N kNf 26 $HgY_-. ~ c]	>L	# 	#6(G*;!< 	#'* # $ (G 	XF *.%%jo&% 	%T *.""jo&" 
#tG}
"P !.
.F8W,-. D>. 
	.@,Y ,^;Y ;| $'(#  >& 2g5 g5As   I.I I