Ë
    ÌiÙ3  ã                   ó´   — d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZ ddlmZmZmZmZmZmZmZ  ed	d
¬«      Z	  G d„ d
e«      Zy)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                   ó¶  — e Zd ZdZdee   ddfd„Zdedefd„Z	de
fd„Zd	edd defd
„Zd	edd defd„Z	 d!dedeee      dee   fd„Z	 d!dee   deee      deee      fd„Z	 	 d"dedeeegdf      dee   deee      fd„Zedee   deeeegef   f   dee   defd„«       Z	 d!ddœdee    deee      dee   dee    fd„Z! e"e#jH                  «      Z%	 	 d!dedeee      defd„Z&	 d!ddœdee   deee      dee   dee   fd„Z'	 	 d"ddœdedeeegdf      dee   dee   dee    f
d„Z(	 	 d"ddœdedeeegdf      dee   dee   dee   f
d „Z)e)Z*y)#r   zd
	The :class:`PathSpec` class is a wrapper around a list of compiled
	:class:`.Pattern` instances.
	ÚpatternsÚreturnNc                 óH   — t        |t        «      st        |«      }|| _        y)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     úR/var/www/html/strategist-ai/venv/lib/python3.12/site-packages/pathspec/pathspec.pyÚ__init__zPathSpec.__init__-   s#   € ô 
�HœnÔ	-Ü�8‹n€8à'/€$„-ðó    Úotherc                 ó’   — t        |t        «      r2t        | j                  |j                  «      }t	        d„ |D «       «      S t
        S )z‡
		Tests the equality of this path-spec with *other* (:class:`PathSpec`)
		by comparing their :attr:`~PathSpec.patterns` attributes.
		c              3   ó,   K  — | ]  \  }}||k(  –— Œ y ­w©N© )Ú.0ÚaÚbs      r"   ú	<genexpr>z"PathSpec.__eq__.<locals>.<genexpr>D   s   è ø€ Ò1™˜˜Aˆa�1�fÑ1ùs   ‚)r   r   r   r   ÚallÚNotImplemented)r!   r%   Úpaired_patternss      r"   Ú__eq__zPathSpec.__eq__=   s9   € ô
 �”xÔ Ü  §¡°·±Ó?€?Ü
Ñ1 Ô1Ó
1Ð1ä
Ðr$   c                 ó,   — t        | j                  «      S )zW
		Returns the number of compiled patterns this path-spec contains
		(:class:`int`).
		)Úlenr   )r!   s    r"   Ú__len__zPathSpec.__len__H   s   € ô
 
ˆT�]‰]Ó	Ðr$   r!   c                 ó~   — t        |t        «      r(| j                  | j                  |j                  z   «      S t        S )z]
		Combines the :attr:`Pathspec.patterns` patterns from two
		:class:`PathSpec` instances.
		)r   r   Ú	__class__r   r/   ©r!   r%   s     r"   Ú__add__zPathSpec.__add__O   s0   € ô
 �”xÔ Ø
�.‰.˜Ÿ™¨¯©Ñ7Ó
8Ð8ä
Ðr$   c                 óp   — t        |t        «      r!| xj                  |j                  z  c_        | S t        S )zi
		Adds the :attr:`Pathspec.patterns` patterns from one :class:`PathSpec`
		instance to this instance.
		)r   r   r   r/   r7   s     r"   Ú__iadd__zPathSpec.__iadd__Y   s+   € ô
 �”xÔ Ø‡=‚=�E—N‘NÑ"…=Ø
€;ä
Ðr$   ÚfileÚ
separatorsc                 ó„   — t        ||«      }| j                  t        | j                  «      |«      \  }}t	        |||«      S )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!   r;   r<   Ú	norm_fileÚincludeÚindexs         r"   Ú
check_filezPathSpec.check_filed   s>   € ô" ˜T :Ó.€)Ø×#Ñ#¤I¨d¯m©mÓ$<¸iÓH�.€'ˆ5Ü	�T˜7 EÓ	*Ð*r$   Úfilesc              #   óØ   K  — t        |«      st        d|›d�«      ‚t        | j                  «      }|D ]2  }t	        ||«      }| j                  ||«      \  }}t        |||«      –— Œ4 y­w)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   r>   r   )r!   rD   r<   Úuse_patternsÚ	orig_filer@   rA   rB   s           r"   Úcheck_fileszPathSpec.check_filesy   ss   è ø€ ô& 
�eÔ	Ü	�V˜E˜9Ð$8Ð9Ó	:Ð:ä'¨¯©Ó6€,Øò 0€iÜ˜i¨Ó4€9Ø×$Ñ$ \°9Ó=�>€7ˆEÜ	�Y ¨Ó	/Ó/ñ0ùs   ‚A(A*ÚrootÚon_errorÚfollow_linksc              #   ór   K  — t        j                  |||¬«      }| j                  |«      E d{  –—†  y7 Œ­w)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`).
		©rM   rN   N)r   Úiter_tree_filesrK   )r!   rL   rM   rN   rD   s        r"   Úcheck_tree_fileszPathSpec.check_tree_files•   s0   è ø€ ô< ×
Ñ
˜t¨hÀ\Ô
R€%Ø×Ñ˜eÓ$×$Ò$ús   ‚-7¯5°7ÚclsÚpattern_factoryÚlinesc                 óþ   — t        |t        «      rt        j                  |«      }t	        |«      st        d|›d�«      ‚t        |«      st        d|›d�«      ‚|D �cg c]  }|sŒ ||«      ‘Œ }} | |«      S c c}w )ai  
		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:rG   )r   Ústrr   Úlookup_patternÚcallablerH   r   )rS   rT   rU   Úliner   s        r"   Ú
from_lineszPathSpec.from_lines¶   sƒ   € ô* �¤Ô%Ü×(Ñ(¨Ó9€?ä	�/Ô	"Ü	Ð% oÐ%8Ð8IÐJÓ	KÐKä	�eÔ	Ü	�V˜E˜9Ð$8Ð9Ó	:Ð:à05Ö>¨º‰o˜dÕ#Ð>€(Ð>Ù	ˆX‹Ðùò ?s   ÁA:Á&
A:©ÚnegateÚentriesr]   c             #   óæ   K  — t        |«      st        d|›d�«      ‚t        | j                  «      }|D ]9  }t	        |j
                  |«      }| j                  ||«      \  }}|r| }|sŒ6|–— Œ; y­w)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:rG   N)r   rH   r   r   r   Úpathr>   )	r!   r^   r<   r]   rI   Úentryr@   rA   Ú_indexs	            r"   Úmatch_entrieszPathSpec.match_entries×   sz   è ø€ ô2 
�gÔ	Ü	�X˜g˜[Ð(<Ð=Ó	>Ð>ä'¨¯©Ó6€,Øò €eÜ˜eŸj™j¨*Ó5€9Ø×%Ñ% l°IÓ>�?€7ˆFáØˆk€GâØ
ƒKñùs   ‚A'A1Á*A1c                 ó€   — t        ||«      }| j                  t        | j                  «      |«      \  }}t	        |«      S )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   r>   r?   r   Úbool)r!   r;   r<   r@   rA   rb   s         r"   Ú
match_filezPathSpec.match_file  s9   € ô" ˜T :Ó.€)Ø×$Ñ$¤Y¨t¯}©}Ó%=¸yÓI�/€'ˆ6Ü	ˆg‹Ðr$   c             #   óÒ   K  — t        |«      st        d|›d�«      ‚t        | j                  «      }|D ]/  }t	        ||«      }| j                  ||«      \  }}|r| }|sŒ,|–— Œ1 y­w)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`).
		rF   rG   N)r   rH   r   r   r   r>   )	r!   rD   r<   r]   rI   rJ   r@   rA   rb   s	            r"   Úmatch_fileszPathSpec.match_files  sv   è ø€ ô4 
�eÔ	Ü	�V˜E˜9Ð$8Ð9Ó	:Ð:ä'¨¯©Ó6€,Øò €iÜ˜i¨Ó4€9Ø×%Ñ% l°IÓ>�?€7ˆFáØˆk€GâØ
ƒOñùs   ‚AA'Á A'c             #   óv   K  — t        j                  |||¬«      }| j                  ||¬«      E d{  –—†  y7 Œ­w)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`).
		rP   r\   N)r   Úiter_tree_entriesrc   )r!   rL   rM   rN   r]   r^   s         r"   Úmatch_tree_entrieszPathSpec.match_tree_entriesB  s6   è ø€ ô@ ×"Ñ" 4°(ÈÔV€'Ø×Ñ °ÐÓ7×7Ò7úó   ‚/9±7²9c             #   óv   K  — t        j                  |||¬«      }| j                  ||¬«      E d{  –—†  y7 Œ­w)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`).
		rP   r\   N)r   rQ   rh   )r!   rL   rM   rN   r]   rD   s         r"   Úmatch_tree_fileszPathSpec.match_tree_filese  s6   è ø€ ô@ ×
Ñ
˜t¨hÀ\Ô
R€%Ø×Ñ˜e¨FÐÓ3×3Ò3úrl   r(   )NN)+Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r#   Úobjectre   r1   Úintr4   r   r8   r:   r   r	   r   rW   r   rC   r   rK   r   r   ÚOSErrorrR   Úclassmethodr
   r   r   r[   r   rc   Ústaticmethodr   Úcheck_match_filer>   rf   rh   rk   rn   Ú
match_treer)   r$   r"   r   r   '   sH  „ ñð
˜h wÑ/ð °Dó ð 	˜ð 	 Dó 	ð�có ð�4ð  
ð ¨tó ð	�Dð 	 ð 	°ó 	ð +/ñ+àð+ð �z #‘Ñ'ð+ð �(Ñó	+ð0 +/ñ0à	�(Ñ	ð0ð �z #‘Ñ'ð0ð ˆ{˜8Ñ$Ñ%ó	0ð> 37Ø!%ñ	%àð%ð �X˜w˜i¨˜oÑ.Ñ/ð%ð ˜‘ð	%ð
 ˆ{˜3ÑÑ ó%ðB ðØˆD�zðà˜˜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ð �X˜w˜i¨˜oÑ.Ñ/ð!8ð ˜‘ð	!8ð �4‰.ð!8ð ˆyÑó!8ðL 37Ø!%ð	!4ð  ò!4àð!4ð �X˜w˜i¨˜oÑ.Ñ/ð!4ð ˜‘ð	!4ð �4‰.ð!4ð ˆs�mó!4ðJ �r$   N)rr   Úcollections.abcr   r   Ú	itertoolsr   Útypingr   r   r   r   r	   r
   r   r   Ú r   Úpatternr   r   r   r   r   r   r   r   r   rs   r   r)   r$   r"   ú<module>r      s]   ðñõõ÷	÷ 	õ 	õ õ
÷÷ ñ ñ ˆv˜ZÔ(€ðôcˆvõ cr$   