'Find matching patterns for path.
Stops after the first ignore file with matches.
:param path: Path to check
:return: Iterator over Pattern instances'

def find_matching(self, path):

    if os.path.isabs(path):
        raise ValueError(('%s    is    an    absolute    path' % path))
    filters = [(0, f) for f in self._global_filters]
    if (os.path.sep != '/'):
        path = path.replace(os.path.sep, '/')
    parts = path.split('/')
    for i in range((len(parts) + 1)):
        dirname = '/'.join(parts[:i])
        for (s, f) in filters:
            relpath = '/'.join(parts[s:i])
            if (i < len(parts)):
                relpath += '/'
            matches = list(f.find_matching(relpath))
            if matches:
                return iter(matches)
        ignore_filter = self._load_path(dirname)
        if (ignore_filter is not None):
            filters.insert(0, (i, ignore_filter))
    return iter([])
