
    gX                        d Z ddlmZ ddlmZmZ ddlmZ erddlm	Z	 	 	 	 	 	 	 	 	 	 	 ddZ
dddd		 	 	 	 	 	 	 	 	 dd
Zdddd		 	 	 	 	 	 	 	 	 ddZy)u  :module: watchdog.utils.patterns
:synopsis: Common wildcard searching/filtering functionality for files.
:author: boris.staletic@gmail.com (Boris Staletic)
:author: yesudeep@gmail.com (Yesudeep Mangalapilly)
:author: contact@tiger-222.fr (Mickaël Schoentgen)
    )annotations)PurePosixPathPureWindowsPath)TYPE_CHECKING)Iteratorc               D   |rt        |       nE|D ch c]  }|j                          }}|D ch c]  }|j                          }}t        |       ||z  }|rd| d}t        |      t	        fd|D              xr t	        fd|D               S c c}w c c}w )zJInternal function same as :func:`match_path` but does not check arguments.zconflicting patterns `z` included and excludedc              3  @   K   | ]  }j                  |        y wNmatch.0ppaths     L/var/www/openai/venv/lib/python3.12/site-packages/watchdog/utils/patterns.py	<genexpr>z_match_path.<locals>.<genexpr>-   s     8&7tzz!}&7   c              3  @   K   | ]  }j                  |        y wr
   r   r   s     r   r   z_match_path.<locals>.<genexpr>-   s     Dn\mWXTZZPQ]\mr   )r   lowerr   
ValueErrorany)raw_pathincluded_patternsexcluded_patternscase_sensitivepatterncommon_patternserrorr   s          @r   _match_pathr      s     X&<MN<MW]]_<MN<MN<MW]]_<MNx('*;;O((99PQ8&788nDn\mDnAn=nn ONs
   BBNTr   r   r   c             #     K   t        |dgn|      }t        |g n|      }| D ]  }t        ||||      s|  yw)a7  Filters from a set of paths based on acceptable patterns and
    ignorable patterns.
    :param paths:
        A list of path names that will be filtered based on matching and
        ignored patterns.
    :param included_patterns:
        Allow filenames matching wildcard patterns specified in this list.
        If no pattern list is specified, ["*"] is used as the default pattern,
        which matches all files.
    :param excluded_patterns:
        Ignores filenames matching wildcard patterns specified in this list.
        If no pattern list is specified, no files are ignored.
    :param case_sensitive:
        ``True`` if matching should be case-sensitive; ``False`` otherwise.
    :returns:
        A list of pathnames that matched the allowable patterns and passed
        through the ignored patterns.
    N*)r   )setr   )pathsr   r   r   includedexcludedr   s          r   filter_pathsr'   0   sM     2 -5C5;LMH*228IJHtXxOJ s   4>>c               2    t        t        | |||            S )zMatches from a set of paths based on acceptable patterns and
    ignorable patterns.
    See ``filter_paths()`` for signature details.
    r    )r   r'   )r$   r   r   r   s       r   match_any_pathsr)   Q   s%     //)		
     )
r   strr   set[str]r   r,   r   boolreturnr-   )
r$   	list[str]r   list[str] | Noner   r0   r   r-   r.   zIterator[str])
r$   r/   r   r0   r   r0   r   r-   r.   r-   )__doc__
__future__r   pathlibr   r   typingr   collections.abcr   r   r'   r)    r*   r   <module>r7      s    # 3  (ooo  o
 o 
o6 +/*. ( (	
  H +/*. ( (	
  
r*   