import re


def _FilterPaths(input_api):
    """Returns input files with certain paths removed."""
    files = []
    for f in input_api.AffectedFiles():
        file_path = f.LocalPath()
        # Filter out changes in web_tests/.
        if ('web_tests' + input_api.os_path.sep in file_path
                and 'TestExpectations' not in file_path):
            continue
        if '/PRESUBMIT' in file_path:
            continue
        # Skip files that were generated by bison.
        if re.search(
                'third_party/blink/renderer/' +
                'core/xml/xpath_grammar_generated\.(cc|h)$', file_path):
            continue
        files.append(input_api.os_path.join('..', '..', file_path))
    return files