o
    *ήc.                     @   s0   d dl mZmZ dd Zd
ddZd
dd	ZdS )    )PureWindowsPathPurePosixPathc                    sz   |rt   ndd |D }dd |D }t  ||@ }|r&td|t fdd|D o<t fdd|D  S )zJInternal function same as :func:`match_path` but does not check arguments.c                 S      h | ]}|  qS  lower.0patternr   r   >/tmp/pip-target-vg8gfxp4/lib/python/watchdog/utils/patterns.py	<setcomp>       z_match_path.<locals>.<setcomp>c                 S   r   r   r   r   r   r   r   r      r   z/conflicting patterns `{}` included and excludedc                 3       | ]}  |V  qd S Nmatchr	   ppathr   r   	<genexpr>       z_match_path.<locals>.<genexpr>c                 3   r   r   r   r   r   r   r   r      r   )r   r   
ValueErrorformatany)r   included_patternsexcluded_patternscase_sensitivecommon_patternsr   r   r   _match_path   s   
r   NTc                 c   sN    |du rdgn|}|du rg n|}| D ]}t |t|t||r$|V  qdS )a@  
    Filters from a set of paths based on acceptable patterns and
    ignorable patterns.
    :param pathnames:
        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   setpathsr   r   r   includedexcludedr   r   r   r   filter_paths"   s   r'   c                 C   sL   |du rdgn|}|du rg n|}| D ]}t |t|t||r# dS qdS )a  
    Matches from a set of paths based on acceptable patterns and
    ignorable patterns.
    :param pathnames:
        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:
        ``True`` if any of the paths matches; ``False`` otherwise.
    Nr    TFr!   r#   r   r   r   match_any_paths>   s   r(   )NNT)pathlibr   r   r   r'   r(   r   r   r   r   <module>   s   
