grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026U iÛfïã@sjdZddlZddlZddlZddlZddddgZdd„Zejdd d �d d „ƒZd d„Z dd„Z dd„Z dS)a£Filename matching with shell patterns. fnmatch(FILENAME, PATTERN) matches according to the local convention. fnmatchcase(FILENAME, PATTERN) always takes case in account. The functions operate by translating the pattern into a regular expression. They cache the compiled regular expressions for speed. The function translate(PATTERN) returns a regular expression corresponding to PATTERN. (It does not compile it.) éNÚfilterÚfnmatchÚ fnmatchcaseÚ translatecCs"tj |¡}tj |¡}t||ƒS)a½Test whether FILENAME matches PATTERN. Patterns are Unix shell style: * matches everything ? matches any single character [seq] matches any character in seq [!seq] matches any char not in seq An initial period in FILENAME is not special. Both FILENAME and PATTERN are first case-normalized if the operating system requires it. If you don't want this, use fnmatchcase(FILENAME, PATTERN). )ÚosÚpathÚnormcaser)ÚnameÚpat©r ú,/opt/alt/python38/lib64/python3.8/fnmatch.pyrs  éT)ÚmaxsizeÚtypedcCs<t|tƒr(t|dƒ}t|ƒ}t|dƒ}nt|ƒ}t |¡jS)Nz ISO-8859-1)Ú isinstanceÚbytesÚstrrÚreÚcompileÚmatch)r Zpat_strZres_strÚresr r r Ú_compile_pattern&s    rcCshg}tj |¡}t|ƒ}tjtkr@|D]}||ƒr&| |¡q&n$|D]}|tj |¡ƒrD| |¡qD|S)zJConstruct a list from those elements of the iterable NAMES that match PAT.)rrrrÚ posixpathÚappend)Únamesr Úresultrr r r r r0s   cCst|ƒ}||ƒdk S)z�Test whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. N)r)r r rr r r r@sc Csædt|ƒ}}d}||k�rÞ||}|d}|dkr>|d}q|dkrP|d}q|dk�rÎ|}||krz||d krz|d}||kr–||d kr–|d}||kr´||d kr´|d}q–||krÈ|d }�qÜ|||…}d |krê| d d¡}nŠg}||d k�r|dn|d}| d||¡}|dk�r(�qN| |||…¡|d}|d}�q | |||…¡d dd„|Dƒ¡}t dd|¡}|d}|dd k�rªd|dd…}n|ddk�rÀd |}d||f}q|t |¡}qd|S)zfTranslate a shell PATTERN to a regular expression. There is no way to quote meta-characters. rÚéÚ*z.*ú?Ú.ú[ú!ú]z\[z--ú\ú\\éú-écss"|]}| dd¡ dd¡VqdS)r$r%r'z\-N)Úreplace)Ú.0Úsr r r Ú tsÿztranslate..z([&~|])z\\\1ú^N)r-r!z%s[%s]z (?s:%s)\Z)Úlenr)ÚfindrÚjoinrÚsubÚescape) r ÚiÚnrÚcÚjZstuffZchunksÚkr r r rJsV          ÿ) Ú__doc__rrrÚ functoolsÚ__all__rÚ lru_cacherrrrr r r r Ús