def glob(self, pat):
        """`pat` can be an extended glob pattern, e.g. `'**/*.less'`
           This code handles negations similarly to node.js' minimatch, i.e.
           a leading `!` will negate the entire pattern.
        """
        r = ""
        negate = int(pat.startswith('!'))
        i = negate

        while i < len(pat):
            if pat[i:i + 3] == '**/':
                r += "(?:.*/)?"
                i += 3
            elif pat[i] == "*":
                r += "[^/]*"
                i += 1
            elif pat[i] == ".":
                r += "[.]"
                i += 1
            elif pat[i] == "?":
                r += "."
                i += 1
            else:
                r += pat[i]
                i += 1
        r += r'\Z(?ms)'
        # print '\n\npat', pat
        # print 'regex:', r
        # print [s.relpath(self).replace('\\', '/') for s in self]
        rx = re.compile(r)

        def match(d):
            m = rx.match(d)
            return not m if negate else m

        return [s for s in self if match(s.relpath(self).replace('\\', '/'))]
def glob ( self , pat ) : r = "" negate = int ( pat . startswith ( '!' ) ) i = negate while i < len ( pat ) : if pat [ i : i + 3 ] == '**/' : r += "(?:.*/)?" i += 3 elif pat [ i ] == "*" : r += "[^/]*" i += 1 elif pat [ i ] == "." : r += "[.]" i += 1 elif pat [ i ] == "?" : r += "." i += 1 else : r += pat [ i ] i += 1 r += r'\Z(?ms)' rx = re . compile ( r ) def match ( d ) : m = rx . match ( d ) return not m if negate else m return [ s for s in self if match ( s . relpath ( self ) . replace ( '\\' , '/' ) ) ]
`pat` can be an extended glob pattern, e.g. `'**/*.less'`
           This code handles negations similarly to node.js' minimatch, i.e.
           a leading `!` will negate the entire pattern.