a f @sDddlZddlZejeejeejZGdddZddZdS)Nc@sdeZdZUdZeed<efedddZddZdd Z d d Z d d Z ddZ ddZ ddZdS) Translatorz >>> Translator('xyz') Traceback (most recent call last): ... AssertionError: Invalid separators >>> Translator('') Traceback (most recent call last): ... AssertionError: Invalid separators sepsrcCs ||_dS)Nr)selfrr-/usr/lib/python3.9/site-packages/zipp/glob.py__init__szTranslator.__init__cCs||||S)zH Given a glob pattern, produce a regex that matches it. )extend match_dirstranslate_corerpatternrrr translateszTranslator.translatecCs d|dS)z Extend regex for pattern-wide concerns. Apply '(?s:)' to create a non-matching group that matches newlines (valid on Unix). Append '\Z' to imply fullmatch even when match is used. z(?s:z)\Zrr rrrr !s zTranslator.extendcCs |dS)z Ensure that zipfile.Path directory names are matched. zipfile.Path directory names always end in a slash. z[/]?rr rrrr ,szTranslator.match_dirscCs&||dt|jt||S)a? Given a glob pattern, produce a regex that matches it. >>> t = Translator() >>> t.translate_core('*.txt').replace('\\\\', '') '[^/]*\\.txt' >>> t.translate_core('a?txt') 'a[^/]txt' >>> t.translate_core('**/*').replace('\\\\', '') '.*/[^/][^/]*' )restrict_rglobjoinmapreplaceseparatestar_not_emptyr rrrr 4s zTranslator.translate_corecCsB|dp@t|dddddt|jddd S) zM Perform the replacements for a match from :func:`separate`. setrz\*\*z.*z\*[^z]*z\?z[^/])groupreescaperr)rmatchrrrrCs zTranslator.replacecCs>dt|jd}t||}tdd|Dr:tddS)z Raise ValueError if ** appears in anything but a full path segment. >>> Translator().translate('**foo') Traceback (most recent call last): ... ValueError: ** must appear alone in a path segment []+css|]}d|vo|dkVqdS)z**Nr).0segmentrrr Yz,Translator.restrict_rglob..z&** must appear alone in a path segmentN)rrrsplitany ValueError)rr Z seps_patternsegmentsrrrrNs  zTranslator.restrict_rglobcCs*dd}dt|jd}t|||S)z@ Ensure that * will not match an empty segment. cSs|d}|dkrdS|S)Nr*z?*)r)rrrrrhandle_segmentas z1Translator.star_not_empty..handle_segmentrr)rrrsub)rr r'Znot_seps_patternrrrr\szTranslator.star_not_emptyN)__name__ __module__ __qualname____doc__str__annotations__ _default_sepsrrr r r rrrrrrrrs    rcCs td|S)z Separate out character sets to avoid translating their contents. >>> [m.group(0) for m in separate('*.txt')] ['*.txt'] >>> [m.group(0) for m in separate('a[?]txt')] ['a', '[?]', 'txt'] z+([^\[]+)|(?P[\[].*?[\]])|([\[][^\]]*$))rfinditer)r rrrris r) osrsepr-altsepboolr/rrrrrrsa