o
    +ke	                     @   s   d dl Z d dlZdddZdS )    N\Zc           	      C   s  t jj}t| }d}d}||k r| | }|d7 }|dkrG|d |k r@| | dkr@| |d  |kr@|d| d| d7 }|d7 }n|d	| 7 }n|d
krR|d| 7 }nx|dkr|}||k rf| | dkrf|d7 }||k rt| | dkrt|d7 }||k r| | dkr|d7 }||k r| | dks~||kr|d7 }n5| || dd}|d }|d dkrd|dd  }n
|d dkrd| }|d| 7 }n|t|7 }||k sd| | S )aY  Translate a shell-style pattern to a regular expression.

    The pattern may include ``**<sep>`` (<sep> stands for the platform-specific path separator; "/" on POSIX systems) for
    matching zero or more directory levels and "*" for matching zero or more arbitrary characters with the exception of
    any path separator. Wrap meta-characters in brackets for a literal match (i.e. "[?]" to match the literal character
    "?").

    Using match_end=regex one can give a regular expression that is used to match after the regex that is generated from
    the pattern. The default is to match the end of the string.

    This function is derived from the "fnmatch" module distributed with the Python standard library.

    Copyright (C) 2001-2016 Python Software Foundation. All rights reserved.

    TODO: support {alt1,alt2} shell-style alternatives

    r       *z(?:[^\z]*\z)*   z[^\%s]*?z[^\%s][!]z\[\z\\^Nz[%s]z(?ms))ospathseplenreplacereescape)	patZ	match_endr   nirescjstuff r   5usr/lib/python3.10/site-packages/borg/shellpattern.py	translate   sF   (

%r   )r   )r   r   r   r   r   r   r   <module>   s    