Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(95)  |  Call(68)  |  Derive(0)  |  Import(27)
Extended pathname pattern matching.

This function is similar to what is provided by the ``fnmatch`` module in
the Python standard library, but:

 * can match complete (relative or absolute) path names, and not just file
   names, and
 * also supports a convenience pattern ("**") to match files at any
   directory level.
(more...)

        def pathmatch(pattern, filename):
    """Extended pathname pattern matching.

    This function is similar to what is provided by the ``fnmatch`` module in
    the Python standard library, but:

     * can match complete (relative or absolute) path names, and not just file
       names, and
     * also supports a convenience pattern ("**") to match files at any
       directory level.

    Examples:

    >>> pathmatch('**.py', 'bar.py')
    True
    >>> pathmatch('**.py', 'foo/bar/baz.py')
    True
    >>> pathmatch('**.py', 'templates/index.html')
    False

    >>> pathmatch('**/templates/*.html', 'templates/index.html')
    True
    >>> pathmatch('**/templates/*.html', 'templates/foo/bar.html')
    False

    :param pattern: the glob pattern
    :param filename: the path name of the file to match against
    """
    symbols = {
        '?':   '[^/]',
        '?/':  '[^/]/',
        '*':   '[^/]+',
        '*/':  '[^/]+/',
        '**/': '(?:.+/)*?',
        '**':  '(?:.+/)*?[^/]+',
    }
    buf = []
    for idx, part in enumerate(re.split('([?*]+/?)', pattern)):
        if idx % 2:
            buf.append(symbols[part])
        elif part:
            buf.append(re.escape(part))
    match = re.match(''.join(buf) + '$', filename.replace(os.sep, '/'))
    return match is not None
        


src/h/u/hue-HEAD/desktop/core/ext-py/Babel-0.9.6/babel/messages/extract.py   hue(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/f/j/fjord-HEAD/vendor/packages/Babel/babel/messages/extract.py   fjord(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from babel._compat import PY2, text_type
from textwrap import dedent
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/Babel-0.9.6/babel/messages/extract.py   hortonworks-sandbox(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/p/l/plexnet-HEAD/third_party/python/babel/messages/extract.py   plexnet(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath, set
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/f/i/FireCheckIn-HEAD/kay/lib/babel/messages/extract.py   FireCheckIn(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath, set
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/k/a/kay-HEAD/kay/lib/babel/messages/extract.py   kay(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath, set
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/k/i/kitsune-HEAD/vendor/packages/Babel/babel/messages/extract.py   kitsune(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/m/i/microblog-HEAD/flask/lib/python2.7/site-packages/babel/messages/extract.py   microblog(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from babel._compat import PY2, text_type
from textwrap import dedent
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/s/o/socorro-HEAD/webapp-django/vendor/lib/python/babel/messages/extract.py   socorro(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from textwrap import dedent
 
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/babel/messages/extract.py   ZenPacks.zenoss.OpenStack(Download)
from tokenize import generate_tokens, COMMENT, NAME, OP, STRING
 
from babel.util import parse_encoding, pathmatch, relpath
from babel._compat import PY2, text_type
from textwrap import dedent
            )
            for pattern, method in method_map:
                if pathmatch(pattern, filename):
                    filepath = os.path.join(absname, filename)
                    options = {}
                    for opattern, odict in options_map.items():
                        if pathmatch(opattern, filename):

  1 | 2 | 3  Next