Qfo|dZddlZddlZddlZddlZgdZdZejdddZd Z d Z d Z y) aFilename 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)filterfnmatch fnmatchcase translatectjj|}tjj|}t||S)aTest 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). )ospathnormcaser)namepats ./opt/alt/python312/lib64/python3.12/fnmatch.pyrrs9 77  D !D ''  3 C tS !!iT)maxsizetypedct|tr$t|d}t|}t|d}n t|}t j |j S)Nz ISO-8859-1) isinstancebytesstrrrecompilematch)r pat_strres_strress r _compile_patternr&sK#uc<(G$G\*n ::c?  rcLg}tjj|}t|}tjtur#|D]}||s |j ||S|D]9}|tjj|s)|j |;|S)zJConstruct a list from those elements of the iterable NAMES that match PAT.)rr r r posixpathappend)namesr resultrr s r rr0s F ''  3 C S !E ww)DT{ d# MDRWW%%d+, d# Mrc,t|}||duS)zTest whether FILENAME matches PATTERN, including case. This is a version of fnmatch() which doesn't case-normalize its arguments. N)r)r r rs r rr@s S !E ;d ""rcft}g}|j}dt|}}||kr||}|dz}|dk(r|r|d|ur||n|dk(r |dn|dk(r|}||kr ||dk(r|dz}||kr ||d k(r|dz}||kr||d k7r|dz}||kr ||d k7r||k\r |d nq|||}d |vr|jd d }ng} ||dk(r|dzn|dz} |j d | |} | dkrn| j||| | dz}| dz} 8|||} | r| j| n | dxxd z cc<t t| dz ddD]4} | | dz d| | dkDs| | dz dd| | ddz| | dz <| | =6d j d| D}tjdd|}|dz}|s |dnS|dk(r |dnE|ddk(r d|ddz}n |ddvrd |z}|d|d n|tj|||kr||k(sJ|} g}|j}dt| }}||kr$| ||ur|| ||dz }||kr| ||ur||kr| ||usJ|dz }||k(r |dnv| ||usJg} ||kr-| ||ur&| j| ||dz }||kr| ||ur&dj | } ||k(r|d|| n |d| d||kr||k(sJdj |}d|dS)zfTranslate a shell PATTERN to a regular expression. There is no way to quote meta-characters. r*?.[!]z\[-\\\Nc3`K|]&}|jddjdd(yw)r,r-r+z\-N)replace).0ss r ztranslate..s0%6.4&'YYtU%;%C%CC%O.4s,.z([&~|])z\\\1z(?!)^)r5r(z.*z(?>.*?)z(?s:z)\Z) objectrlenr1findrangejoinrsubescape)r STARraddincjstuffchunkskchunkinpfixeds r rrJs 8D C **C c#hqA a% F aC 8CG4/D #X H #XA1uQ3aC1uQ3aCa%CFcMaCa%CFcMAvE Aae#!MM$6EF"1v}!!A#AHHS!Q/q5! c!Ah/aCaC  !HE e,r c) "3v;q=!R8!!A#;r?VAYq\9*01+cr*:VAYqr]*JF1Q3K &q 9  HH%6.4%66Ez7E:aCKc\HQx3 #eABiqZ/ $u !E7! %  !  a%@ 6M6 C C **C c#hqA a%CF$& CF  Q a%CF$& a%1v~~ Q 6 I 1vT!!!!eAd* LLQ FA!eAd* 6 I J &q! "! a%" 6M6 ''#,C3%s r) __doc__rrr functools__all__r lru_cacherrrrrr rPsU    ;"&U$/!0! #or