protoletariat icon indicating copy to clipboard operation
protoletariat copied to clipboard

--exclude-google-imports causing everything to be excluded

Open odubno opened this issue 11 months ago • 0 comments

I'm using buf before cleaning up compiled files with protol

protol --exclude-google-imports --create-package --in-place --python-out ./my-packages buf --buf-path=/usr/local/bin/buf

Using --exclude-google-imports is causing everything to get ignored.

[source: github]

def _should_ignore(fd_name: str, patterns: Sequence[str]) -> bool:
    """Return whether `fd_name` should be ignored according to `patterns`.

    Examples
    --------
    >>> fd_name = "google/protobuf/empty.proto"
    >>> pattern = "google/protobuf/*"
    >>> _should_ignore(fd_name, [pattern])
    True
    >>> fd_name = "foo/bar"
    >>> _should_ignore(fd_name, [pattern])
    False
    """
    return any(fnmatch.fnmatchcase(fd_name, pattern) for pattern in patterns)

The * is causing all pattern matches to match.

So when exclude_imports_glob += ("google/protobuf/*",) is added. The * is causing everything to match. [source: github]

odubno avatar Feb 27 '24 16:02 odubno