import re from typing import List, Optional def is_path_match(path: str, *, match: Optional[List[str]]) -> bool: """Return True if path is in match, False otherwise.""" if match is None: return False return path in match def is_path_match_re(path: str, *, match: Optional[List[str]]) -> bool: """Return True if path matches any of the regexes in match, False otherwise.""" if match is None: return False for p in match: if re.compile(p).match(path): return True return False