Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/fnmatch.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
��c@sRdZddkZddddgZhZd�Zd�Zd	�Zd
�ZdS(s�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.)
i�Ntfiltertfnmatchtfnmatchcaset	translatecCs=ddk}|ii|�}|ii|�}t||�S(s�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).
    i�N(tostpathtnormcaseR(tnametpatR((s/sys/lib/python/fnmatch.pyRscCs�ddk}ddk}g}|ii|�}|tjo#t|�}ti|�t|<nt|i}|i|jo3xk|D]$}||�o|i	|�q�q�Wn<x8|D]0}||ii|��o|i	|�q�q�W|S(s2Return the subset of the list NAMES that match PATi�N(
Rt	posixpathRRt_cacheRtretcompiletmatchtappend(tnamesRRR	tresulttresR
R((s/sys/lib/python/fnmatch.pyR(s"


cCsG|tjo#t|�}ti|�t|<nt|i|�dj	S(s�Test whether FILENAME matches PATTERN, including case.

    This is a version of fnmatch() which doesn't case-normalize
    its arguments.
    N(R
RRRR
tNone(RRR((s/sys/lib/python/fnmatch.pyR<s
cCs�dt|�}}d}x�||jo�||}|d}|djo|d}q|djo|d}q|djo"|}||jo||d	jo|d}n||jo||d
jo|d}nx-||jo||d
jo|d}q�W||jo|d}q�|||!idd
�}|d}|dd	jod|d}n |ddjod|}nd||f}q|ti|�}qW|dS(sfTranslate a shell PATTERN to a regular expression.

    There is no way to quote meta-characters.
    itit*s.*t?t.t[t!t]s\[s\s\\t^s%s[%s]t$(tlentreplaceRtescape(RtitnRtctjtstuff((s/sys/lib/python/fnmatch.pyRHs8




!

(t__doc__Rt__all__R
RRRR(((s/sys/lib/python/fnmatch.pys<module>s			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.