
    $gX                    n    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dS )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)Iteratorraw_pathstrincluded_patternsset[str]excluded_patternscase_sensitiveboolreturnc                  |rt          |           n'd |D             }d |D             }t          |           ||z  }|rd| d}t          |          t          fd|D                       ot          fd|D                        S )zJInternal function same as :func:`match_path` but does not check arguments.c                6    h | ]}|                                 S  lower.0patterns     W/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/watchdog/utils/patterns.py	<setcomp>z_match_path.<locals>.<setcomp>$        NNNW]]__NNN    c                6    h | ]}|                                 S r   r   r   s     r   r   z_match_path.<locals>.<setcomp>%   r   r   zconflicting patterns `z` included and excludedc              3  B   K   | ]}                     |          V  d S Nmatchr   ppaths     r   	<genexpr>z_match_path.<locals>.<genexpr>-   s-      88tzz!}}888888r   c              3  B   K   | ]}                     |          V  d S r   r   r!   s     r   r$   z_match_path.<locals>.<genexpr>-   s/      DnDnWXTZZPQ]]DnDnDnDnDnDnr   )r   r   
ValueErrorany)r   r
   r   r   common_patternserrorr#   s         @r   _match_pathr*      s      )X&&NN<MNNNNN<MNNNx(('*;;O  QQQQ8888&788888nDnDnDnDn\mDnDnDnAnAn=nnr   NTr
   r   r   paths	list[str]list[str] | NoneIterator[str]c             #     K   t          |dgn|          }t          |g n|          }| D ]}t          ||||          r|V  dS )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*   )r,   r
   r   r   includedexcludedr#   s          r   filter_pathsr5   0   sv      2 -5C55;LMMH*2228IJJH  tXxOOO 	JJJ r   c               B    t          t          | |||                    S )zMatches from a set of paths based on acceptable patterns and
    ignorable patterns.
    See ``filter_paths()`` for signature details.
    r+   )r'   r5   )r,   r
   r   r   s       r   match_any_pathsr7   Q   s4     //)		
 	
 	
  r   )
r   r	   r
   r   r   r   r   r   r   r   )
r,   r-   r
   r.   r   r.   r   r   r   r/   )
r,   r-   r
   r.   r   r.   r   r   r   r   )__doc__
__future__r   pathlibr   r   typingr   collections.abcr   r*   r5   r7   r   r   r   <module>r=      s     # " " " " " 3 2 2 2 2 2 2 2             )((((((o o o o6 +/*.     H +/*.       r   