Skip to content

Commit

Permalink
use fnmatch instead of pathlibs match (#220)
Browse files Browse the repository at this point in the history
pathlibs match doesn't work with fnmatch patterns, but these are necessary to exclude whole subfolders for example
  • Loading branch information
Mutantpenguin authored and karthiknadig committed Nov 13, 2023
1 parent b7c51d9 commit aa07061
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bundled/tool/lsp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import annotations

import contextlib
import fnmatch
import io
import os
import pathlib
Expand Down Expand Up @@ -88,10 +89,10 @@ def is_stdlib_file(file_path: str) -> bool:


def is_match(patterns: List[str], file_path: str) -> bool:
"""Returns true if the file matches one of the glob patterns."""
"""Returns true if the file matches one of the fnmatch patterns."""
if not patterns:
return False
return any(pathlib.Path(file_path).match(pattern) for pattern in patterns)
return any(fnmatch.fnmatch(file_path, pattern) for pattern in patterns)


# pylint: disable-next=too-few-public-methods
Expand Down

0 comments on commit aa07061

Please sign in to comment.