From 6294dafb5941c238427f5e4c2b1545540f16186d Mon Sep 17 00:00:00 2001 From: nbelakovski Date: Sun, 21 Jul 2024 09:19:00 -0400 Subject: [PATCH] docs: Update PatternMatchingEventHandler documentation (#1048) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update PatternMatchingEventHandler documentation From the existing docs it's not clear what the difference is between PatternMatching and RegexMatching. Hopefully this makes it clearer. Also made a note that RegexMatching uses the re module, since there are various flavors of regex syntax and it's important to know which one is used. * Apply suggestions from code review --------- Co-authored-by: Mickaƫl Schoentgen --- src/watchdog/events.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/watchdog/events.py b/src/watchdog/events.py index 51c6c5bf..afa8548a 100755 --- a/src/watchdog/events.py +++ b/src/watchdog/events.py @@ -297,6 +297,8 @@ def on_opened(self, event: FileSystemEvent) -> None: class PatternMatchingEventHandler(FileSystemEventHandler): """ Matches given patterns with file paths associated with occurring events. + Uses pathlib's `PurePath.match()` method. `patterns` and `ignore_patterns` + are expected to be a list of strings. """ def __init__( @@ -375,6 +377,7 @@ def dispatch(self, event: FileSystemEvent) -> None: class RegexMatchingEventHandler(FileSystemEventHandler): """ Matches given regexes with file paths associated with occurring events. + Uses the `re` module. """ def __init__(