Make PathMatcher correctly exclude paths on windows / any OS without / seperators (#3837)

This commit is contained in:
Rune Tynan
2020-03-09 18:33:19 -04:00
committed by GitHub
parent d8b081130d
commit 2b8b116a19

View File

@@ -61,6 +61,7 @@ def create_parser() -> argparse.ArgumentParser:
class PathMatcher:
def __init__(self, patterns: Sequence[str]) -> None:
patterns = [re.escape(os.path.join(*x.split("/"))) for x in patterns]
self.matcher = re.compile(r"({})$".format("|".join(patterns))) if patterns else None
def search(self, path: str) -> Optional[Match[str]]: