Skip to content

Commit

Permalink
docs: Update PatternMatchingEventHandler documentation (#1048)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
nbelakovski and BoboTiG authored Jul 21, 2024
1 parent 402ad01 commit 6294daf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/watchdog/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down Expand Up @@ -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__(
Expand Down

0 comments on commit 6294daf

Please sign in to comment.