
    ˆh3                         S 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  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  \" S	S
S9r  " S S
\5      rg)zR
This module provides an object oriented interface for pattern matching of files.
    )
Collection)zip_longest)	AnyStrCallabler   IterableIteratorOptionalTypeTypeVarUnion   )util)Pattern)CheckResultStrPathTStrPath	TreeEntry_filter_check_patterns_is_iterablenormalize_fileSelfPathSpec)boundc                      \ rS rSrSrS\\   SS4S jrS\S\	4S jr
S\4S	 jrS
\SS S\4S jrS
\SS S\4S jr S#S\S\\\      S\\   4S jjr S#S\\   S\\\      S\\\      4S jjr  S$S\S\\\/S4      S\\	   S\\\      4S jjr\S\\   S\\\\/\4   4   S\\   S\4S j5       r  S#SS.S\\!   S\\\      S\\	   S\\!   4S jjjr"\#" \$RJ                  5      r&  S#S\S\\\      S\	4S jjr' S#SS.S\\   S\\\      S\\	   S\\   4S jjjr(  S$SS.S\S\\\/S4      S\\	   S\\	   S\\!   4
S  jjjr)  S$SS.S\S\\\/S4      S\\	   S\\	   S\\   4
S! jjjr*\*r+S"r,g)%r   '   za
The :class:`PathSpec` class is a wrapper around a list of compiled
:class:`.Pattern` instances.
patternsreturnNc                 P    [        U[        5      (       d  [        U5      nXl        g)z
Initializes the :class:`PathSpec` instance.

*patterns* (:class:`~collections.abc.Collection` or :class:`~collections.abc.Iterable`)
yields each compiled pattern (:class:`.Pattern`).
N)
isinstanceCollectionTypelistr   )selfr   s     I/opt/services/DDDS/venv/lib/python3.13/site-packages/pathspec/pathspec.py__init__PathSpec.__init__-   s$     
Hn	-	-8n8'/-    otherc                     [        U[        5      (       a2  [        U R                  UR                  5      n[	        S U 5       5      $ [
        $ )z
Tests the equality of this path-spec with *other* (:class:`PathSpec`)
by comparing their :attr:`~PathSpec.patterns` attributes.
c              3   .   #    U  H  u  pX:H  v   M     g 7fN ).0abs      r#   	<genexpr>"PathSpec.__eq__.<locals>.<genexpr>D   s     1afs   )r   r   r   r   allNotImplemented)r"   r'   paired_patternss      r#   __eq__PathSpec.__eq__=   s<    
 x   ??
11
11
r&   c                 ,    [        U R                  5      $ )zQ
Returns the number of compiled patterns this path-spec contains
(:class:`int`).
)lenr   )r"   s    r#   __len__PathSpec.__len__H   s    
 
T]]	r&   r"   c                     [        U[        5      (       a(  U R                  U R                  UR                  -   5      $ [        $ )zW
Combines the :attr:`Pathspec.patterns` patterns from two
:class:`PathSpec` instances.
)r   r   	__class__r   r2   r"   r'   s     r#   __add__PathSpec.__add__O   s3    
 x  
..7
88
r&   c                 z    [        U[        5      (       a!  U =R                  UR                  -  sl        U $ [        $ )zc
Adds the :attr:`Pathspec.patterns` patterns from one :class:`PathSpec`
instance to this instance.
)r   r   r   r2   r<   s     r#   __iadd__PathSpec.__iadd__Y   s.    
 x  ==ENN"=
;
r&   file
separatorsc                 ~    [        X5      nU R                  [        U R                  5      U5      u  pE[	        XU5      $ )a  
Check the files against this path-spec.

*file* (:class:`str` or :class:`os.PathLike`) is the file path to be
matched against :attr:`self.patterns <PathSpec.patterns>`.

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

Returns the file check result (:class:`~pathspec.util.CheckResult`).
)r   _match_file	enumerater   r   )r"   rB   rC   	norm_fileincludeindexs         r#   
check_filePathSpec.check_filed   s8    " T.)##Idmm$<iH.'	TE	**r&   filesc              #      #    [        U5      (       d  [        SU< S35      e[        U R                  5      nU H/  n[	        XB5      nU R                  X55      u  pg[        XFU5      v   M1     g7f)a  
Check the files against this path-spec.

*files* (:class:`~collections.abc.Iterable` of :class:`str` or
:class:`os.PathLike`) contains the file paths to be checked against
:attr:`self.patterns <PathSpec.patterns>`.

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

Returns an :class:`~collections.abc.Iterator` yielding each file check
result (:class:`~pathspec.util.CheckResult`).
files: is not an iterable.N)r   	TypeErrorr   r   r   rE   r   )r"   rL   rC   use_patterns	orig_filerG   rH   rI   s           r#   check_filesPathSpec.check_filesy   sh     & 
e			VE9$89	::'6,ii49$$\=>7	Y	// s   A,A.rooton_errorfollow_linksc              #   l   #    [         R                  " XUS9nU R                  U5       Sh  vN   g N7f)a  
Walks the specified root path for all files and checks them against this
path-spec.

*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`.

*negate* (:class:`bool` or :data:`None`) is whether to negate the match
results of the patterns. If :data:`True`, a pattern matching a file will
exclude the file rather than include it. Default is :data:`None` for
:data:`False`.

Returns an :class:`~collections.abc.Iterator` yielding each file check
result (:class:`~pathspec.util.CheckResult`).
rV   rW   N)r   iter_tree_filesrS   )r"   rU   rV   rW   rL   s        r#   check_tree_filesPathSpec.check_tree_files   s-     < 

t\
R%e$$$s   *424clspattern_factorylinesc                 2   [        U[        5      (       a  [        R                  " U5      n[	        U5      (       d  [        SU< S35      e[        U5      (       d  [        SU< S35      eU Vs/ s H  o3(       d  M  U" U5      PM     nnU " U5      $ s  snf )aS  
Compiles the pattern lines.

*pattern_factory* can be either the name of a registered pattern factory
(:class:`str`), or a :class:`~collections.abc.Callable` used to compile
patterns. It must accept an uncompiled pattern (:class:`str`) and return the
compiled pattern (:class:`.Pattern`).

*lines* (:class:`~collections.abc.Iterable`) yields each uncompiled pattern
(:class:`str`). This simply has to yield each line so that it can be a
:class:`io.TextIOBase` (e.g., from :func:`open` or :class:`io.StringIO`) or
the result from :meth:`str.splitlines`.

Returns the :class:`PathSpec` instance.
zpattern_factory:z is not callable.zlines:rO   )r   strr   lookup_patterncallablerP   r   )r]   r^   r_   liner   s        r#   
from_linesPathSpec.from_lines   s    * %%((9?	/	"	"	%o%88IJ	KK	e			VE9$89	::05>#od#(>	X ?s   0
B>Bnegateentriesrh   c             #     #    [        U5      (       d  [        SU< S35      e[        U R                  5      nU HG  n[	        UR
                  U5      nU R                  XF5      u  pxU(       a  U(       + nU(       d  MC  Uv   MI     g7f)a  
Matches the entries to this path-spec.

*entries* (:class:`~collections.abc.Iterable` of :class:`~pathspec.util.TreeEntry`)
contains the entries to be matched against :attr:`self.patterns <PathSpec.patterns>`.

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

*negate* (:class:`bool` or :data:`None`) is whether to negate the match
results of the patterns. If :data:`True`, a pattern matching a file will
exclude the file rather than include it. Default is :data:`None` for
:data:`False`.

Returns the matched entries (:class:`~collections.abc.Iterator` of
:class:`~pathspec.util.TreeEntry`).
zentries:rO   N)r   rP   r   r   r   pathrE   )	r"   ri   rC   rh   rQ   entryrG   rH   _indexs	            r#   match_entriesPathSpec.match_entries   su     2 
g			Xg[(<=	>>'6,eejj*59%%l>?7kGg
K s   A7B=	Bc                 |    [        X5      nU R                  [        U R                  5      U5      u  pE[	        U5      $ )a  
Matches the file to this path-spec.

*file* (:class:`str` or :class:`os.PathLike`) is the file path to be
matched against :attr:`self.patterns <PathSpec.patterns>`.

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

Returns :data:`True` if *file* matched; otherwise, :data:`False`.
)r   rE   rF   r   bool)r"   rB   rC   rG   rH   rm   s         r#   
match_filePathSpec.match_file  s5    " T.)$$Yt}}%=yI/'	gr&   c             #      #    [        U5      (       d  [        SU< S35      e[        U R                  5      nU H<  n[	        XR5      nU R                  XF5      u  pxU(       a  U(       + nU(       d  M8  Uv   M>     g7f)a  
Matches the files to this path-spec.

*files* (:class:`~collections.abc.Iterable` of :class:`str` or
:class:`os.PathLike`) contains the file paths to be matched against
:attr:`self.patterns <PathSpec.patterns>`.

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

*negate* (:class:`bool` or :data:`None`) is whether to negate the match
results of the patterns. If :data:`True`, a pattern matching a file will
exclude the file rather than include it. Default is :data:`None` for
:data:`False`.

Returns the matched files (:class:`~collections.abc.Iterator` of
:class:`str` or :class:`os.PathLike`).
rN   rO   N)r   rP   r   r   r   rE   )	r"   rL   rC   rh   rQ   rR   rG   rH   rm   s	            r#   match_filesPathSpec.match_files  so     4 
e			VE9$89	::'6,ii49%%l>?7kGg
O s   A,A;2	A;c             #   h   #    [         R                  " XUS9nU R                  XTS9 Sh  vN   g N7f)a  
Walks the specified root path for all files and matches them to this
path-spec.

*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`.

*negate* (:class:`bool` or :data:`None`) is whether to negate the match
results of the patterns. If :data:`True`, a pattern matching a file will
exclude the file rather than include it. Default is :data:`None` for
:data:`False`.

Returns the matched files (:class:`~collections.abc.Iterator` of
:class:`.TreeEntry`).
rY   rg   N)r   iter_tree_entriesrn   )r"   rU   rV   rW   rh   ri   s         r#   match_tree_entriesPathSpec.match_tree_entriesB  s1     @ ""4V'777   (202c             #   h   #    [         R                  " XUS9nU R                  XTS9 Sh  vN   g N7f)a  
Walks the specified root path for all files and matches them to this
path-spec.

*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`.

*negate* (:class:`bool` or :data:`None`) is whether to negate the match
results of the patterns. If :data:`True`, a pattern matching a file will
exclude the file rather than include it. Default is :data:`None` for
:data:`False`.

Returns the matched files (:class:`~collections.abc.Iterable` of
:class:`str`).
rY   rg   N)r   rZ   ru   )r"   rU   rV   rW   rh   rL   s         r#   match_tree_filesPathSpec.match_tree_filese  s1     @ 

t\
R%e333r{   )r   r*   )NN)-__name__
__module____qualname____firstlineno____doc__r   r   r$   objectrq   r4   intr8   r   r=   r@   r   r	   r   ra   r   rJ   r   rS   r   r   OSErrorr[   classmethodr
   r   r   re   r   rn   staticmethodr   check_match_filerE   rr   ru   ry   r}   
match_tree__static_attributes__r+   r&   r#   r   r   '   sH   
hw/ D  	 	D 	c 4 
 t 	D 	 	 	 +/++ z#'+ (	+0 +/0	(	0 z#'0 {8$%	0> 37!%	%% Xwio./% 	%
 {3 %B Dzhx'899: 
&	 	 F +/%
  %I% z#'%
 4.% y%N D112 +/ z#' 	0 +/&
  &	'	& z#'&
 4.& w&V 37!%	!8  !8!8 Xwio./!8 	!8 4.!8 y!8L 37!%	!4  !4!4 Xwio./!4 	!4 4.!4 sm!4J r&   N)r   collections.abcr   r    	itertoolsr   typingr   r   r   r   r	   r
   r   r    r   patternr   r   r   r   r   r   r   r   r   r   r   r+   r&   r#   <module>r      s]   	 	 	 
   vZ(cv cr&   