Skip to content

Commit

Permalink
[fsevents] Add missing event_filter keyword-argument to `FSEventsOb…
Browse files Browse the repository at this point in the history
…server.schedule()` (#1050)
  • Loading branch information
BoboTiG authored Jul 25, 2024
1 parent 6294daf commit ab5117a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Changelog

2024-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v4.0.1...HEAD>`__

-
- Thanks to our beloved contributors: @
- [fsevents] Add missing ``event_filter`` keyword-argument to ``FSEventsObserver.schedule()`` (`#1049 <https://github.com/gorakhargosh/watchdog/pull/1049>`__)
- Thanks to our beloved contributors: @BoboTiG

4.0.1
~~~~~
Expand Down
9 changes: 5 additions & 4 deletions src/watchdog/observers/fsevents.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def _is_meta_mod(event):
"""Returns True if the event indicates a change in metadata."""
return event.is_inode_meta_mod or event.is_xattr_mod or event.is_owner_change

def queue_events(self, timeout, events):
def queue_events(self, timeout, events): # type: ignore[override]
if logger.getEffectiveLevel() <= logging.DEBUG:
for event in events:
flags = ", ".join(attr for attr in dir(event) if getattr(event, attr) is True)
Expand Down Expand Up @@ -335,11 +335,12 @@ def _encode_path(self, path):

class FSEventsObserver(BaseObserver):
def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT):
super().__init__(emitter_class=FSEventsEmitter, timeout=timeout)
super().__init__(FSEventsEmitter, timeout=timeout)

def schedule(self, event_handler, path, recursive=False):
def schedule(self, event_handler, path, recursive=False, event_filter=None):
# Fix for issue #26: Trace/BPT error when given a unicode path
# string. https://github.com/gorakhargosh/watchdog/issues#issue/26
if isinstance(path, str):
path = unicodedata.normalize("NFC", path)
return BaseObserver.schedule(self, event_handler, path, recursive)

return super().schedule(event_handler, path, recursive=recursive, event_filter=event_filter)

0 comments on commit ab5117a

Please sign in to comment.