Skip to content

Commit

Permalink
Use fnmatch instead of pathlibs match (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mutantpenguin authored and karthiknadig committed Nov 10, 2023
1 parent 3771683 commit 7ef7616
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 os.path
Expand Down Expand Up @@ -97,10 +98,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 7ef7616

Please sign in to comment.